Class: ConnectWise::TimeEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/connectwise-ruby-sdk/models/time_entry.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TimeEntry

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 188

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'company')
    self.company = attributes[:'company']
  end

  if attributes.has_key?(:'chargeToId')
    self.charge_to_id = attributes[:'chargeToId']
  end

  if attributes.has_key?(:'chargeToType')
    self.charge_to_type = attributes[:'chargeToType']
  end

  if attributes.has_key?(:'member')
    self.member = attributes[:'member']
  end

  if attributes.has_key?(:'locationId')
    self.location_id = attributes[:'locationId']
  end

  if attributes.has_key?(:'businessUnitId')
    self.business_unit_id = attributes[:'businessUnitId']
  end

  if attributes.has_key?(:'workType')
    self.work_type = attributes[:'workType']
  end

  if attributes.has_key?(:'workRole')
    self.work_role = attributes[:'workRole']
  end

  if attributes.has_key?(:'agreement')
    self.agreement = attributes[:'agreement']
  end

  if attributes.has_key?(:'timeStart')
    self.time_start = attributes[:'timeStart']
  end

  if attributes.has_key?(:'timeEnd')
    self.time_end = attributes[:'timeEnd']
  end

  if attributes.has_key?(:'hoursDeduct')
    self.hours_deduct = attributes[:'hoursDeduct']
  end

  if attributes.has_key?(:'actualHours')
    self.actual_hours = attributes[:'actualHours']
  end

  if attributes.has_key?(:'billableOption')
    self.billable_option = attributes[:'billableOption']
  end

  if attributes.has_key?(:'notes')
    self.notes = attributes[:'notes']
  end

  if attributes.has_key?(:'internalNotes')
    self.internal_notes = attributes[:'internalNotes']
  end

  if attributes.has_key?(:'addToDetailDescriptionFlag')
    self.add_to_detail_description_flag = attributes[:'addToDetailDescriptionFlag']
  end

  if attributes.has_key?(:'addToInternalAnalysisFlag')
    self.add_to_internal_analysis_flag = attributes[:'addToInternalAnalysisFlag']
  end

  if attributes.has_key?(:'addToResolutionFlag')
    self.add_to_resolution_flag = attributes[:'addToResolutionFlag']
  end

  if attributes.has_key?(:'emailResourceFlag')
    self.email_resource_flag = attributes[:'emailResourceFlag']
  end

  if attributes.has_key?(:'emailContactFlag')
    self.email_contact_flag = attributes[:'emailContactFlag']
  end

  if attributes.has_key?(:'emailCcFlag')
    self.email_cc_flag = attributes[:'emailCcFlag']
  end

  if attributes.has_key?(:'emailCc')
    self.email_cc = attributes[:'emailCc']
  end

  if attributes.has_key?(:'hoursBilled')
    self.hours_billed = attributes[:'hoursBilled']
  end

  if attributes.has_key?(:'enteredBy')
    self.entered_by = attributes[:'enteredBy']
  end

  if attributes.has_key?(:'dateEntered')
    self.date_entered = attributes[:'dateEntered']
  end

  if attributes.has_key?(:'invoice')
    self.invoice = attributes[:'invoice']
  end

  if attributes.has_key?(:'mobileGuid')
    self.mobile_guid = attributes[:'mobileGuid']
  end

  if attributes.has_key?(:'hourlyRate')
    self.hourly_rate = attributes[:'hourlyRate']
  end

  if attributes.has_key?(:'timeSheet')
    self.time_sheet = attributes[:'timeSheet']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

  if attributes.has_key?(:'customFields')
    if (value = attributes[:'customFields']).is_a?(Array)
      self.custom_fields = value
    end
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



80
81
82
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 80

def _info
  @_info
end

#actual_hoursObject

Returns the value of attribute actual_hours.



36
37
38
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 36

def actual_hours
  @actual_hours
end

#add_to_detail_description_flagObject

Returns the value of attribute add_to_detail_description_flag.



44
45
46
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 44

def add_to_detail_description_flag
  @add_to_detail_description_flag
end

#add_to_internal_analysis_flagObject

Returns the value of attribute add_to_internal_analysis_flag.



46
47
48
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 46

def add_to_internal_analysis_flag
  @add_to_internal_analysis_flag
end

#add_to_resolution_flagObject

Returns the value of attribute add_to_resolution_flag.



48
49
50
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 48

def add_to_resolution_flag
  @add_to_resolution_flag
end

#agreementObject

Returns the value of attribute agreement.



28
29
30
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 28

def agreement
  @agreement
end

#billable_optionObject

Returns the value of attribute billable_option.



38
39
40
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 38

def billable_option
  @billable_option
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



22
23
24
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 22

def business_unit_id
  @business_unit_id
end

#charge_to_idObject

If chargeToId is not specified, we asume you enter time against the company specified



13
14
15
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 13

