Class: ConnectWise::UnpostedInvoice

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

Raises:

  • (ArgumentError)


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

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::UnpostedInvoice` 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::UnpostedInvoice`. 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.id = attributes[:id] if attributes.key?(:id)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return unless attributes.key?(:_info)
  return unless (value = attributes[:_info]).is_a?(Hash)

  self._info = value
end

Instance Attribute Details

#_infoObject

Returns the value of attribute _info.



16
17
18
# File 'lib/connect_wise/models/unposted_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/unposted_invoice.rb', line 16

def 
  @account_number
end

#avalara_tax_flagObject

Used to determine if Avalara tax is enabled.



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

def avalara_tax_flag
  @avalara_tax_flag
end

#bill_to_companyObject

Returns the value of attribute bill_to_company.



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

def bill_to_company
  @bill_to_company
end

#bill_to_siteObject

Returns the value of attribute bill_to_site.



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

def bill_to_site
  @bill_to_site
end

#billing_log_idObject

Returns the value of attribute billing_log_id.



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

def billing_log_id
  @billing_log_id
end

#billing_termsObject

Returns the value of attribute billing_terms.



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

def billing_terms
  @billing_terms
end

#city_tax_amountObject

Returns the value of attribute city_tax_amount.



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

def city_tax_amount
  @city_tax_amount
end

#city_tax_flagObject

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



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

def city_tax_flag
  @city_tax_flag
end

#city_tax_xrefObject

Returns the value of attribute city_tax_xref.



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

def city_tax_xref
  @city_tax_xref
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#composite_tax_amountObject

Returns the value of attribute composite_tax_amount.



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

def composite_tax_amount
  @composite_tax_amount
end

#composite_tax_flagObject

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



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

def composite_tax_flag
  @composite_tax_flag
end

#composite_tax_xrefObject

Returns the value of attribute composite_tax_xref.



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

def composite_tax_xref
  @composite_tax_xref
end

#country_tax_amountObject

Returns the value of attribute country_tax_amount.



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

def country_tax_amount
  @country_tax_amount
end

#country_tax_flagObject

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



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

def country_tax_flag
  @country_tax_flag
end

#country_tax_xrefObject

Returns the value of attribute country_tax_xref.



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

def country_tax_xref
  @country_tax_xref
end

#county_tax_amountObject

Returns the value of attribute county_tax_amount.



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

def county_tax_amount
  @county_tax_amount
end

#county_tax_flagObject

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



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

def county_tax_flag
  @county_tax_flag
end

#county_tax_xrefObject

Returns the value of attribute county_tax_xref.



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

def county_tax_xref
  @county_tax_xref
end

#created_byObject

Returns the value of attribute created_by.



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

def created_by
  @created_by
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#date_closedObject

Returns the value of attribute date_closed.



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

def date_closed
  @date_closed
end

#department_idObject

Returns the value of attribute department_id.



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

def department_id
  @department_id
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#due_dateObject

Returns the value of attribute due_date.



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

def due_date
  @due_date
end

#due_daysObject

Returns the value of attribute due_days.



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

def due_days
  @due_days
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#invoice_dateObject

Returns the value of attribute invoice_date.



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

def invoice_date
  @invoice_date
end

#invoice_numberObject

Returns the value of attribute invoice_number.



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

def invoice_number
  @invoice_number
end

#invoice_taxable_flagObject

Returns the value of attribute invoice_taxable_flag.



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

def invoice_taxable_flag
  @invoice_taxable_flag
end

#invoice_typeObject

Returns the value of attribute invoice_type.



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

def invoice_type
  @invoice_type
end

#item_taxable_flagObject

Returns the value of attribute item_taxable_flag.



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

def item_taxable_flag
  @item_taxable_flag
end

#level_six_tax_amountObject

Returns the value of attribute level_six_tax_amount.



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

def level_six_tax_amount
  @level_six_tax_amount
end

#level_six_tax_flagObject

Set to true if transaction is taxable at level six.



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

def level_six_tax_flag
  @level_six_tax_flag
end

#level_six_tax_xrefObject

Returns the value of attribute level_six_tax_xref.



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

def level_six_tax_xref
  @level_six_tax_xref
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#sales_tax_amountObject

Returns the value of attribute sales_tax_amount.



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

def sales_tax_amount
  @sales_tax_amount
end

#ship_to_companyObject

Returns the value of attribute ship_to_company.



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

def ship_to_company
  @ship_to_company
end

#ship_to_siteObject

Returns the value of attribute ship_to_site.



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

def ship_to_site
  @ship_to_site
end

#state_tax_amountObject

Returns the value of attribute state_tax_amount.



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

def state_tax_amount
  @state_tax_amount
end

#state_tax_flagObject

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



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

def state_tax_flag
  @state_tax_flag
end

