Class: ConnectWise::Invoice

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Invoice

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
441
442
443
444
445
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 243

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'restrictDownpaymentFlag')
    self.restrict_downpayment_flag = attributes[:'restrictDownpaymentFlag']
  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?(:'territoryId')
    self.territory_id = attributes[:'territoryId']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



107
108
109
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 107

def _info
  @_info
end

#add_to_batch_email_listObject

Returns the value of attribute add_to_batch_email_list.



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

def add_to_batch_email_list
  @add_to_batch_email_list
end

#adjusted_byObject

Returns the value of attribute adjusted_by.



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

def adjusted_by
  @adjusted_by
end

#adjustment_reasonObject

Returns the value of attribute adjustment_reason.



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

def adjustment_reason
  @adjustment_reason
end

#agreement_amountObject

Returns the value of attribute agreement_amount.



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

def agreement_amount
  @agreement_amount
end

#apply_to_idObject

Returns the value of attribute apply_to_id.



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

def apply_to_id
  @apply_to_id
end

#apply_to_typeObject

Returns the value of attribute apply_to_type.



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

def apply_to_type
  @apply_to_type
end

#attentionObject

Returns the value of attribute attention.



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

def attention
  @attention
end

#balanceObject

Returns the value of attribute balance.



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

def balance
  @balance
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



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

def bill_to_company
  @bill_to_company
end

#billing_siteObject

Returns the value of attribute billing_site.



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

def billing_site
  @billing_site
end

#billing_termsObject

Returns the value of attribute billing_terms.



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

def billing_terms
  @billing_terms
end

#bottom_commentObject

Returns the value of attribute bottom_comment.



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

def bottom_comment
  @bottom_comment
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#creditsObject

Returns the value of attribute credits.



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

def credits
  @credits
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#customer_poObject

Returns the value of attribute customer_po.



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

def customer_po
  @customer_po
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#department_idObject

departmentId is only required for special invoices



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

def department_id
  @department_id
end

#downpayment_appliedObject

Returns the value of attribute downpayment_applied.



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

def downpayment_applied
  @downpayment_applied
end

#downpayment_previously_taxed_flagObject

Returns the value of attribute downpayment_previously_taxed_flag.



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

def downpayment_previously_taxed_flag
  @downpayment_previously_taxed_flag
end

#due_dateObject

Returns the value of attribute due_date.



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

def due_date
  @due_date
end

#email_template_idObject

Can be obtained via InvoiceEmailTemplate report



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

def email_template_id
  @email_template_id
end

#expense_totalObject

Returns the value of attribute expense_total.



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

def expense_total
  @expense_total
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#internal_notesObject

Returns the value of attribute internal_notes.



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

def internal_notes
  @internal_notes
end

#invoice_numberObject

Returns the value of attribute invoice_number.



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

def invoice_number
  @invoice_number
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#paymentsObject

Returns the value of attribute payments.



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

def payments
  @payments
end

#previous_progress_appliedObject

Returns the value of attribute previous_progress_applied.



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

def previous_progress_applied
  @previous_progress_applied
end

#product_totalObject

Returns the value of attribute product_total.



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

def product_total
  @product_total
end

#referenceObject

Returns the value of attribute reference.



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

def reference
  @reference
end

#remaining_downpaymentObject

Returns the value of attribute remaining_downpayment.



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

def remaining_downpayment
  @remaining_downpayment
end

#restrict_downpayment_flagObject

Returns the value of attribute restrict_downpayment_flag.



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

def restrict_downpayment_flag
  @restrict_downpayment_flag
end

#sales_taxObject

Returns the value of attribute sales_tax.



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

def sales_tax
  @sales_tax
end

#service_adjustment_amountObject

Returns the value of attribute service_adjustment_amount.



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

def service_adjustment_amount
  @service_adjustment_amount
end

#service_totalObject

Returns the value of attribute service_total.



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

def service_total
  @service_total
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



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

def ship_to_company
  @ship_to_company
end

#shipping_siteObject

Returns the value of attribute shipping_site.



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

def shipping_site
  @shipping_site
end

#special_invoice_flagObject

Returns the value of attribute special_invoice_flag.



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

def special_invoice_flag
  @special_invoice_flag
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#subtotalObject

Returns the value of attribute subtotal.



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

def subtotal
  @subtotal
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#taxable_flagObject

Returns the value of attribute taxable_flag.



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

def taxable_flag
  @taxable_flag
end

