Class: ConnectWise::UnpostedProcurement

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/models/unposted_procurement.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UnpostedProcurement

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


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

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

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

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

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

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

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

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

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

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

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

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

  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.purchase_order_taxable_flag = attributes[:purchase_order_taxable_flag] if attributes.key?(:purchase_order_taxable_flag)

  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.tax_total = attributes[:tax_total] if attributes.key?(:tax_total)

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

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

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

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

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

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

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

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

  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_procurement.rb', line 16

def _info
  @_info
end

#avalara_tax_flagObject

Used to determine if Avalara tax is enabled.



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

def avalara_tax_flag
  @avalara_tax_flag
end

#billing_termsObject

Returns the value of attribute billing_terms.



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

def city_tax_xref
  @city_tax_xref
end

#composite_tax_amountObject

Returns the value of attribute composite_tax_amount.



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

def county_tax_xref
  @county_tax_xref
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#customerObject

Returns the value of attribute customer.



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

def customer
  @customer
end

#date_closedObject

Returns the value of attribute date_closed.



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

def description
  @description
end

#freight_costObject

Returns the value of attribute freight_cost.



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

def freight_cost
  @freight_cost
end

#freight_tax_totalObject

Returns the value of attribute freight_tax_total.



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

def freight_tax_total
  @freight_tax_total
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#item_taxable_flagObject

Returns the value of attribute item_taxable_flag.



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

def location_id
  @location_id
end

#procurement_typeObject

Returns the value of attribute procurement_type.



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

def procurement_type
  @procurement_type
end

#purchase_dateObject

Returns the value of attribute purchase_date.



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

def purchase_date
  @purchase_date
end

#purchase_orderObject

Returns the value of attribute purchase_order.



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

def purchase_order
  @purchase_order
end

#purchase_order_taxable_flagObject

Returns the value of attribute purchase_order_taxable_flag.



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

def purchase_order_taxable_flag
  @purchase_order_taxable_flag
end

#state_tax_amountObject

Returns the value of attribute state_tax_amount.



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

def state_tax_xref
  @state_tax_xref
end

#tax_codeObject

Returns the value of attribute tax_code.



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

def tax_code
  @tax_code
end

#tax_freight_flagObject

Returns the value of attribute tax_freight_flag.



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

def tax_freight_flag
  @tax_freight_flag
end

#tax_totalObject

Returns the value of attribute tax_total.



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

def tax_total
  @tax_total
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

#tracking_numberObject

Returns the value of attribute tracking_number.



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

def tracking_number
  @tracking_number
end

#unposted_product_idObject

Returns the value of attribute unposted_product_id.



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

def unposted_product_id
  @unposted_product_id
end

#vendorObject

Returns the value of attribute vendor.



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

def vendor
  @vendor
end

#vendor_account_numberObject

Returns the value of attribute vendor_account_number.



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

def 
  @vendor_account_number
end

#vendor_invoice_dateObject

Returns the value of attribute vendor_invoice_date.



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

def vendor_invoice_date
  @vendor_invoice_date
end

#vendor_invoice_numberObject

Returns the value of attribute vendor_invoice_number.



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

def vendor_invoice_number
  @vendor_invoice_number
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/connect_wise/models/unposted_procurement.rb', line 112

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