#state_tax_xrefObject

Returns the value of attribute state_tax_xref.



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

def state_tax_xref
  @state_tax_xref
end

#sub_totalObject

Returns the value of attribute sub_total.



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

def sub_total
  @sub_total
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



113
114
115
# File 'lib/connect_wise/models/unposted_invoice.rb', line 113

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



61
62
63
64
65
66
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
# File 'lib/connect_wise/models/unposted_invoice.rb', line 61

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,
    level_six_tax_flag: :levelSixTaxFlag,
    level_six_tax_xref: :levelSixTaxXref,
    level_six_tax_amount: :levelSixTaxAmount,
    created_by: :createdBy,
    date_closed: :dateClosed,
    _info: :_info
  }
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



398
399
400
# File 'lib/connect_wise/models/unposted_invoice.rb', line 398

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

.openapi_nullableObject

List of attributes with nullable: true



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

def self.openapi_nullable
  Set.new(i[
            billing_log_id
            location_id
            department_id
            invoice_type
            sub_total
            total
            invoice_taxable_flag
            avalara_tax_flag
            item_taxable_flag
            sales_tax_amount
            state_tax_flag
            state_tax_amount
            county_tax_flag
            county_tax_amount
            city_tax_flag
            city_tax_amount
            country_tax_flag
            country_tax_amount
            composite_tax_flag
            composite_tax_amount
            level_six_tax_flag
            level_six_tax_amount
          ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_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: :String,
    invoice_type: :String,
    description: :String,
    billing_terms: :BillingTermsReference,
    due_days: :String,
    due_date: :String,
    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,
    level_six_tax_flag: :Boolean,
    level_six_tax_xref: :String,
    level_six_tax_amount: :Float,
    created_by: :String,
    date_closed: :String,
    _info: :'Hash<String, String>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

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

  self.class == other.class &&
    id == other.id &&
    billing_log_id == other.billing_log_id &&
    location_id == other.location_id &&
    department_id == other.department_id &&
    company == other.company &&
     == other. &&
    bill_to_company == other.bill_to_company &&
    bill_to_site == other.bill_to_site &&
    ship_to_company == other.ship_to_company &&
    ship_to_site == other.ship_to_site &&
    invoice_number == other.invoice_number &&
    invoice_date == other.invoice_date &&
    invoice_type == other.invoice_type &&
    description == other.description &&
    billing_terms == other.billing_terms &&
    due_days == other.due_days &&
    due_date == other.due_date &&
    currency == other.currency &&
    sub_total == other.sub_total &&
    total == other.total &&
    invoice_taxable_flag == other.invoice_taxable_flag &&
    tax_code == other.tax_code &&
    avalara_tax_flag == other.avalara_tax_flag &&
    item_taxable_flag == other.item_taxable_flag &&
    sales_tax_amount == other.sales_tax_amount &&
    state_tax_flag == other.state_tax_flag &&
    state_tax_xref == other.state_tax_xref &&
    state_tax_amount == other.state_tax_amount &&
    county_tax_flag == other.county_tax_flag &&
    county_tax_xref == other.county_tax_xref &&
    county_tax_amount == other.county_tax_amount &&
    city_tax_flag == other.city_tax_flag &&
    city_tax_xref == other.city_tax_xref &&
    city_tax_amount == other.city_tax_amount &&
    country_tax_flag == other.country_tax_flag &&
    country_tax_xref == other.country_tax_xref &&
    country_tax_amount == other.country_tax_amount &&
    composite_tax_flag == other.composite_tax_flag &&
    composite_tax_xref == other.composite_tax_xref &&
    composite_tax_amount == other.composite_tax_amount &&
    level_six_tax_flag == other.level_six_tax_flag &&
    level_six_tax_xref == other.level_six_tax_xref &&
    level_six_tax_amount == other.level_six_tax_amount &&
    created_by == other.created_by &&
    date_closed == other.date_closed &&
    _info == other._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



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

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



499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/connect_wise/models/unposted_invoice.rb', line 499

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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/connect_wise/models/unposted_invoice.rb', line 405

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


385
386
387
# File 'lib/connect_wise/models/unposted_invoice.rb', line 385

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



391
392
393
# File 'lib/connect_wise/models/unposted_invoice.rb', line 391

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, level_six_tax_flag, level_six_tax_xref, level_six_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 properties with the reasons



307
308
309
# File 'lib/connect_wise/models/unposted_invoice.rb', line 307

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



475
476
477
# File 'lib/connect_wise/models/unposted_invoice.rb', line 475

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



481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/connect_wise/models/unposted_invoice.rb', line 481

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



469
470
471
# File 'lib/connect_wise/models/unposted_invoice.rb', line 469

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



313
314
315
316
317
318
# File 'lib/connect_wise/models/unposted_invoice.rb', line 313

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

  true
end