Class: ConnectWise::UnpostedInvoice

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UnpostedInvoice

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'invoiceTaxableFlag')
    self.invoice_taxable_flag = attributes[:'invoiceTaxableFlag']
  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?(:'createdBy')
    self.created_by = attributes[:'createdBy']
  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



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

def _info
  @_info
end

#account_numberObject

Returns the value of attribute account_number.



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

def 
  @account_number
end

#avalara_tax_flagObject

Used to determine if Avalara tax is enabled.



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

def avalara_tax_flag
  @avalara_tax_flag
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



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

def bill_to_company
  @bill_to_company
end

#bill_to_siteObject

Returns the value of attribute bill_to_site.



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

def bill_to_site
  @bill_to_site
end

#billing_log_idObject

Returns the value of attribute billing_log_id.



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

def billing_log_id
  @billing_log_id
end

#billing_termsObject

Returns the value of attribute billing_terms.



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

def billing_terms
  @billing_terms
end

#city_tax_amountObject

Returns the value of attribute city_tax_amount.



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

def city_tax_amount
  @city_tax_amount
end

#city_tax_flagObject

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



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

def city_tax_flag
  @city_tax_flag
end

#city_tax_xrefObject

Returns the value of attribute city_tax_xref.



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

def city_tax_xref
  @city_tax_xref
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#composite_tax_amountObject

Returns the value of attribute composite_tax_amount.



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

def composite_tax_amount
  @composite_tax_amount
end

#composite_tax_flagObject

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



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

def composite_tax_flag
  @composite_tax_flag
end

#composite_tax_xrefObject

Returns the value of attribute composite_tax_xref.



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

def composite_tax_xref
  @composite_tax_xref
end

#country_tax_amountObject

Returns the value of attribute country_tax_amount.



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

def country_tax_amount
  @country_tax_amount
end

#country_tax_flagObject

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



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

def country_tax_flag
  @country_tax_flag
end

#country_tax_xrefObject

Returns the value of attribute country_tax_xref.



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

def country_tax_xref
  @country_tax_xref
end

#county_tax_amountObject

Returns the value of attribute county_tax_amount.



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

def county_tax_amount
  @county_tax_amount
end

#county_tax_flagObject

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



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

def county_tax_flag
  @county_tax_flag
end

#county_tax_xrefObject

Returns the value of attribute county_tax_xref.



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

def county_tax_xref
  @county_tax_xref
end

#created_byObject

Returns the value of attribute created_by.



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

def created_by
  @created_by
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#date_closedObject

Returns the value of attribute date_closed.



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

def date_closed
  @date_closed
end

#department_idObject

Returns the value of attribute department_id.



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

def department_id
  @department_id
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#due_dateObject

Returns the value of attribute due_date.



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

def due_date
  @due_date
end

#due_daysObject

Returns the value of attribute due_days.



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

def due_days
  @due_days
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#invoice_dateObject

Returns the value of attribute invoice_date.



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

def invoice_date
  @invoice_date
end

#invoice_numberObject

Returns the value of attribute invoice_number.



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

def invoice_number
  @invoice_number
end

#invoice_taxable_flagObject

Returns the value of attribute invoice_taxable_flag.



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

def invoice_taxable_flag
  @invoice_taxable_flag
end

#invoice_typeObject

Returns the value of attribute invoice_type.



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

def invoice_type
  @invoice_type
end

#item_taxable_flagObject

Returns the value of attribute item_taxable_flag.



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

def item_taxable_flag
  @item_taxable_flag
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#sales_tax_amountObject

Returns the value of attribute sales_tax_amount.



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

def sales_tax_amount
  @sales_tax_amount
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



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

def ship_to_company
  @ship_to_company
end

#ship_to_siteObject

Returns the value of attribute ship_to_site.



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

def ship_to_site
  @ship_to_site
end

#state_tax_amountObject

Returns the value of attribute state_tax_amount.



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

def state_tax_amount
  @state_tax_amount
end

#state_tax_flagObject

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



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

def state_tax_flag
  @state_tax_flag
end

#state_tax_xrefObject

Returns the value of attribute state_tax_xref.



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

def state_tax_xref
  @state_tax_xref
