Class: ConnectWise::PurchaseOrder

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PurchaseOrder

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

def _info
  @_info
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



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

def business_unit_id
  @business_unit_id
end

#cancel_reasonObject

Returns the value of attribute cancel_reason.



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

def cancel_reason
  @cancel_reason
end

#closed_flagObject

The closed flag can only be updated via updating the purchase order status to a closed/open status.



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

def closed_flag
  @closed_flag
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#customer_cityObject

Returns the value of attribute customer_city.



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

def customer_city
  @customer_city
end

#customer_companyObject

Returns the value of attribute customer_company.



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

def customer_company
  @customer_company
end

#customer_contactObject

Returns the value of attribute customer_contact.



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

def customer_contact
  @customer_contact
end

#customer_countryObject

Returns the value of attribute customer_country.



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

def customer_country
  @customer_country
end

#customer_extensionObject

Returns the value of attribute customer_extension.



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

def customer_extension
  @customer_extension
end

#customer_nameObject

Returns the value of attribute customer_name.



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

def customer_name
  @customer_name
end

#customer_phoneObject

Returns the value of attribute customer_phone.



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

def customer_phone
  @customer_phone
end

#customer_siteObject

Returns the value of attribute customer_site.



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

def customer_site
  @customer_site
end

#customer_site_nameObject

Returns the value of attribute customer_site_name.



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

def customer_site_name
  @customer_site_name
end

#customer_stateObject

Returns the value of attribute customer_state.



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

def customer_state
  @customer_state
end

#customer_street_line1Object

Returns the value of attribute customer_street_line1.



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

def customer_street_line1
  @customer_street_line1
end

#customer_street_line2Object

Returns the value of attribute customer_street_line2.



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

def customer_street_line2
  @customer_street_line2
end

#customer_zipObject

Returns the value of attribute customer_zip.



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

def customer_zip
  @customer_zip
end

#date_closedObject

Returns the value of attribute date_closed.



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

def date_closed
  @date_closed
end

#drop_ship_customer_flagObject

Returns the value of attribute drop_ship_customer_flag.



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

def drop_ship_customer_flag
  @drop_ship_customer_flag
end

#entered_byObject

Returns the value of attribute entered_by.



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

def entered_by
  @entered_by
end

#freight_costObject

Returns the value of attribute freight_cost.



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

def freight_cost
  @freight_cost
end

#freight_packing_slipObject

Returns the value of attribute freight_packing_slip.



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

def freight_packing_slip
  @freight_packing_slip
end

#freight_tax_totalObject

Returns the value of attribute freight_tax_total.



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

def id
  @id
end

#internal_notesObject

Returns the value of attribute internal_notes.



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

def internal_notes
  @internal_notes
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#po_dateObject

Required On Updates;



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

def po_date
  @po_date
end

#po_numberObject

Required On Updates; Max length: 50;



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

def po_number
  @po_number
end

#sales_taxObject

Returns the value of attribute sales_tax.



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

def sales_tax
  @sales_tax
end

#shipment_dateObject

Returns the value of attribute shipment_date.



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

def shipment_date
  @shipment_date
end

#shipment_methodObject

Returns the value of attribute shipment_method.



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

def shipment_method
  @shipment_method
end

#shipping_instructionsObject

Returns the value of attribute shipping_instructions.



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

def shipping_instructions
  @shipping_instructions
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#sub_totalObject

Returns the value of attribute sub_total.



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

def tax_freight_flag
  @tax_freight_flag
end

#tax_po_flagObject

Returns the value of attribute tax_po_flag.



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

def tax_po_flag
  @tax_po_flag
end

#termsObject

Returns the value of attribute terms.



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

def terms
  @terms
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

#tracking_numberObject

Max length: 50;



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

def tracking_number
  @tracking_number
end

#update_shipment_infoObject

Determines whether or not to update all of the shipment info for each associated line item when new shipment info is passed in



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

def update_shipment_info
  @update_shipment_info
end

#update_vendor_order_numberObject

Determines whether or not to update vendor order number for each associated line item when new vendor order number is passed in



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

def update_vendor_order_number
  @update_vendor_order_number
end

#vendor_companyObject

Returns the value of attribute vendor_company.



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

def vendor_company
  @vendor_company
end

#vendor_contactObject

Returns the value of attribute vendor_contact.



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

def vendor_contact
  @vendor_contact
end

#vendor_invoice_dateObject

