Class: ConnectWise::Invoice

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

Raises:

  • (ArgumentError)


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

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

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

    h[k.to_sym] = v
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  self.custom_fields = value
end

Instance Attribute Details

#_infoObject

Returns the value of attribute _info.



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

def _info
  @_info
end

#account_numberObject

Returns the value of attribute account_number.



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

def 
  @account_number
end

#add_to_batch_email_listObject

Returns the value of attribute add_to_batch_email_list.



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

def add_to_batch_email_list
  @add_to_batch_email_list
end

#adjusted_byObject

Returns the value of attribute adjusted_by.



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

def adjusted_by
  @adjusted_by
end

#adjustment_reasonObject

Returns the value of attribute adjustment_reason.



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

def adjustment_reason
  @adjustment_reason
end

#agreementObject

Returns the value of attribute agreement.



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

def agreement
  @agreement
end

#agreement_amountObject

Returns the value of attribute agreement_amount.



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

def agreement_amount
  @agreement_amount
end

#apply_to_idObject

Returns the value of attribute apply_to_id.



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

def apply_to_id
  @apply_to_id
end

#apply_to_typeObject

Returns the value of attribute apply_to_type.



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

def apply_to_type
  @apply_to_type
end

#attentionObject

Max length: 60;



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

def attention
  @attention
end

#balanceObject

Returns the value of attribute balance.



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

def balance
  @balance
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



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

def bill_to_company
  @bill_to_company
end

#billing_setup_referenceObject

Returns the value of attribute billing_setup_reference.



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

def billing_setup_reference
  @billing_setup_reference
end

#billing_siteObject

Returns the value of attribute billing_site.



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

def billing_site
  @billing_site
end

#billing_site_address_line1Object

Returns the value of attribute billing_site_address_line1.



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

def billing_site_address_line1
  @billing_site_address_line1
end

#billing_site_address_line2Object

Returns the value of attribute billing_site_address_line2.



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

def billing_site_address_line2
  @billing_site_address_line2
end

#billing_site_cityObject

Returns the value of attribute billing_site_city.



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

def billing_site_city
  @billing_site_city
end

#billing_site_countryObject

Returns the value of attribute billing_site_country.



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

def billing_site_country
  @billing_site_country
end

#billing_site_stateObject

Returns the value of attribute billing_site_state.



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

def billing_site_state
  @billing_site_state
end

#billing_site_zipObject

Returns the value of attribute billing_site_zip.



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

def billing_site_zip
  @billing_site_zip
end

#billing_termsObject

Returns the value of attribute billing_terms.



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

def billing_terms
  @billing_terms
end

#bottom_commentObject

Returns the value of attribute bottom_comment.



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

def bottom_comment
  @bottom_comment
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#creditsObject

Returns the value of attribute credits.



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

def credits
  @credits
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#customer_poObject

Max length: 50;



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

def customer_po
  @customer_po
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#department_idObject

departmentId is only required for special invoices



43
44
45
# File 'lib/connect_wise/models/invoice.rb', line 43

def department_id
  @department_id
end

#downpayment_appliedObject

Returns the value of attribute downpayment_applied.



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

def downpayment_applied
  @downpayment_applied
end

#downpayment_previously_taxed_flagObject

Returns the value of attribute downpayment_previously_taxed_flag.



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

def downpayment_previously_taxed_flag
  @downpayment_previously_taxed_flag
end

#due_dateObject

Returns the value of attribute due_date.



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

def due_date
  @due_date
end

#email_template_idObject

Can be obtained via InvoiceEmailTemplate report



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

def email_template_id
  @email_template_id
end

#expense_totalObject

Returns the value of attribute expense_total.



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

def expense_total
  @expense_total
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#internal_notesObject

Returns the value of attribute internal_notes.



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

def internal_notes
  @internal_notes
end

#invoice_numberObject

Max length: 15; Required On Updates;



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

def invoice_number
  @invoice_number
end

#invoice_templateObject

Returns the value of attribute invoice_template.



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

def invoice_template
  @invoice_template
end

#location_idObject

Required On Updates;



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

def location_id
  @location_id
end

#override_down_payment_amount_flagObject

Returns the value of attribute override_down_payment_amount_flag.



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

