Class: TripletexRubyClient::TravelExpense

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/models/travel_expense.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TravelExpense

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
333
334
335
336
337
338
339
340
341
342
343
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
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
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 239

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?(:'version')
    self.version = attributes[:'version']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#accommodation_allowancesObject

Link to individual accommodation allowances.



92
93
94
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 92

def accommodation_allowances
  @accommodation_allowances
end

#accounting_period_closedObject

Returns the value of attribute accounting_period_closed.



107
108
109
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 107

def accounting_period_closed
  @accounting_period_closed
end

#accounting_period_vat_closedObject

Returns the value of attribute accounting_period_vat_closed.



109
110
111
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 109

def accounting_period_vat_closed
  @accounting_period_vat_closed
end

#actionsObject

Returns the value of attribute actions.



101
102
103
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 101

def actions
  @actions
end

#amountObject

Returns the value of attribute amount.



65
66
67
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 65

def amount
  @amount
end

#approved_byObject

Returns the value of attribute approved_by.



27
28
29
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 27

def approved_by
  @approved_by
end

#approved_dateObject

Returns the value of attribute approved_date.



57
58
59
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 57

def approved_date
  @approved_date
end

#attachmentObject

Returns the value of attribute attachment.



43
44
45
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 43

def attachment
  @attachment
end

#attachment_countObject

Returns the value of attribute attachment_count.



97
98
99
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 97

def attachment_count
  @attachment_count
end

#changesObject

Returns the value of attribute changes.



19
20
21
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 19

def changes
  @changes
end

#chargeable_amountObject

Returns the value of attribute chargeable_amount.



69
70
71
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 69

def chargeable_amount
  @chargeable_amount
end

#completed_byObject

Returns the value of attribute completed_by.



29
30
31
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 29

def completed_by
  @completed_by
end

#completed_dateObject

Returns the value of attribute completed_date.



55
56
57
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 55

def completed_date
  @completed_date
end

#costsObject

Link to individual costs.



95
96
97
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 95

def costs
  @costs
end

#dateObject

Returns the value of attribute date.



59
60
61
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 59

def date
  @date
end

#departmentObject

Returns the value of attribute department.



31
32
33
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 31

def department
  @department
end

#employeeObject

Returns the value of attribute employee.



25
26
27
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 25

def employee
  @employee
end

#fixed_invoiced_amountObject

Returns the value of attribute fixed_invoiced_amount.



63
64
65
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 63

def fixed_invoiced_amount
  @fixed_invoiced_amount
end

#high_rate_vatObject

Returns the value of attribute high_rate_vat.



75
76
77
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 75

def high_rate_vat
  @high_rate_vat
end

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 15

def id
  @id
end

#invoiceObject

Returns the value of attribute invoice.



81
82
83
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 81

def invoice
  @invoice
end

#is_approvedObject

Returns the value of attribute is_approved.



47
48
49
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 47

def is_approved
  @is_approved
end

#is_chargeableObject

Returns the value of attribute is_chargeable.



49
50
51
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 49

def is_chargeable
  @is_chargeable
end

#is_completedObject

Returns the value of attribute is_completed.



45
46
47
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 45

def is_completed
  @is_completed
end

#is_fixed_invoiced_amountObject

Returns the value of attribute is_fixed_invoiced_amount.



51
52
53
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 51

def is_fixed_invoiced_amount
  @is_fixed_invoiced_amount
end

#is_include_attached_receipts_when_reinvoicingObject

Returns the value of attribute is_include_attached_receipts_when_reinvoicing.



53
54
55
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 53

def is_include_attached_receipts_when_reinvoicing
  @is_include_attached_receipts_when_reinvoicing
end

#is_salary_adminObject

Returns the value of attribute is_salary_admin.



103
104
105
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 103

def is_salary_admin
  @is_salary_admin
end

#low_rate_vatObject

Returns the value of attribute low_rate_vat.



71
72
73
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 71

def low_rate_vat
  @low_rate_vat
end

#medium_rate_vatObject

Returns the value of attribute medium_rate_vat.



73
74
75
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 73

def medium_rate_vat
  @medium_rate_vat
end

#mileage_allowancesObject

Link to individual mileage allowances.



89
90
91
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 89

def mileage_allowances
  @mileage_allowances
end

#numberObject

Returns the value of attribute number.



79
80
81
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 79

def number
  @number
end

#payment_amountObject

Returns the value of attribute payment_amount.



67
68
69
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 67

def payment_amount
  @payment_amount
end

#payment_amount_currencyObject

Returns the value of attribute payment_amount_currency.



77
78
79
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 77

def payment_amount_currency
  @payment_amount_currency
end

#payment_currencyObject

Returns the value of attribute payment_currency.



37
38
39
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 37

def payment_currency
  @payment_currency
end

#payslipObject

Returns the value of attribute payslip.



