Class: ConnectWise::UnpostedExpense

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UnpostedExpense

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 234

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



104
105
106
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 104

def _info
  @_info
end

#account_numberObject

Returns the value of attribute account_number.



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

def 
  @account_number
end

#agreementObject

Returns the value of attribute agreement.



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

def agreement
  @agreement
end

#agreement_amount_coveredObject

Returns the value of attribute agreement_amount_covered.



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

def agreement_amount_covered
  @agreement_amount_covered
end

#avalara_tax_flagObject

Used to determine if Avalara tax is enabled.



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

def avalara_tax_flag
  @avalara_tax_flag
end

#billable_amountObject

Returns the value of attribute billable_amount.



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

def billable_amount
  @billable_amount
end

#charge_codeObject

Returns the value of attribute charge_code.



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

def charge_code
  @charge_code
end

#charge_descriptionObject

Returns the value of attribute charge_description.



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

def charge_description
  @charge_description
end

#city_tax_amountObject

Returns the value of attribute city_tax_amount.



85
86
87
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 85

def city_tax_amount
  @city_tax_amount
end

#city_tax_flagObject

Set to true if transaction is taxable at the city level.



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

def city_tax_flag
  @city_tax_flag
end

#city_tax_xrefObject

Returns the value of attribute city_tax_xref.



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

def city_tax_xref
  @city_tax_xref
end

#classificationObject

Returns the value of attribute classification.



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

def classification
  @classification
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#composite_tax_amountObject

Returns the value of attribute composite_tax_amount.



99
100
101
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 99

def composite_tax_amount
  @composite_tax_amount
end

#composite_tax_flagObject

Set to true if transaction is taxable at the composite level.



95
96
97
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 95

def composite_tax_flag
  @composite_tax_flag
end

#composite_tax_xrefObject

Returns the value of attribute composite_tax_xref.



97
98
99
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 97

def composite_tax_xref
  @composite_tax_xref
end

#country_tax_amountObject

Returns the value of attribute country_tax_amount.



92
93
94
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 92

def country_tax_amount
  @country_tax_amount
end

#country_tax_flagObject

Set to true if transaction is taxable at the country level.



88
89
90
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 88

def country_tax_flag
  @country_tax_flag
end

#country_tax_xrefObject

Returns the value of attribute country_tax_xref.



90
91
92
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 90

def country_tax_xref
  @country_tax_xref
end

#county_tax_amountObject

Returns the value of attribute county_tax_amount.



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

def county_tax_amount
  @county_tax_amount
end

#county_tax_flagObject

Set to true if transaction is taxable at the county level.



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

def county_tax_flag
  @county_tax_flag
end

#county_tax_xrefObject

Returns the value of attribute county_tax_xref.



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

def county_tax_xref
  @county_tax_xref
end

#credit_accountObject

Returns the value of attribute credit_account.



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

def 
  @credit_account
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#date_closedObject

Returns the value of attribute date_closed.



101
102
103
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 101

def date_closed
  @date_closed
end

#date_expenseObject

Returns the value of attribute date_expense.



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

def date_expense
  @date_expense
end

#department_idObject

Returns the value of attribute department_id.



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

def department_id
  @department_id
end

#expense_detail_idObject

Returns the value of attribute expense_detail_id.



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

def expense_detail_id
  @expense_detail_id
end

#expense_typeObject

Returns the value of attribute expense_type.



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

def expense_type
  @expense_type
end

#gl_typeObject

Returns the value of attribute gl_type.



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

def gl_type
  @gl_type
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#in_policyObject

Returns the value of attribute in_policy.



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

def in_policy
  @in_policy
end

#item_taxable_flagObject

Returns the value of attribute item_taxable_flag.



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

def item_taxable_flag
  @item_taxable_flag
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#memberObject

Returns the value of attribute member.



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

def member
  @member
end

#non_billable_amountObject

Returns the value of attribute non_billable_amount.



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

def non_billable_amount
  @non_billable_amount
end

#payment_methodObject

Returns the value of attribute payment_method.



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

def payment_method
  @payment_method
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#project_phaseObject

Returns the value of attribute project_phase.



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

def project_phase
  @project_phase
end

#sales_tax_amountObject

Returns the value of attribute sales_tax_amount.



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

def sales_tax_amount
  @sales_tax_amount