def charge_to_id
  @charge_to_id
end

#charge_to_typeObject

If chargeToId is not specified, we asume you enter time against the company specified



16
17
18
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 16

def charge_to_type
  @charge_to_type
end

#companyObject

If chargeToId is not specified, we asume you enter time against the company specified



10
11
12
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 10

def company
  @company
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



82
83
84
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 82

def custom_fields
  @custom_fields
end

#date_enteredObject

Returns the value of attribute date_entered.



66
67
68
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 66

def date_entered
  @date_entered
end

#email_ccObject

To update this value use the /service/tickets endpoint automaticEmailCc field



60
61
62
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 60

def email_cc
  @email_cc
end

#email_cc_flagObject

This is an action flag. To update this value use the /service/tickets endpoint automaticEmailCcFlag field



57
58
59
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 57

def email_cc_flag
  @email_cc_flag
end

#email_contact_flagObject

This is an action flag. To update this value use the /service/tickets endpoint automaticEmailContactFlag field



54
55
56
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 54

def email_contact_flag
  @email_contact_flag
end

#email_resource_flagObject

This is an action flag. To update this value use the /service/tickets endpoint automaticEmailResourceFlag field



51
52
53
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 51

def email_resource_flag
  @email_resource_flag
end

#entered_byObject

Returns the value of attribute entered_by.



64
65
66
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 64

def entered_by
  @entered_by
end

#hourly_rateObject

This field may only be Updated, it is defaulted on Create



73
74
75
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 73

def hourly_rate
  @hourly_rate
end

#hours_billedObject

Returns the value of attribute hours_billed.



62
63
64
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 62

def hours_billed
  @hours_billed
end

#hours_deductObject

Returns the value of attribute hours_deduct.



34
35
36
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 34

def hours_deduct
  @hours_deduct
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 7

def id
  @id
end

#internal_notesObject

Returns the value of attribute internal_notes.



42
43
44
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 42

def internal_notes
  @internal_notes
end

#invoiceObject

Returns the value of attribute invoice.



68
69
70
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 68

def invoice
  @invoice
end

#location_idObject

Returns the value of attribute location_id.



20
21
22
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 20

def location_id
  @location_id
end

#memberObject

Returns the value of attribute member.



18
19
20
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 18

def member
  @member
end

#mobile_guidObject

Returns the value of attribute mobile_guid.



70
71
72
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 70

def mobile_guid
  @mobile_guid
end

#notesObject

Returns the value of attribute notes.



40
41
42
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 40

def notes
  @notes
end

#statusObject

Returns the value of attribute status.



77
78
79
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 77

def status
  @status
end

#time_endObject

Returns the value of attribute time_end.



32
33
34
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 32

def time_end
  @time_end
end

#time_sheetObject

Returns the value of attribute time_sheet.



75
76
77
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 75

def time_sheet
  @time_sheet
end

#time_startObject

Returns the value of attribute time_start.



30
31
32
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 30

def time_start
  @time_start
end

#work_roleObject

Returns the value of attribute work_role.



26
27
28
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 26

def work_role
  @work_role
end

#work_typeObject

Returns the value of attribute work_type.



24
25
26
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 24

def work_type
  @work_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 107

def self.attribute_map
  {
    :'id' => :'id',
    :'company' => :'company',
    :'charge_to_id' => :'chargeToId',
    :'charge_to_type' => :'chargeToType',
    :'member' => :'member',
    :'location_id' => :'locationId',
    :'business_unit_id' => :'businessUnitId',
    :'work_type' => :'workType',
    :'work_role' => :'workRole',
    :'agreement' => :'agreement',
    :'time_start' => :'timeStart',
    :'time_end' => :'timeEnd',
    :'hours_deduct' => :'hoursDeduct',
    :'actual_hours' => :'actualHours',
    :'billable_option' => :'billableOption',
    :'notes' => :'notes',
    :'internal_notes' => :'internalNotes',
    :'add_to_detail_description_flag' => :'addToDetailDescriptionFlag',
    :'add_to_internal_analysis_flag' => :'addToInternalAnalysisFlag',
    :'add_to_resolution_flag' => :'addToResolutionFlag',
    :'email_resource_flag' => :'emailResourceFlag',
    :'email_contact_flag' => :'emailContactFlag',
    :'email_cc_flag' => :'emailCcFlag',
    :'email_cc' => :'emailCc',
    :'hours_billed' => :'hoursBilled',
    :'entered_by' => :'enteredBy',
    :'date_entered' => :'dateEntered',
    :'invoice' => :'invoice',
    :'mobile_guid' => :'mobileGuid',
    :'hourly_rate' => :'hourlyRate',
    :'time_sheet' => :'timeSheet',
    :'status' => :'status',
    :'_info' => :'_info',
    :'custom_fields' => :'customFields'
  }
end

.swagger_typesObject

Attribute type mapping.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 147

