Class: ConnectWise::TimeEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/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

Raises:

  • (ArgumentError)


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
# File 'lib/connect_wise/models/time_entry.rb', line 191

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::TimeEntry` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `ConnectWise::TimeEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.time_start = attributes[:time_start] if attributes.key?(:time_start)

  self.id = attributes[:id] if attributes.key?(:id)

  self.company = attributes[:company] if attributes.key?(:company)

  self.charge_to_id = attributes[:charge_to_id] if attributes.key?(:charge_to_id)

  self.charge_to_type = attributes[:charge_to_type] if attributes.key?(:charge_to_type)

  self.member = attributes[:member] if attributes.key?(:member)

  self.location_id = attributes[:location_id] if attributes.key?(:location_id)

  self.business_unit_id = attributes[:business_unit_id] if attributes.key?(:business_unit_id)

  self.work_type = attributes[:work_type] if attributes.key?(:work_type)

  self.work_role = attributes[:work_role] if attributes.key?(:work_role)

  self.agreement = attributes[:agreement] if attributes.key?(:agreement)

  self.time_end = attributes[:time_end] if attributes.key?(:time_end)

  self.hours_deduct = attributes[:hours_deduct] if attributes.key?(:hours_deduct)

  self.actual_hours = attributes[:actual_hours] if attributes.key?(:actual_hours)

  self.billable_option = attributes[:billable_option] if attributes.key?(:billable_option)

  self.notes = attributes[:notes] if attributes.key?(:notes)

  self.internal_notes = attributes[:internal_notes] if attributes.key?(:internal_notes)

  self.add_to_detail_description_flag = attributes[:add_to_detail_description_flag] if attributes.key?(:add_to_detail_description_flag)

  self.add_to_internal_analysis_flag = attributes[:add_to_internal_analysis_flag] if attributes.key?(:add_to_internal_analysis_flag)

  self.add_to_resolution_flag = attributes[:add_to_resolution_flag] if attributes.key?(:add_to_resolution_flag)

  self.email_resource_flag = attributes[:email_resource_flag] if attributes.key?(:email_resource_flag)

  self.email_contact_flag = attributes[:email_contact_flag] if attributes.key?(:email_contact_flag)

  self.email_cc_flag = attributes[:email_cc_flag] if attributes.key?(:email_cc_flag)

  self.email_cc = attributes[:email_cc] if attributes.key?(:email_cc)

  self.hours_billed = attributes[:hours_billed] if attributes.key?(:hours_billed)

  self.invoice_hours = attributes[:invoice_hours] if attributes.key?(:invoice_hours)

  self.entered_by = attributes[:entered_by] if attributes.key?(:entered_by)

  self.date_entered = attributes[:date_entered] if attributes.key?(:date_entered)

  self.invoice = attributes[:invoice] if attributes.key?(:invoice)

  self.mobile_guid = attributes[:mobile_guid] if attributes.key?(:mobile_guid)

  self.hourly_rate = attributes[:hourly_rate] if attributes.key?(:hourly_rate)

  self.overage_rate = attributes[:overage_rate] if attributes.key?(:overage_rate)

  self.agreement_hours = attributes[:agreement_hours] if attributes.key?(:agreement_hours)

  self.agreement_amount = attributes[:agreement_amount] if attributes.key?(:agreement_amount)

  self.time_sheet = attributes[:time_sheet] if attributes.key?(:time_sheet)

  self.status = attributes[:status] if attributes.key?(:status)

  self.ticket = attributes[:ticket] if attributes.key?(:ticket)

  self.project = attributes[:project] if attributes.key?(:project)

  self.phase = attributes[:phase] if attributes.key?(:phase)

  if attributes.key?(:_info) && (value = attributes[:_info]).is_a?(Hash)
    self._info = value
  end

  return unless attributes.key?(:custom_fields)
  return unless (value = attributes[:custom_fields]).is_a?(Array)

  self.custom_fields = value
end

Instance Attribute Details

#_infoObject

Returns the value of attribute _info.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def _info
  @_info
end

#actual_hoursObject

Returns the value of attribute actual_hours.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def actual_hours
  @actual_hours
end

#add_to_detail_description_flagObject

Returns the value of attribute add_to_detail_description_flag.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

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.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

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.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def add_to_resolution_flag
  @add_to_resolution_flag
end

#agreementObject

Returns the value of attribute agreement.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def agreement
  @agreement
end

#agreement_amountObject