33
34
35
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 33

def payslip
  @payslip
end

#per_diem_compensationsObject

Link to individual per diem compensations.



86
87
88
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 86

def per_diem_compensations
  @per_diem_compensations
end

#projectObject

Returns the value of attribute project.



23
24
25
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 23

def project
  @project
end

#show_payslipObject

Returns the value of attribute show_payslip.



105
106
107
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 105

def show_payslip
  @show_payslip
end

#stateObject

Returns the value of attribute state.



99
100
101
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 99

def state
  @state
end

#titleObject

Returns the value of attribute title.



83
84
85
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 83

def title
  @title
end

#travel_advanceObject

Returns the value of attribute travel_advance.



61
62
63
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 61

def travel_advance
  @travel_advance
end

#travel_detailsObject

Returns the value of attribute travel_details.



39
40
41
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 39

def travel_details
  @travel_details
end

#urlObject

Returns the value of attribute url.



21
22
23
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 21

def url
  @url
end

#vat_typeObject

Returns the value of attribute vat_type.



35
36
37
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 35

def vat_type
  @vat_type
end

#versionObject

Returns the value of attribute version.



17
18
19
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 17

def version
  @version
end

#voucherObject

Returns the value of attribute voucher.



41
42
43
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 41

def voucher
  @voucher
end

Class Method Details

.attribute_mapObject

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



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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 134

def self.attribute_map
  {
    :'id' => :'id',
    :'version' => :'version',
    :'changes' => :'changes',
    :'url' => :'url',
    :'project' => :'project',
    :'employee' => :'employee',
    :'approved_by' => :'approvedBy',
    :'completed_by' => :'completedBy',
    :'department' => :'department',
    :'payslip' => :'payslip',
    :'vat_type' => :'vatType',
    :'payment_currency' => :'paymentCurrency',
    :'travel_details' => :'travelDetails',
    :'voucher' => :'voucher',
    :'attachment' => :'attachment',
    :'is_completed' => :'isCompleted',
    :'is_approved' => :'isApproved',
    :'is_chargeable' => :'isChargeable',
    :'is_fixed_invoiced_amount' => :'isFixedInvoicedAmount',
    :'is_include_attached_receipts_when_reinvoicing' => :'isIncludeAttachedReceiptsWhenReinvoicing',
    :'completed_date' => :'completedDate',
    :'approved_date' => :'approvedDate',
    :'date' => :'date',
    :'travel_advance' => :'travelAdvance',
    :'fixed_invoiced_amount' => :'fixedInvoicedAmount',
    :'amount' => :'amount',
    :'payment_amount' => :'paymentAmount',
    :'chargeable_amount' => :'chargeableAmount',
    :'low_rate_vat' => :'lowRateVAT',
    :'medium_rate_vat' => :'mediumRateVAT',
    :'high_rate_vat' => :'highRateVAT',
    :'payment_amount_currency' => :'paymentAmountCurrency',
    :'number' => :'number',
    :'invoice' => :'invoice',
    :'title' => :'title',
    :'per_diem_compensations' => :'perDiemCompensations',
    :'mileage_allowances' => :'mileageAllowances',
    :'accommodation_allowances' => :'accommodationAllowances',
    :'costs' => :'costs',
    :'attachment_count' => :'attachmentCount',
    :'state' => :'state',
    :'actions' => :'actions',
    :'is_salary_admin' => :'isSalaryAdmin',
    :'show_payslip' => :'showPayslip',
    :'accounting_period_closed' => :'accountingPeriodClosed',
    :'accounting_period_vat_closed' => :'accountingPeriodVATClosed'
  }
end

.swagger_typesObject

Attribute type mapping.



186
187
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
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 186