end

#state_tax_amountObject

Returns the value of attribute state_tax_amount.



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

def state_tax_amount
  @state_tax_amount
end

#state_tax_flagObject

Set to true if transaction is taxable at the state level.



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

def state_tax_flag
  @state_tax_flag
end

#state_tax_xrefObject

Returns the value of attribute state_tax_xref.



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

def state_tax_xref
  @state_tax_xref
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#ticketObject

Returns the value of attribute ticket.



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

def ticket
  @ticket
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

Class Method Details

.attribute_mapObject

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



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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 129

def self.attribute_map
  {
    :'id' => :'id',
    :'location_id' => :'locationId',
    :'department_id' => :'departmentId',
    :'company' => :'company',
    :'account_number' => :'accountNumber',
    :'credit_account' => :'creditAccount',
    :'expense_detail_id' => :'expenseDetailId',
    :'expense_type' => :'expenseType',
    :'classification' => :'classification',
    :'gl_type' => :'glType',
    :'member' => :'member',
    :'date_expense' => :'dateExpense',
    :'charge_code' => :'chargeCode',
    :'charge_description' => :'chargeDescription',
    :'in_policy' => :'inPolicy',
    :'payment_method' => :'paymentMethod',
    :'currency' => :'currency',
    :'total' => :'total',
    :'billable_amount' => :'billableAmount',
    :'non_billable_amount' => :'nonBillableAmount',
    :'agreement' => :'agreement',
    :'agreement_amount_covered' => :'agreementAmountCovered',
    :'ticket' => :'ticket',
    :'project' => :'project',
    :'project_phase' => :'projectPhase',
    :'tax_code' => :'taxCode',
    :'avalara_tax_flag' => :'avalaraTaxFlag',
    :'item_taxable_flag' => :'itemTaxableFlag',
    :'sales_tax_amount' => :'salesTaxAmount',
    :'state_tax_flag' => :'stateTaxFlag',
    :'state_tax_xref' => :'stateTaxXref',
    :'state_tax_amount' => :'stateTaxAmount',
    :'county_tax_flag' => :'countyTaxFlag',
    :'county_tax_xref' => :'countyTaxXref',
    :'county_tax_amount' => :'countyTaxAmount',
    :'city_tax_flag' => :'cityTaxFlag',
    :'city_tax_xref' => :'cityTaxXref',
    :'city_tax_amount' => :'cityTaxAmount',
    :'country_tax_flag' => :'countryTaxFlag',
    :'country_tax_xref' => :'countryTaxXref',
    :'country_tax_amount' => :'countryTaxAmount',
    :'composite_tax_flag' => :'compositeTaxFlag',
    :'composite_tax_xref' => :'compositeTaxXref',
    :'composite_tax_amount' => :'compositeTaxAmount',
    :'date_closed' => :'dateClosed',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



181
182
183
184
185
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
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 181

def self.swagger_types
  {
    :'id' => :'Integer',
    :'location_id' => :'Integer',
    :'department_id' => :'Integer',
    :'company' => :'CompanyReference',
    :'account_number' => :'String',
    :'credit_account' => :'String',
    :'expense_detail_id' => :'Integer',
    :'expense_type' => :'ExpenseTypeReference',
    :'classification' => :'String',
    :'gl_type' => :'String',
    :'member' => :'MemberReference',
    :'date_expense' => :'DateTime',
    :'charge_code' => :'ChargeCodeReference',
    :'charge_description' => :'String',
    :'in_policy' => :'BOOLEAN',
    :'payment_method' => :'PaymentMethodReference',
    :'currency' => :'CurrencyReference',
    :'total' => :'Float',
    :'billable_amount' => :'Float',
    :'non_billable_amount' => :'Float',
    :'agreement' => :'AgreementReference',
    :'agreement_amount_covered' => :'Float',
    :'ticket' => :'TicketReference',
    :'project' => :'ProjectReference',
    :'project_phase' => :'ProjectPhaseReference',
    :'tax_code' => :'TaxCodeReference',
    :'avalara_tax_flag' => :'BOOLEAN',
    :'item_taxable_flag' => :'BOOLEAN',
    :'sales_tax_amount' => :'Float',
    :'state_tax_flag' => :'BOOLEAN',
    :'state_tax_xref' => :'String',
    :'state_tax_amount' => :'Float',
    :'county_tax_flag' => :'BOOLEAN',
    :'county_tax_xref' => :'String',
    :'county_tax_amount' => :'Float',
    :'city_tax_flag' => :'BOOLEAN',
    :'city_tax_xref' => :'String',
    :'city_tax_amount' => :'Float',
    :'country_tax_flag' => :'BOOLEAN',
    :'country_tax_xref' => :'String',
    :'country_tax_amount' => :'Float',
    :'composite_tax_flag' => :'BOOLEAN',
    :'composite_tax_xref' => :'String',
    :'composite_tax_amount' => :'Float',
    :'date_closed' => :'DateTime',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 465

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      location_id == o.location_id &&
      department_id == o.department_id &&
      company == o.company &&
       == o. &&
       == o. &&
      expense_detail_id == o.expense_detail_id &&
      expense_type == o.expense_type &&
      classification == o.classification &&
      gl_type == o.gl_type &&
      member == o.member &&
      date_expense == o.date_expense &&
      charge_code == o.charge_code &&
      charge_description == o.charge_description &&
      in_policy == o.in_policy &&
      payment_method == o.payment_method &&
      currency == o.currency &&
      total == o.total &&
      billable_amount == o.billable_amount &&
      non_billable_amount == o.non_billable_amount &&
      agreement == o.agreement &&
      agreement_amount_covered == o.agreement_amount_covered &&
      ticket == o.ticket &&
      project == o.project &&
      project_phase == o.project_phase &&
      tax_code == o.tax_code &&
      avalara_tax_flag == o.avalara_tax_flag &&
      item_taxable_flag == o.item_taxable_flag &&
      sales_tax_amount == o.sales_tax_amount &&
      state_tax_flag == o.state_tax_flag &&
      state_tax_xref == o.state_tax_xref &&
      state_tax_amount == o.state_tax_amount &&
      county_tax_flag == o.county_tax_flag &&
      county_tax_xref == o.county_tax_xref &&
      county_tax_amount == o.county_tax_amount &&
      city_tax_flag == o.city_tax_flag &&
      city_tax_xref == o.city_tax_xref &&
      city_tax_amount == o.city_tax_amount &&
      country_tax_flag == o.country_tax_flag &&
      country_tax_xref == o.country_tax_xref &&
      country_tax_amount == o.country_tax_amount &&
      composite_tax_flag == o.composite_tax_flag &&
      composite_tax_xref == o.composite_tax_xref &&
      composite_tax_amount == o.composite_tax_amount &&
      date_closed == o.date_closed &&
      _info == o._info
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



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 552

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



618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 618

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



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

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


518
519
520
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 518

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



524
525
526
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 524

def hash
  [id, location_id, department_id, company, , , expense_detail_id, expense_type, classification, gl_type, member, date_expense, charge_code, charge_description, in_policy, payment_method, currency, total, billable_amount, non_billable_amount, agreement, agreement_amount_covered, ticket, project, project_phase, tax_code, avalara_tax_flag, item_taxable_flag, sales_tax_amount, state_tax_flag, state_tax_xref, state_tax_amount, county_tax_flag, county_tax_xref, county_tax_amount, city_tax_flag, city_tax_xref, city_tax_amount, country_tax_flag, country_tax_xref, country_tax_amount, composite_tax_flag, composite_tax_xref, composite_tax_amount, date_closed, _info].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



428
429
430
431
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 428

def list_invalid_properties
  invalid_properties = Array.new
  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



598
599
600
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 598

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



604
605
606
607
608
609
610
611
612
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 604

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



592
593
594
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 592

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



435
436
437
438
439
440
441
# File 'lib/connectwise-ruby-sdk/models/unposted_expense.rb', line 435

def valid?
  classification_validator = EnumAttributeValidator.new('String', ["NonReimbursable", "Reimbursable", "Personal"])
  return false unless classification_validator.valid?(@classification)
  gl_type_validator = EnumAttributeValidator.new('String', ["AP", "AR", "EE", "EI", "EO", "IA", "IT", "P", "PF", "R", "RA", "RD", "RE", "RP", "ST", "SD", "ET", "RM", "FT", "PT"])
  return false unless gl_type_validator.valid?(@gl_type)
  return true
end