#template_setup_idObject

Can be obtained via InvoiceTemplate report



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

def template_setup_id
  @template_setup_id
end

#territory_idObject

Returns the value of attribute territory_id.



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

def territory_id
  @territory_id
end

#top_commentObject

Returns the value of attribute top_comment.



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

def top_comment
  @top_comment
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'id' => :'id',
    :'invoice_number' => :'invoiceNumber',
    :'type' => :'type',
    :'status' => :'status',
    :'company' => :'company',
    :'bill_to_company' => :'billToCompany',
    :'ship_to_company' => :'shipToCompany',
    :'apply_to_type' => :'applyToType',
    :'apply_to_id' => :'applyToId',
    :'attention' => :'attention',
    :'billing_site' => :'billingSite',
    :'shipping_site' => :'shippingSite',
    :'billing_terms' => :'billingTerms',
    :'reference' => :'reference',
    :'customer_po' => :'customerPO',
    :'template_setup_id' => :'templateSetupId',
    :'email_template_id' => :'emailTemplateId',
    :'add_to_batch_email_list' => :'addToBatchEmailList',
    :'date' => :'date',
    :'restrict_downpayment_flag' => :'restrictDownpaymentFlag',
    :'location_id' => :'locationId',
    :'department_id' => :'departmentId',
    :'territory_id' => :'territoryId',
    :'top_comment' => :'topComment',
    :'bottom_comment' => :'bottomComment',
    :'taxable_flag' => :'taxableFlag',
    :'tax_code' => :'taxCode',
    :'internal_notes' => :'internalNotes',
    :'downpayment_previously_taxed_flag' => :'downpaymentPreviouslyTaxedFlag',
    :'service_total' => :'serviceTotal',
    :'currency' => :'currency',
    :'due_date' => :'dueDate',
    :'expense_total' => :'expenseTotal',
    :'product_total' => :'productTotal',
    :'previous_progress_applied' => :'previousProgressApplied',
    :'service_adjustment_amount' => :'serviceAdjustmentAmount',
    :'agreement_amount' => :'agreementAmount',
    :'downpayment_applied' => :'downpaymentApplied',
    :'subtotal' => :'subtotal',
    :'total' => :'total',
    :'remaining_downpayment' => :'remainingDownpayment',
    :'sales_tax' => :'salesTax',
    :'adjustment_reason' => :'adjustmentReason',
    :'adjusted_by' => :'adjustedBy',
    :'payments' => :'payments',
    :'credits' => :'credits',
    :'balance' => :'balance',
    :'special_invoice_flag' => :'specialInvoiceFlag',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



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
236
237
238
239
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 187