def self.swagger_types
  {
    :'id' => :'Integer',
    :'company' => :'CompanyReference',
    :'charge_to_id' => :'Integer',
    :'charge_to_type' => :'String',
    :'member' => :'MemberReference',
    :'location_id' => :'Integer',
    :'business_unit_id' => :'Integer',
    :'work_type' => :'WorkTypeReference',
    :'work_role' => :'WorkRoleReference',
    :'agreement' => :'AgreementReference',
    :'time_start' => :'DateTime',
    :'time_end' => :'DateTime',
    :'hours_deduct' => :'Float',
    :'actual_hours' => :'Float',
    :'billable_option' => :'String',
    :'notes' => :'String',
    :'internal_notes' => :'String',
    :'add_to_detail_description_flag' => :'BOOLEAN',
    :'add_to_internal_analysis_flag' => :'BOOLEAN',
    :'add_to_resolution_flag' => :'BOOLEAN',
    :'email_resource_flag' => :'BOOLEAN',
    :'email_contact_flag' => :'BOOLEAN',
    :'email_cc_flag' => :'BOOLEAN',
    :'email_cc' => :'String',
    :'hours_billed' => :'Float',
    :'entered_by' => :'String',
    :'date_entered' => :'DateTime',
    :'invoice' => :'InvoiceReference',
    :'mobile_guid' => :'Guid',
    :'hourly_rate' => :'Float',
    :'time_sheet' => :'TimeSheetReference',
    :'status' => :'String',
    :'_info' => :'Metadata',
    :'custom_fields' => :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 390

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      company == o.company &&
      charge_to_id == o.charge_to_id &&
      charge_to_type == o.charge_to_type &&
      member == o.member &&
      location_id == o.location_id &&
      business_unit_id == o.business_unit_id &&
      work_type == o.work_type &&
      work_role == o.work_role &&
      agreement == o.agreement &&
      time_start == o.time_start &&
      time_end == o.time_end &&
      hours_deduct == o.hours_deduct &&
      actual_hours == o.actual_hours &&
      billable_option == o.billable_option &&
      notes == o.notes &&
      internal_notes == o.internal_notes &&
      add_to_detail_description_flag == o.add_to_detail_description_flag &&
      add_to_internal_analysis_flag == o.add_to_internal_analysis_flag &&
      add_to_resolution_flag == o.add_to_resolution_flag &&
      email_resource_flag == o.email_resource_flag &&
      email_contact_flag == o.email_contact_flag &&
      email_cc_flag == o.email_cc_flag &&
      email_cc == o.email_cc &&
      hours_billed == o.hours_billed &&
      entered_by == o.entered_by &&
      date_entered == o.date_entered &&
      invoice == o.invoice &&
      mobile_guid == o.mobile_guid &&
      hourly_rate == o.hourly_rate &&
      time_sheet == o.time_sheet &&
      status == o.status &&
      _info == o._info &&
      custom_fields == o.custom_fields
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 465

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ConnectWise.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 531

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 444

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


431
432
433
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 431

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



437
438
439
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 437

def hash
  [id, company, charge_to_id, charge_to_type, member, location_id, business_unit_id, work_type, work_role, agreement, time_start, time_end, hours_deduct, actual_hours, billable_option, notes, internal_notes, add_to_detail_description_flag, add_to_internal_analysis_flag, add_to_resolution_flag, email_resource_flag, email_contact_flag, email_cc_flag, email_cc, hours_billed, entered_by, date_entered, invoice, mobile_guid, hourly_rate, time_sheet, status, _info, custom_fields].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



336
337
338
339
340
341
342
343
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 336

def list_invalid_properties
  invalid_properties = Array.new
  if @time_start.nil?
    invalid_properties.push("invalid value for 'time_start', time_start cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



511
512
513
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 511

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



517
518
519
520
521
522
523
524
525
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 517

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



505
506
507
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 505

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



347
348
349
350
351
352
353
354
355
356
# File 'lib/connectwise-ruby-sdk/models/time_entry.rb', line 347

def valid?
  charge_to_type_validator = EnumAttributeValidator.new('String', ["ServiceTicket", "ProjectTicket", "ChargeCode", "Activity"])
  return false unless charge_to_type_validator.valid?(@charge_to_type)
  return false if @time_start.nil?
  billable_option_validator = EnumAttributeValidator.new('String', ["Billable", "DoNotBill", "NoCharge", "NoDefault"])
  return false unless billable_option_validator.valid?(@billable_option)
  status_validator = EnumAttributeValidator.new('String', ["Open", "Rejected", "PendingApproval", "ErrorsCorrected", "PendingProjectApproval", "ApprovedByTierOne", "RejectBySecondTier", "ApprovedByTierTwo", "ReadyToBill", "Billed", "WrittenOff", "BilledAgreement"])
  return false unless status_validator.valid?(@status)
  return true
end