def override_down_payment_amount_flag
  @override_down_payment_amount_flag
end

#paymentsObject

Returns the value of attribute payments.



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

def payments
  @payments
end

#phaseObject

Returns the value of attribute phase.



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

def phase
  @phase
end

#previous_progress_appliedObject

Returns the value of attribute previous_progress_applied.



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

def previous_progress_applied
  @previous_progress_applied
end

#product_totalObject

Returns the value of attribute product_total.



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

def product_total
  @product_total
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#referenceObject

Max length: 50;



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

def reference
  @reference
end

#remaining_downpaymentObject

Returns the value of attribute remaining_downpayment.



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

def remaining_downpayment
  @remaining_downpayment
end

#restrict_downpayment_flagObject

Returns the value of attribute restrict_downpayment_flag.



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

def restrict_downpayment_flag
  @restrict_downpayment_flag
end

#sales_orderObject

Returns the value of attribute sales_order.



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

def sales_order
  @sales_order
end

#sales_taxObject

Returns the value of attribute sales_tax.



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

def sales_tax
  @sales_tax
end

#service_adjustment_amountObject

Returns the value of attribute service_adjustment_amount.



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

def service_adjustment_amount
  @service_adjustment_amount
end

#service_totalObject

Returns the value of attribute service_total.



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

def service_total
  @service_total
end

#ship_to_attentionObject

Max length: 60;



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

def ship_to_attention
  @ship_to_attention
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



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

def ship_to_company
  @ship_to_company
end

#shipping_siteObject

Returns the value of attribute shipping_site.



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

def shipping_site
  @shipping_site
end

#shipping_site_address_line1Object

Returns the value of attribute shipping_site_address_line1.



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

def shipping_site_address_line1
  @shipping_site_address_line1
end

#shipping_site_address_line2Object

Returns the value of attribute shipping_site_address_line2.



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

def shipping_site_address_line2
  @shipping_site_address_line2
end

#shipping_site_cityObject

Returns the value of attribute shipping_site_city.



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

def shipping_site_city
  @shipping_site_city
end

#shipping_site_countryObject

Returns the value of attribute shipping_site_country.



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

def shipping_site_country
  @shipping_site_country
end

#shipping_site_stateObject

Returns the value of attribute shipping_site_state.



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

def shipping_site_state
  @shipping_site_state
end

#shipping_site_zipObject

Returns the value of attribute shipping_site_zip.



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

def shipping_site_zip
  @shipping_site_zip
end

#special_invoice_flagObject

Returns the value of attribute special_invoice_flag.



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

def special_invoice_flag
  @special_invoice_flag
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#subtotalObject

Returns the value of attribute subtotal.



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

def subtotal
  @subtotal
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#taxable_flagObject

Returns the value of attribute taxable_flag.



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

def taxable_flag
  @taxable_flag
end

#template_setup_idObject

Can be obtained via InvoiceTemplate report



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

def template_setup_id
  @template_setup_id
end

#territory_idObject

Returns the value of attribute territory_id.



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

def territory_id
  @territory_id
end

#ticketObject

Returns the value of attribute ticket.



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

def ticket
  @ticket
end

#top_commentObject

Returns the value of attribute top_comment.



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

def top_comment
  @top_comment
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



145
146
147
# File 'lib/connect_wise/models/invoice.rb', line 145

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/connect_wise/models/invoice.rb', line 67