Returns the value of attribute agreement_amount.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def agreement_amount
  @agreement_amount
end

#agreement_hoursObject

Returns the value of attribute agreement_hours.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def agreement_hours
  @agreement_hours
end

#billable_optionObject

Required On Updates;



25
26
27
# File 'lib/connect_wise/models/time_entry.rb', line 25

def billable_option
  @billable_option
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

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



19
20
21
# File 'lib/connect_wise/models/time_entry.rb', line 19

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



22
23
24
# File 'lib/connect_wise/models/time_entry.rb', line 22

def charge_to_type
  @charge_to_type
end

#companyObject

Returns the value of attribute company.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def company
  @company
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def custom_fields
  @custom_fields
end

#date_enteredObject

Returns the value of attribute date_entered.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def date_entered
  @date_entered
end

#email_ccObject

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



37
38
39
# File 'lib/connect_wise/models/time_entry.rb', line 37

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



34
35
36
# File 'lib/connect_wise/models/time_entry.rb', line 34

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



31
32
33
# File 'lib/connect_wise/models/time_entry.rb', line 31

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



28
29
30
# File 'lib/connect_wise/models/time_entry.rb', line 28

def email_resource_flag
  @email_resource_flag
end

#entered_byObject

Returns the value of attribute entered_by.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def entered_by
  @entered_by
end

#hourly_rateObject

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



40
41
42
# File 'lib/connect_wise/models/time_entry.rb', line 40

def hourly_rate
  @hourly_rate
end

#hours_billedObject

Returns the value of attribute hours_billed.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def hours_billed
  @hours_billed
end

#hours_deductObject

Returns the value of attribute hours_deduct.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def hours_deduct
  @hours_deduct
end

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def id
  @id
end

#internal_notesObject

Returns the value of attribute internal_notes.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def internal_notes
  @internal_notes
end

#invoiceObject

Returns the value of attribute invoice.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def invoice
  @invoice
end

#invoice_hoursObject

Returns the value of attribute invoice_hours.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def invoice_hours
  @invoice_hours
end

#location_idObject

Returns the value of attribute location_id.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def location_id
  @location_id
end

#memberObject

Returns the value of attribute member.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def member
  @member
end

#mobile_guidObject

Returns the value of attribute mobile_guid.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def mobile_guid
  @mobile_guid
end

#notesObject

Returns the value of attribute notes.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def notes
  @notes
end

#overage_rateObject

Returns the value of attribute overage_rate.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def overage_rate
  @overage_rate
end

#phaseObject

Returns the value of attribute phase.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def phase
  @phase
end

#projectObject

Returns the value of attribute project.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def project
  @project
end

#statusObject

Returns the value of attribute status.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def status
  @status
end

#ticketObject

Returns the value of attribute ticket.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def ticket
  @ticket
end

#time_endObject

Returns the value of attribute time_end.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def time_end
  @time_end
end

#time_sheetObject

Returns the value of attribute time_sheet.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def time_sheet
  @time_sheet
end

#time_startObject

Returns the value of attribute time_start.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def time_start
  @time_start
end

#work_roleObject

Returns the value of attribute work_role.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def work_role
  @work_role
end

#work_typeObject

Returns the value of attribute work_type.



16
17
18
# File 'lib/connect_wise/models/time_entry.rb', line 16

def work_type
  @work_type
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



111
112
113
# File 'lib/connect_wise/models/time_entry.rb', line 111

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/connect_wise/models/time_entry.rb', line 64

def self.attribute_map
  {
    time_start: :timeStart,
    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_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,
    invoice_hours: :invoiceHours,
    entered_by: :enteredBy,
    date_entered: :dateEntered,
    invoice: :invoice,
    mobile_guid: :mobileGuid,
    hourly_rate: :hourlyRate,
    overage_rate: :overageRate,
    agreement_hours: :agreementHours,
    agreement_amount: :agreementAmount,
    time_sheet: :timeSheet,
    status: :status,
    ticket: :ticket,
    project: :project,
    phase: :phase,
    _info: :_info,
    custom_fields: :customFields
  }
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



406
407
408
# File 'lib/connect_wise/models/time_entry.rb', line 406

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/connect_wise/models/time_entry.rb', line 163

def self.openapi_nullable
  Set.new(i[
            charge_to_id
            charge_to_type
            location_id
            business_unit_id
            hours_deduct
            actual_hours
            billable_option
            add_to_detail_description_flag
            add_to_internal_analysis_flag
            add_to_resolution_flag
            email_resource_flag
            email_contact_flag
            email_cc_flag
            hours_billed
            invoice_hours
            mobile_guid
            hourly_rate
            overage_rate
            agreement_hours
            agreement_amount
            status
          ])