def self.swagger_types
  {
    :'id' => :'Integer',
    :'invoice_number' => :'String',
    :'type' => :'String',
    :'status' => :'BillingStatusReference',
    :'company' => :'CompanyReference',
    :'bill_to_company' => :'CompanyReference',
    :'ship_to_company' => :'CompanyReference',
    :'apply_to_type' => :'String',
    :'apply_to_id' => :'Integer',
    :'attention' => :'String',
    :'billing_site' => :'SiteReference',
    :'shipping_site' => :'SiteReference',
    :'billing_terms' => :'BillingTermsReference',
    :'reference' => :'String',
    :'customer_po' => :'String',
    :'template_setup_id' => :'Integer',
    :'email_template_id' => :'Integer',
    :'add_to_batch_email_list' => :'BOOLEAN',
    :'date' => :'DateTime',
    :'restrict_downpayment_flag' => :'BOOLEAN',
    :'location_id' => :'Integer',
    :'department_id' => :'Integer',
    :'territory_id' => :'Integer',
    :'top_comment' => :'String',
    :'bottom_comment' => :'String',
    :'taxable_flag' => :'BOOLEAN',
    :'tax_code' => :'TaxCodeReference',
    :'internal_notes' => :'String',
    :'downpayment_previously_taxed_flag' => :'BOOLEAN',
    :'service_total' => :'Float',
    :'currency' => :'CurrencyReference',
    :'due_date' => :'DateTime',
    :'expense_total' => :'Float',
    :'product_total' => :'Float',
    :'previous_progress_applied' => :'Float',
    :'service_adjustment_amount' => :'Float',
    :'agreement_amount' => :'Float',
    :'downpayment_applied' => :'Float',
    :'subtotal' => :'Float',
    :'total' => :'Float',
    :'remaining_downpayment' => :'Float',
    :'sales_tax' => :'Float',
    :'adjustment_reason' => :'String',
    :'adjusted_by' => :'String',
    :'payments' => :'Float',
    :'credits' => :'Float',
    :'balance' => :'Float',
    :'special_invoice_flag' => :'BOOLEAN',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 560

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      invoice_number == o.invoice_number &&
      type == o.type &&
      status == o.status &&
      company == o.company &&
      bill_to_company == o.bill_to_company &&
      ship_to_company == o.ship_to_company &&
      apply_to_type == o.apply_to_type &&
      apply_to_id == o.apply_to_id &&
      attention == o.attention &&
      billing_site == o.billing_site &&
      shipping_site == o.shipping_site &&
      billing_terms == o.billing_terms &&
      reference == o.reference &&
      customer_po == o.customer_po &&
      template_setup_id == o.template_setup_id &&
      email_template_id == o.email_template_id &&
      add_to_batch_email_list == o.add_to_batch_email_list &&
      date == o.date &&
      restrict_downpayment_flag == o.restrict_downpayment_flag &&
      location_id == o.location_id &&
      department_id == o.department_id &&
      territory_id == o.territory_id &&
      top_comment == o.top_comment &&
      bottom_comment == o.bottom_comment &&
      taxable_flag == o.taxable_flag &&
      tax_code == o.tax_code &&
      internal_notes == o.internal_notes &&
      downpayment_previously_taxed_flag == o.downpayment_previously_taxed_flag &&
      service_total == o.service_total &&
      currency == o.currency &&
      due_date == o.due_date &&
      expense_total == o.expense_total &&
      product_total == o.product_total &&
      previous_progress_applied == o.previous_progress_applied &&
      service_adjustment_amount == o.service_adjustment_amount &&
      agreement_amount == o.agreement_amount &&
      downpayment_applied == o.downpayment_applied &&
      subtotal == o.subtotal &&
      total == o.total &&
      remaining_downpayment == o.remaining_downpayment &&
      sales_tax == o.sales_tax &&
      adjustment_reason == o.adjustment_reason &&
      adjusted_by == o.adjusted_by &&
      payments == o.payments &&
      credits == o.credits &&
      balance == o.balance &&
      special_invoice_flag == o.special_invoice_flag &&
      _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



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 650

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



716
717
718
719
720
721
722
723
724
725
726
727
728
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 716

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



629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 629

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


616
617
618
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 616

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



622
623
624
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 622

def hash
  [id, invoice_number, type, status, company, bill_to_company, ship_to_company, apply_to_type, apply_to_id, attention, billing_site, shipping_site, billing_terms, reference, customer_po, template_setup_id, email_template_id, add_to_batch_email_list, date, restrict_downpayment_flag, location_id, department_id, territory_id, top_comment, bottom_comment, taxable_flag, tax_code, internal_notes, downpayment_previously_taxed_flag, service_total, currency, due_date, expense_total, product_total, previous_progress_applied, service_adjustment_amount, agreement_amount, downpayment_applied, subtotal, total, remaining_downpayment, sales_tax, adjustment_reason, adjusted_by, payments, credits, balance, special_invoice_flag, _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



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

def list_invalid_properties
  invalid_properties = Array.new
  if !@invoice_number.nil? && @invoice_number.to_s.length > 15
    invalid_properties.push("invalid value for 'invoice_number', the character length must be smaller than or equal to 15.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  if @company.nil?
    invalid_properties.push("invalid value for 'company', company cannot be nil.")
  end

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

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

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

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



696
697
698
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 696

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



702
703
704
705
706
707
708
709
710
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 702

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



690
691
692
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 690

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



480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/connectwise-ruby-sdk/models/invoice.rb', line 480

def valid?
  return false if !@invoice_number.nil? && @invoice_number.to_s.length > 15
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["Agreement", "CreditMemo", "DownPayment", "Miscellaneous", "Progress", "Standard"])
  return false unless type_validator.valid?(@type)
  return false if @company.nil?
  apply_to_type_validator = EnumAttributeValidator.new('String', ["All", "Agreement", "Project", "ProjectPhase", "SalesOrder", "Ticket"])
  return false unless apply_to_type_validator.valid?(@apply_to_type)
  return false if !@attention.nil? && @attention.to_s.length > 60
  return false if !@reference.nil? && @reference.to_s.length > 50
  return false if !@customer_po.nil? && @customer_po.to_s.length > 50
  return true
end