def self.attribute_map
  {
    id: :id,
    description: :description,
    unposted_product_id: :unpostedProductId,
    location_id: :locationId,
    department_id: :departmentId,
    procurement_type: :procurementType,
    purchase_order: :purchaseOrder,
    purchase_date: :purchaseDate,
    tracking_number: :trackingNumber,
    billing_terms: :billingTerms,
    currency: :currency,
    total: :total,
    tax_code: :taxCode,
    avalara_tax_flag: :avalaraTaxFlag,
    item_taxable_flag: :itemTaxableFlag,
    purchase_order_taxable_flag: :purchaseOrderTaxableFlag,
    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,
    tax_total: :taxTotal,
    customer: :customer,
    vendor: :vendor,
    vendor_account_number: :vendorAccountNumber,
    vendor_invoice_number: :vendorInvoiceNumber,
    vendor_invoice_date: :vendorInvoiceDate,
    tax_freight_flag: :taxFreightFlag,
    freight_tax_total: :freightTaxTotal,
    freight_cost: :freightCost,
    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



394
395
396
# File 'lib/connect_wise/models/unposted_procurement.rb', line 394

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

.openapi_nullableObject

List of attributes with nullable: true



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

def self.openapi_nullable
  Set.new(%i[
            location_id
            department_id
            procurement_type
            total
            avalara_tax_flag
            item_taxable_flag
            purchase_order_taxable_flag
            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
            tax_total
            tax_freight_flag
            freight_tax_total
            freight_cost
          ])
end

.openapi_typesObject

Attribute type mapping.



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/connect_wise/models/unposted_procurement.rb', line 117

def self.openapi_types
  {
    id: :Integer,
    description: :String,
    unposted_product_id: :String,
    location_id: :Integer,
    department_id: :Integer,
    procurement_type: :String,
    purchase_order: :PurchaseOrderReference,
    purchase_date: :String,
    tracking_number: :String,
    billing_terms: :BillingTermsReference,
    currency: :CurrencyReference,
    total: :Float,
    tax_code: :TaxCodeReference,
    avalara_tax_flag: :Boolean,
    item_taxable_flag: :Boolean,
    purchase_order_taxable_flag: :Boolean,
    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,
    tax_total: :Float,
    customer: :CompanyReference,
    vendor: :CompanyReference,
    vendor_account_number: :String,
    vendor_invoice_number: :String,
    vendor_invoice_date: :String,
    tax_freight_flag: :Boolean,
    freight_tax_total: :Float,
    freight_cost: :Float,
    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



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

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

  self.class == other.class &&
    id == other.id &&
    description == other.description &&
    unposted_product_id == other.unposted_product_id &&
    location_id == other.location_id &&
    department_id == other.department_id &&
    procurement_type == other.procurement_type &&
    purchase_order == other.purchase_order &&
    purchase_date == other.purchase_date &&
    tracking_number == other.tracking_number &&
    billing_terms == other.billing_terms &&
    currency == other.currency &&
    total == other.total &&
    tax_code == other.tax_code &&
    avalara_tax_flag == other.avalara_tax_flag &&
    item_taxable_flag == other.item_taxable_flag &&
    purchase_order_taxable_flag == other.purchase_order_taxable_flag &&
    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 &&
    tax_total == other.tax_total &&
    customer == other.customer &&
    vendor == other.vendor &&
     == other. &&
    vendor_invoice_number == other.vendor_invoice_number &&
    vendor_invoice_date == other.vendor_invoice_date &&
    tax_freight_flag == other.tax_freight_flag &&
    freight_tax_total == other.freight_tax_total &&
    freight_cost == other.freight_cost &&
    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



424
425
426
427
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
# File 'lib/connect_wise/models/unposted_procurement.rb', line 424

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



495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/connect_wise/models/unposted_procurement.rb', line 495

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



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/connect_wise/models/unposted_procurement.rb', line 401

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


381
382
383
# File 'lib/connect_wise/models/unposted_procurement.rb', line 381

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



387
388
389
# File 'lib/connect_wise/models/unposted_procurement.rb', line 387

def hash
  [id, description, unposted_product_id, location_id, department_id, procurement_type, purchase_order, purchase_date, tracking_number, billing_terms, currency, total, tax_code, avalara_tax_flag, item_taxable_flag, purchase_order_taxable_flag, 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, tax_total, customer, vendor, , vendor_invoice_number, vendor_invoice_date, tax_freight_flag, freight_tax_total, freight_cost, 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



304
305
306
# File 'lib/connect_wise/models/unposted_procurement.rb', line 304

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



471
472
473
# File 'lib/connect_wise/models/unposted_procurement.rb', line 471

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



477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/connect_wise/models/unposted_procurement.rb', line 477

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



465
466
467
# File 'lib/connect_wise/models/unposted_procurement.rb', line 465

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



310
311
312
313
314
315
# File 'lib/connect_wise/models/unposted_procurement.rb', line 310

def valid?
  procurement_type_validator = EnumAttributeValidator.new('String', %w[Purchase Adjustment Transfer])
  return false unless procurement_type_validator.valid?(@procurement_type)

  true
end