end

.openapi_typesObject

Attribute type mapping.



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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/connect_wise/models/time_entry.rb', line 116

def self.openapi_types
  {
    time_start: :Time,
    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_end: :Time,
    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,
    invoice_hours: :Float,
    entered_by: :String,
    date_entered: :Time,
    invoice: :InvoiceReference,
    mobile_guid: :String,
    hourly_rate: :Float,
    overage_rate: :Float,
    agreement_hours: :Float,
    agreement_amount: :Float,
    time_sheet: :TimeSheetReference,
    status: :String,
    ticket: :TicketReference,
    project: :ProjectReference,
    phase: :ProjectPhaseReference,
    _info: :'Hash<String, String>',
    custom_fields: :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/connect_wise/models/time_entry.rb', line 344

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    time_start == other.time_start &&
    id == other.id &&
    company == other.company &&
    charge_to_id == other.charge_to_id &&
    charge_to_type == other.charge_to_type &&
    member == other.member &&
    location_id == other.location_id &&
    business_unit_id == other.business_unit_id &&
    work_type == other.work_type &&
    work_role == other.work_role &&
    agreement == other.agreement &&
    time_end == other.time_end &&
    hours_deduct == other.hours_deduct &&
    actual_hours == other.actual_hours &&
    billable_option == other.billable_option &&
    notes == other.notes &&
    internal_notes == other.internal_notes &&
    add_to_detail_description_flag == other.add_to_detail_description_flag &&
    add_to_internal_analysis_flag == other.add_to_internal_analysis_flag &&
    add_to_resolution_flag == other.add_to_resolution_flag &&
    email_resource_flag == other.email_resource_flag &&
    email_contact_flag == other.email_contact_flag &&
    email_cc_flag == other.email_cc_flag &&
    email_cc == other.email_cc &&
    hours_billed == other.hours_billed &&
    invoice_hours == other.invoice_hours &&
    entered_by == other.entered_by &&
    date_entered == other.date_entered &&
    invoice == other.invoice &&
    mobile_guid == other.mobile_guid &&
    hourly_rate == other.hourly_rate &&
    overage_rate == other.overage_rate &&
    agreement_hours == other.agreement_hours &&
    agreement_amount == other.agreement_amount &&
    time_sheet == other.time_sheet &&
    status == other.status &&
    ticket == other.ticket &&
    project == other.project &&
    phase == other.phase &&
    _info == other._info &&
    custom_fields == other.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



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/connect_wise/models/time_entry.rb', line 436

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = ConnectWise.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/connect_wise/models/time_entry.rb', line 507

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



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/connect_wise/models/time_entry.rb', line 413

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


393
394
395
# File 'lib/connect_wise/models/time_entry.rb', line 393

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



399
400
401
# File 'lib/connect_wise/models/time_entry.rb', line 399

def hash
  [time_start, id, company, charge_to_id, charge_to_type, member, location_id, business_unit_id, work_type, work_role, agreement, 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, invoice_hours, entered_by, date_entered, invoice, mobile_guid, hourly_rate, overage_rate, agreement_hours, agreement_amount, time_sheet, status, ticket, project, phase, _info, custom_fields].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



291
292
293
294
295
296
# File 'lib/connect_wise/models/time_entry.rb', line 291

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

  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



483
484
485
# File 'lib/connect_wise/models/time_entry.rb', line 483

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



489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/connect_wise/models/time_entry.rb', line 489

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



477
478
479
# File 'lib/connect_wise/models/time_entry.rb', line 477

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



300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/connect_wise/models/time_entry.rb', line 300

def valid?
  return false if @time_start.nil?

  charge_to_type_validator = EnumAttributeValidator.new('String', %w[ServiceTicket ProjectTicket ChargeCode Activity])
  return false unless charge_to_type_validator.valid?(@charge_to_type)

  billable_option_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge NoDefault])
  return false unless billable_option_validator.valid?(@billable_option)

  status_validator = EnumAttributeValidator.new('String', %w[Open Rejected PendingApproval ErrorsCorrected PendingProjectApproval ApprovedByTierOne RejectBySecondTier ApprovedByTierTwo ReadyToBill Billed WrittenOff BilledAgreement])
  return false unless status_validator.valid?(@status)

  true
end