end

#sub_totalObject

Returns the value of attribute sub_total.



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

def sub_total
  @sub_total
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

Class Method Details

.attribute_mapObject

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



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
161
162
163
164
165
166
167
168
169
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 123

def self.attribute_map
  {
    :'id' => :'id',
    :'billing_log_id' => :'billingLogId',
    :'location_id' => :'locationId',
    :'department_id' => :'departmentId',
    :'company' => :'company',
    :'account_number' => :'accountNumber',
    :'bill_to_company' => :'billToCompany',
    :'bill_to_site' => :'billToSite',
    :'ship_to_company' => :'shipToCompany',
    :'ship_to_site' => :'shipToSite',
    :'invoice_number' => :'invoiceNumber',
    :'invoice_date' => :'invoiceDate',
    :'invoice_type' => :'invoiceType',
    :'description' => :'description',
    :'billing_terms' => :'billingTerms',
    :'due_days' => :'dueDays',
    :'due_date' => :'dueDate',
    :'currency' => :'currency',
    :'sub_total' => :'subTotal',
    :'total' => :'total',
    :'invoice_taxable_flag' => :'invoiceTaxableFlag',
    :'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',
    :'created_by' => :'createdBy',
    :'date_closed' => :'dateClosed',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



172
173
174
175
176
177
178
179
180
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
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 172

def self.swagger_types
  {
    :'id' => :'Integer',
    :'billing_log_id' => :'Integer',
    :'location_id' => :'Integer',
    :'department_id' => :'Integer',
    :'company' => :'CompanyReference',
    :'account_number' => :'String',
    :'bill_to_company' => :'CompanyReference',
    :'bill_to_site' => :'SiteReference',
    :'ship_to_company' => :'CompanyReference',
    :'ship_to_site' => :'SiteReference',
    :'invoice_number' => :'String',
    :'invoice_date' => :'DateTime',
    :'invoice_type' => :'String',
    :'description' => :'String',
    :'billing_terms' => :'BillingTermsReference',
    :'due_days' => :'String',
    :'due_date' => :'DateTime',
    :'currency' => :'CurrencyReference',
    :'sub_total' => :'Float',
    :'total' => :'Float',
    :'invoice_taxable_flag' => :'BOOLEAN',
    :'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',
    :'created_by' => :'String',
    :'date_closed' => :'DateTime',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



429
430
431
432
433
434
435
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
474
475
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 429

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      billing_log_id == o.billing_log_id &&
      location_id == o.location_id &&
      department_id == o.department_id &&
      company == o.company &&
       == o. &&
      bill_to_company == o.bill_to_company &&
      bill_to_site == o.bill_to_site &&
      ship_to_company == o.ship_to_company &&
      ship_to_site == o.ship_to_site &&
      invoice_number == o.invoice_number &&
      invoice_date == o.invoice_date &&
      invoice_type == o.invoice_type &&
      description == o.description &&
      billing_terms == o.billing_terms &&
      due_days == o.due_days &&
      due_date == o.due_date &&
      currency == o.currency &&
      sub_total == o.sub_total &&
      total == o.total &&
      invoice_taxable_flag == o.invoice_taxable_flag &&
      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 &&
      created_by == o.created_by &&
      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



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

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



579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 579

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



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 492

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


479
480
481
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 479

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



485
486
487
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 485

def hash
  [id, billing_log_id, location_id, department_id, company, , bill_to_company, bill_to_site, ship_to_company, ship_to_site, invoice_number, invoice_date, invoice_type, description, billing_terms, due_days, due_date, currency, sub_total, total, invoice_taxable_flag, 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, created_by, 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



404
405
406
407
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 404

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



559
560
561
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 559

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



565
566
567
568
569
570
571
572
573
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 565

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



553
554
555
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 553

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



411
412
413
414
415
# File 'lib/connectwise-ruby-sdk/models/unposted_invoice.rb', line 411

def valid?
  invoice_type_validator = EnumAttributeValidator.new('String', ["Agreement", "CreditMemo", "DownPayment", "Miscellaneous", "Progress", "Standard"])
  return false unless invoice_type_validator.valid?(@invoice_type)
  return true
end