def self.swagger_types
  {
    :'id' => :'Integer',
    :'version' => :'Integer',
    :'changes' => :'Array<Change>',
    :'url' => :'String',
    :'project' => :'Project',
    :'employee' => :'Employee',
    :'approved_by' => :'Employee',
    :'completed_by' => :'Employee',
    :'department' => :'Department',
    :'payslip' => :'Payslip',
    :'vat_type' => :'VatType',
    :'payment_currency' => :'Currency',
    :'travel_details' => :'TravelDetails',
    :'voucher' => :'Voucher',
    :'attachment' => :'Document',
    :'is_completed' => :'BOOLEAN',
    :'is_approved' => :'BOOLEAN',
    :'is_chargeable' => :'BOOLEAN',
    :'is_fixed_invoiced_amount' => :'BOOLEAN',
    :'is_include_attached_receipts_when_reinvoicing' => :'BOOLEAN',
    :'completed_date' => :'String',
    :'approved_date' => :'String',
    :'date' => :'String',
    :'travel_advance' => :'Float',
    :'fixed_invoiced_amount' => :'Float',
    :'amount' => :'Float',
    :'payment_amount' => :'Float',
    :'chargeable_amount' => :'Float',
    :'low_rate_vat' => :'Float',
    :'medium_rate_vat' => :'Float',
    :'high_rate_vat' => :'Float',
    :'payment_amount_currency' => :'Float',
    :'number' => :'Integer',
    :'invoice' => :'Invoice',
    :'title' => :'String',
    :'per_diem_compensations' => :'Array<PerDiemCompensation>',
    :'mileage_allowances' => :'Array<MileageAllowance>',
    :'accommodation_allowances' => :'Array<AccommodationAllowance>',
    :'costs' => :'Array<Cost>',
    :'attachment_count' => :'Integer',
    :'state' => :'String',
    :'actions' => :'Array<Link>',
    :'is_salary_admin' => :'BOOLEAN',
    :'show_payslip' => :'BOOLEAN',
    :'accounting_period_closed' => :'BOOLEAN',
    :'accounting_period_vat_closed' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 513

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      version == o.version &&
      changes == o.changes &&
      url == o.url &&
      project == o.project &&
      employee == o.employee &&
      approved_by == o.approved_by &&
      completed_by == o.completed_by &&
      department == o.department &&
      payslip == o.payslip &&
      vat_type == o.vat_type &&
      payment_currency == o.payment_currency &&
      travel_details == o.travel_details &&
      voucher == o.voucher &&
      attachment == o.attachment &&
      is_completed == o.is_completed &&
      is_approved == o.is_approved &&
      is_chargeable == o.is_chargeable &&
      is_fixed_invoiced_amount == o.is_fixed_invoiced_amount &&
      is_include_attached_receipts_when_reinvoicing == o.is_include_attached_receipts_when_reinvoicing &&
      completed_date == o.completed_date &&
      approved_date == o.approved_date &&
      date == o.date &&
      travel_advance == o.travel_advance &&
      fixed_invoiced_amount == o.fixed_invoiced_amount &&
      amount == o.amount &&
      payment_amount == o.payment_amount &&
      chargeable_amount == o.chargeable_amount &&
      low_rate_vat == o.low_rate_vat &&
      medium_rate_vat == o.medium_rate_vat &&
      high_rate_vat == o.high_rate_vat &&
      payment_amount_currency == o.payment_amount_currency &&
      number == o.number &&
      invoice == o.invoice &&
      title == o.title &&
      per_diem_compensations == o.per_diem_compensations &&
      mileage_allowances == o.mileage_allowances &&
      accommodation_allowances == o.accommodation_allowances &&
      costs == o.costs &&
      attachment_count == o.attachment_count &&
      state == o.state &&
      actions == o.actions &&
      is_salary_admin == o.is_salary_admin &&
      show_payslip == o.show_payslip &&
      accounting_period_closed == o.accounting_period_closed &&
      accounting_period_vat_closed == o.accounting_period_vat_closed
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



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 600

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 = TripletexRubyClient.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



666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 666

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



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 579

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 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


566
567
568
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 566

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



572
573
574
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 572

def hash
  [id, version, changes, url, project, employee, approved_by, completed_by, department, payslip, vat_type, payment_currency, travel_details, voucher, attachment, is_completed, is_approved, is_chargeable, is_fixed_invoiced_amount, is_include_attached_receipts_when_reinvoicing, completed_date, approved_date, date, travel_advance, fixed_invoiced_amount, amount, payment_amount, chargeable_amount, low_rate_vat, medium_rate_vat, high_rate_vat, payment_amount_currency, number, invoice, title, per_diem_compensations, mileage_allowances, accommodation_allowances, costs, attachment_count, state, actions, is_salary_admin, show_payslip, accounting_period_closed, accounting_period_vat_closed].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 444

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

  if !@title.nil? && @title.to_s.length > 255
    invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.')
  end

  if !@attachment_count.nil? && @attachment_count > 2147483647
    invalid_properties.push('invalid value for "attachment_count", must be smaller than or equal to 2147483647.')
  end

  if !@attachment_count.nil? && @attachment_count < 0
    invalid_properties.push('invalid value for "attachment_count", must be greater than or equal to 0.')
  end

  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



646
647
648
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 646

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



652
653
654
655
656
657
658
659
660
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 652

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



640
641
642
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 640

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



467
468
469
470
471
472
473
474
475
# File 'lib/tripletex_ruby_client/models/travel_expense.rb', line 467

def valid?
  return false if @employee.nil?
  return false if !@title.nil? && @title.to_s.length > 255
  return false if !@attachment_count.nil? && @attachment_count > 2147483647
  return false if !@attachment_count.nil? && @attachment_count < 0
  state_validator = EnumAttributeValidator.new('String', ['ALL', 'OPEN', 'APPROVED', 'SALARY_PAID', 'DELIVERED'])
  return false unless state_validator.valid?(@state)
  true
end