def self.attribute_map
  {
    type: :type,
    id: :id,
    invoice_number: :invoiceNumber,
    status: :status,
    company: :company,
    bill_to_company: :billToCompany,
    ship_to_company: :shipToCompany,
    account_number: :accountNumber,
    apply_to_type: :applyToType,
    apply_to_id: :applyToId,
    attention: :attention,
    ship_to_attention: :shipToAttention,
    billing_site: :billingSite,
    billing_site_address_line1: :billingSiteAddressLine1,
    billing_site_address_line2: :billingSiteAddressLine2,
    billing_site_city: :billingSiteCity,
    billing_site_state: :billingSiteState,
    billing_site_zip: :billingSiteZip,
    billing_site_country: :billingSiteCountry,
    shipping_site: :shippingSite,
    shipping_site_address_line1: :shippingSiteAddressLine1,
    shipping_site_address_line2: :shippingSiteAddressLine2,
    shipping_site_city: :shippingSiteCity,
    shipping_site_state: :shippingSiteState,
    shipping_site_zip: :shippingSiteZip,
    shipping_site_country: :shippingSiteCountry,
    billing_terms: :billingTerms,
    reference: :reference,
    customer_po: :customerPO,
    template_setup_id: :templateSetupId,
    invoice_template: :invoiceTemplate,
    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,
    override_down_payment_amount_flag: :overrideDownPaymentAmountFlag,
    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,
    billing_setup_reference: :billingSetupReference,
    ticket: :ticket,
    project: :project,
    phase: :phase,
    sales_order: :salesOrder,
    agreement: :agreement,
    _info: :_info,
    custom_fields: :customFields
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



554
555
556
# File 'lib/connect_wise/models/invoice.rb', line 554

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

.openapi_nullableObject

List of attributes with nullable: true



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

def self.openapi_nullable
  Set.new(i[
            type
            apply_to_type
            apply_to_id
            template_setup_id
            email_template_id
            add_to_batch_email_list
            restrict_downpayment_flag
            location_id
            department_id
            territory_id
            taxable_flag
            downpayment_previously_taxed_flag
            service_total
            override_down_payment_amount_flag
            expense_total
            product_total
            previous_progress_applied
            service_adjustment_amount
            agreement_amount
            downpayment_applied
            subtotal
            total
            remaining_downpayment
            sales_tax
            payments
            credits
            balance
            special_invoice_flag
          ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    type: :String,
    id: :Integer,
    invoice_number: :String,
    status: :BillingStatusReference,
    company: :CompanyReference,
    bill_to_company: :CompanyReference,
    ship_to_company: :CompanyReference,
    account_number: :String,
    apply_to_type: :String,
    apply_to_id: :Integer,
    attention: :String,
    ship_to_attention: :String,
    billing_site: :SiteReference,
    billing_site_address_line1: :String,
    billing_site_address_line2: :String,
    billing_site_city: :String,
    billing_site_state: :String,
    billing_site_zip: :String,
    billing_site_country: :String,
    shipping_site: :SiteReference,
    shipping_site_address_line1: :String,
    shipping_site_address_line2: :String,
    shipping_site_city: :String,
    shipping_site_state: :String,
    shipping_site_zip: :String,
    shipping_site_country: :String,
    billing_terms: :BillingTermsReference,
    reference: :String,
    customer_po: :String,
    template_setup_id: :Integer,
    invoice_template: :InvoiceTemplateDetailReference,
    email_template_id: :Integer,
    add_to_batch_email_list: :Boolean,
    date: :Time,
    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,
    override_down_payment_amount_flag: :Boolean,
    currency: :CurrencyReference,
    due_date: :Time,
    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,
    billing_setup_reference: :BillingSetupReference,
    ticket: :TicketReference,
    project: :ProjectReference,
    phase: :ProjectPhaseReference,
    sales_order: :SalesOrderReference,
    agreement: :AgreementReference,
    _info: :'Hash<String, String>',
    custom_fields: :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



461
462
463
464
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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/connect_wise/models/invoice.rb', line 461

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

  self.class == other.class &&
    type == other.type &&
    id == other.id &&
    invoice_number == other.invoice_number &&
    status == other.status &&
    company == other.company &&
    bill_to_company == other.bill_to_company &&
    ship_to_company == other.ship_to_company &&
     == other. &&
    apply_to_type == other.apply_to_type &&
    apply_to_id == other.apply_to_id &&
    attention == other.attention &&
    ship_to_attention == other.ship_to_attention &&
    billing_site == other.billing_site &&
    billing_site_address_line1 == other.billing_site_address_line1 &&
    billing_site_address_line2 == other.billing_site_address_line2 &&
    billing_site_city == other.billing_site_city &&
    billing_site_state == other.billing_site_state &&
    billing_site_zip == other.billing_site_zip &&
    billing_site_country == other.billing_site_country &&
    shipping_site == other.shipping_site &&
    shipping_site_address_line1 == other.shipping_site_address_line1 &&
    shipping_site_address_line2 == other.shipping_site_address_line2 &&
    shipping_site_city == other.shipping_site_city &&
    shipping_site_state == other.shipping_site_state &&
    shipping_site_zip == other.shipping_site_zip &&
    shipping_site_country == other.shipping_site_country &&
    billing_terms == other.billing_terms &&
    reference == other.reference &&
    customer_po == other.customer_po &&
    template_setup_id == other.template_setup_id &&
    invoice_template == other.invoice_template &&
    email_template_id == other.email_template_id &&
    add_to_batch_email_list == other.add_to_batch_email_list &&
    date == other.date &&
    restrict_downpayment_flag == other.restrict_downpayment_flag &&
    location_id == other.location_id &&
    department_id == other.department_id &&
    territory_id == other.territory_id &&
    top_comment == other.top_comment &&
    bottom_comment == other.bottom_comment &&
    taxable_flag == other.taxable_flag &&
    tax_code == other.tax_code &&
    internal_notes == other.internal_notes &&
    downpayment_previously_taxed_flag == other.downpayment_previously_taxed_flag &&
    service_total == other.service_total &&
    override_down_payment_amount_flag == other.override_down_payment_amount_flag &&
    currency == other.currency &&
    due_date == other.due_date &&
    expense_total == other.expense_total &&
    product_total == other.product_total &&
    previous_progress_applied == other.previous_progress_applied &&
    service_adjustment_amount == other.service_adjustment_amount &&
    agreement_amount == other.agreement_amount &&
    downpayment_applied == other.downpayment_applied &&
    subtotal == other.subtotal &&
    total == other.total &&
    remaining_downpayment == other.remaining_downpayment &&
    sales_tax == other.sales_tax &&
    adjustment_reason == other.adjustment_reason &&
    adjusted_by == other.adjusted_by &&
    payments == other.payments &&
    credits == other.credits &&
    balance == other.balance &&
    special_invoice_flag == other.special_invoice_flag &&
    billing_setup_reference == other.billing_setup_reference &&
    ticket == other.ticket &&
    project == other.project &&
    phase == other.phase &&
    sales_order == other.sales_order &&
    agreement == other.agreement &&
    _info == other._info &&
    custom_fields == other.custom_fields
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
613
614
615
616
617
618
619
620
621
# File 'lib/connect_wise/models/invoice.rb', line 584

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = ConnectWise.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/connect_wise/models/invoice.rb', line 655

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



561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/connect_wise/models/invoice.rb', line 561

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

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

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


541
542
543
# File 'lib/connect_wise/models/invoice.rb', line 541

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



547
548
549
# File 'lib/connect_wise/models/invoice.rb', line 547

def hash
  [type, id, invoice_number, status, company, bill_to_company, ship_to_company, , apply_to_type, apply_to_id, attention, ship_to_attention, billing_site, billing_site_address_line1, billing_site_address_line2, billing_site_city, billing_site_state, billing_site_zip, billing_site_country, shipping_site, shipping_site_address_line1, shipping_site_address_line2, shipping_site_city, shipping_site_state, shipping_site_zip, shipping_site_country, billing_terms, reference, customer_po, template_setup_id, invoice_template, 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, override_down_payment_amount_flag, 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, billing_setup_reference, ticket, project, phase, sales_order, agreement, _info, custom_fields].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



425
426
427
# File 'lib/connect_wise/models/invoice.rb', line 425

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



631
632
633
# File 'lib/connect_wise/models/invoice.rb', line 631

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



637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/connect_wise/models/invoice.rb', line 637

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

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



625
626
627
# File 'lib/connect_wise/models/invoice.rb', line 625

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



431
432
433
434
435
436
437
438
439
# File 'lib/connect_wise/models/invoice.rb', line 431

def valid?
  type_validator = EnumAttributeValidator.new('String', %w[Agreement CreditMemo DownPayment Miscellaneous Progress Standard])
  return false unless type_validator.valid?(@type)

  apply_to_type_validator = EnumAttributeValidator.new('String', %w[All Agreement Project ProjectPhase SalesOrder Ticket])
  return false unless apply_to_type_validator.valid?(@apply_to_type)

  true
end