Returns the value of attribute vendor_invoice_date.



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

def vendor_invoice_date
  @vendor_invoice_date
end

#vendor_invoice_numberObject

Max length: 50;



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

def vendor_invoice_number
  @vendor_invoice_number
end

#vendor_order_numberObject

Max length: 50;



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

def vendor_order_number
  @vendor_order_number
end

#vendor_siteObject

Returns the value of attribute vendor_site.



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

def vendor_site
  @vendor_site
end

#warehouseObject

Returns the value of attribute warehouse.



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

def warehouse
  @warehouse
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



100
101
102
# File 'lib/connect_wise/models/purchase_order.rb', line 100

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
# File 'lib/connect_wise/models/purchase_order.rb', line 43

def self.attribute_map
  {
    id: :id,
    business_unit_id: :businessUnitId,
    cancel_reason: :cancelReason,
    closed_flag: :closedFlag,
    customer_city: :customerCity,
    customer_company: :customerCompany,
    customer_contact: :customerContact,
    customer_country: :customerCountry,
    customer_extension: :customerExtension,
    customer_name: :customerName,
    customer_phone: :customerPhone,
    customer_site: :customerSite,
    customer_site_name: :customerSiteName,
    customer_state: :customerState,
    customer_street_line1: :customerStreetLine1,
    customer_street_line2: :customerStreetLine2,
    customer_zip: :customerZip,
    date_closed: :dateClosed,
    drop_ship_customer_flag: :dropShipCustomerFlag,
    entered_by: :enteredBy,
    freight_cost: :freightCost,
    freight_packing_slip: :freightPackingSlip,
    freight_tax_total: :freightTaxTotal,
    internal_notes: :internalNotes,
    location_id: :locationId,
    po_date: :poDate,
    po_number: :poNumber,
    sales_tax: :salesTax,
    shipment_date: :shipmentDate,
    shipment_method: :shipmentMethod,
    shipping_instructions: :shippingInstructions,
    status: :status,
    sub_total: :subTotal,
    tax_code: :taxCode,
    tax_freight_flag: :taxFreightFlag,
    tax_po_flag: :taxPoFlag,
    terms: :terms,
    total: :total,
    tracking_number: :trackingNumber,
    update_shipment_info: :updateShipmentInfo,
    update_vendor_order_number: :updateVendorOrderNumber,
    vendor_company: :vendorCompany,
    vendor_contact: :vendorContact,
    vendor_invoice_date: :vendorInvoiceDate,
    vendor_invoice_number: :vendorInvoiceNumber,
    vendor_order_number: :vendorOrderNumber,
    vendor_site: :vendorSite,
    warehouse: :warehouse,
    currency: :currency,
    _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



386
387
388
# File 'lib/connect_wise/models/purchase_order.rb', line 386

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

.openapi_nullableObject

List of attributes with nullable: true



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/connect_wise/models/purchase_order.rb', line 162

def self.openapi_nullable
  Set.new(%i[
            business_unit_id
            closed_flag
            drop_ship_customer_flag
            freight_cost
            freight_tax_total
            location_id
            sales_tax
            sub_total
            tax_freight_flag
            tax_po_flag
            total
            update_shipment_info
            update_vendor_order_number
          ])
end

.openapi_typesObject

Attribute type mapping.



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/connect_wise/models/purchase_order.rb', line 105

def self.openapi_types
  {
    id: :Integer,
    business_unit_id: :Integer,
    cancel_reason: :String,
    closed_flag: :Boolean,
    customer_city: :String,
    customer_company: :CompanyReference,
    customer_contact: :ContactReference,
    customer_country: :CountryReference,
    customer_extension: :String,
    customer_name: :String,
    customer_phone: :String,
    customer_site: :SiteReference,
    customer_site_name: :String,
    customer_state: :String,
    customer_street_line1: :String,
    customer_street_line2: :String,
    customer_zip: :String,
    date_closed: :Time,
    drop_ship_customer_flag: :Boolean,
    entered_by: :String,
    freight_cost: :Float,
    freight_packing_slip: :String,
    freight_tax_total: :Float,
    internal_notes: :String,
    location_id: :Integer,
    po_date: :Time,
    po_number: :String,
    sales_tax: :Float,
    shipment_date: :Time,
    shipment_method: :ShipmentMethodReference,
    shipping_instructions: :String,
    status: :PurchaseOrderStatusReference,
    sub_total: :Float,
    tax_code: :TaxCodeReference,
    tax_freight_flag: :Boolean,
    tax_po_flag: :Boolean,
    terms: :BillingTermsReference,
    total: :Float,
    tracking_number: :String,
    update_shipment_info: :Boolean,
    update_vendor_order_number: :Boolean,
    vendor_company: :CompanyReference,
    vendor_contact: :ContactReference,
    vendor_invoice_date: :Time,
    vendor_invoice_number: :String,
    vendor_order_number: :String,
    vendor_site: :SiteReference,
    warehouse: :WarehouseReference,
    currency: :CurrencyReference,
    _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



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

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

  self.class == other.class &&
    id == other.id &&
    business_unit_id == other.business_unit_id &&
    cancel_reason == other.cancel_reason &&
    closed_flag == other.closed_flag &&
    customer_city == other.customer_city &&
    customer_company == other.customer_company &&
    customer_contact == other.customer_contact &&
    customer_country == other.customer_country &&
    customer_extension == other.customer_extension &&
    customer_name == other.customer_name &&
    customer_phone == other.customer_phone &&
    customer_site == other.customer_site &&
    customer_site_name == other.customer_site_name &&
    customer_state == other.customer_state &&
    customer_street_line1 == other.customer_street_line1 &&
    customer_street_line2 == other.customer_street_line2 &&
    customer_zip == other.customer_zip &&
    date_closed == other.date_closed &&
    drop_ship_customer_flag == other.drop_ship_customer_flag &&
    entered_by == other.entered_by &&
    freight_cost == other.freight_cost &&
    freight_packing_slip == other.freight_packing_slip &&
    freight_tax_total == other.freight_tax_total &&
    internal_notes == other.internal_notes &&
    location_id == other.location_id &&
    po_date == other.po_date &&
    po_number == other.po_number &&
    sales_tax == other.sales_tax &&
    shipment_date == other.shipment_date &&
    shipment_method == other.shipment_method &&
    shipping_instructions == other.shipping_instructions &&
    status == other.status &&
    sub_total == other.sub_total &&
    tax_code == other.tax_code &&
    tax_freight_flag == other.tax_freight_flag &&
    tax_po_flag == other.tax_po_flag &&
    terms == other.terms &&
    total == other.total &&
    tracking_number == other.tracking_number &&
    update_shipment_info == other.update_shipment_info &&
    update_vendor_order_number == other.update_vendor_order_number &&
    vendor_company == other.vendor_company &&
    vendor_contact == other.vendor_contact &&
    vendor_invoice_date == other.vendor_invoice_date &&
    vendor_invoice_number == other.vendor_invoice_number &&
    vendor_order_number == other.vendor_order_number &&
    vendor_site == other.vendor_site &&
    warehouse == other.warehouse &&
    currency == other.currency &&
    _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



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/connect_wise/models/purchase_order.rb', line 416

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



487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/connect_wise/models/purchase_order.rb', line 487

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



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/connect_wise/models/purchase_order.rb', line 393

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


373
374
375
# File 'lib/connect_wise/models/purchase_order.rb', line 373

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



379
380
381
# File 'lib/connect_wise/models/purchase_order.rb', line 379

def hash
  [id, business_unit_id, cancel_reason, closed_flag, customer_city, customer_company, customer_contact, customer_country, customer_extension, customer_name, customer_phone, customer_site, customer_site_name, customer_state, customer_street_line1, customer_street_line2, customer_zip, date_closed, drop_ship_customer_flag, entered_by, freight_cost, freight_packing_slip, freight_tax_total, internal_notes, location_id, po_date, po_number, sales_tax, shipment_date, shipment_method, shipping_instructions, status, sub_total, tax_code, tax_freight_flag, tax_po_flag, terms, total, tracking_number, update_shipment_info, update_vendor_order_number, vendor_company, vendor_contact, vendor_invoice_date, vendor_invoice_number, vendor_order_number, vendor_site, warehouse, currency, _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



302
303
304
# File 'lib/connect_wise/models/purchase_order.rb', line 302

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



463
464
465
# File 'lib/connect_wise/models/purchase_order.rb', line 463

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



469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/connect_wise/models/purchase_order.rb', line 469

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



457
458
459
# File 'lib/connect_wise/models/purchase_order.rb', line 457

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



308
309
310
# File 'lib/connect_wise/models/purchase_order.rb', line 308

def valid?
  true
end