Class: ConnectWise::ProductItem

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ProductItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 228

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'serialNumberIds')
    if (value = attributes[:'serialNumberIds']).is_a?(Array)
      self.serial_number_ids = value
    end
  end

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

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

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

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

  if attributes.has_key?(:'customFields')
    if (value = attributes[:'customFields']).is_a?(Array)
      self.custom_fields = value
    end
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



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

def _info
  @_info
end

#agreementObject

Returns the value of attribute agreement.



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

def agreement
  @agreement
end

#billable_optionObject

Returns the value of attribute billable_option.



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

def billable_option
  @billable_option
end

#business_unit_idObject

Returns the value of attribute business_unit_id.



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

def business_unit_id
  @business_unit_id
end

#bypass_forecast_updateObject

Returns the value of attribute bypass_forecast_update.



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

def bypass_forecast_update
  @bypass_forecast_update
end

#cancelled_byObject

Returns the value of attribute cancelled_by.



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

def cancelled_by
  @cancelled_by
end

#cancelled_dateObject

Returns the value of attribute cancelled_date.



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

def cancelled_date
  @cancelled_date
end

#cancelled_flagObject

Returns the value of attribute cancelled_flag.



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

def cancelled_flag
  @cancelled_flag
end

#cancelled_reasonObject

Returns the value of attribute cancelled_reason.



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

def cancelled_reason
  @cancelled_reason
end

#catalog_itemObject

Returns the value of attribute catalog_item.



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

def catalog_item
  @catalog_item
end

#charge_to_idObject

Returns the value of attribute charge_to_id.



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

def charge_to_id
  @charge_to_id
end

#charge_to_typeObject

Returns the value of attribute charge_to_type.



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

def charge_to_type
  @charge_to_type
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#costObject

Returns the value of attribute cost.



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

def cost
  @cost
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#customer_descriptionObject

Returns the value of attribute customer_description.



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

def customer_description
  @customer_description
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#discountObject

Returns the value of attribute discount.



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

def discount
  @discount
end

#dropship_flagObject

Returns the value of attribute dropship_flag.



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

def dropship_flag
  @dropship_flag
end

#entity_typeObject

Returns the value of attribute entity_type.



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

def entity_type
  @entity_type
end

#forecast_detail_idObject

Returns the value of attribute forecast_detail_id.



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

def forecast_detail_id
  @forecast_detail_id
end

#forecast_statusObject

Returns the value of attribute forecast_status.



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

def forecast_status
  @forecast_status
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#integration_x_refObject

Returns the value of attribute integration_x_ref.



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

def integration_x_ref
  @integration_x_ref
end

#internal_notesObject

Returns the value of attribute internal_notes.



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

def internal_notes
  @internal_notes
end

#list_priceObject

Returns the value of attribute list_price.



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

def list_price
  @list_price
end

#location_idObject

Returns the value of attribute location_id.



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

def location_id
  @location_id
end

#phase_product_flagObject

Returns the value of attribute phase_product_flag.



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

def phase_product_flag
  @phase_product_flag
end

#priceObject

Returns the value of attribute price.



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

def price
  @price
end

#price_methodObject

Returns the value of attribute price_method.



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

def price_method
  @price_method
end

#product_supplied_flagObject

Returns the value of attribute product_supplied_flag.



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

def product_supplied_flag
  @product_supplied_flag
end

#purchase_dateObject

Returns the value of attribute purchase_date.



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

def purchase_date
  @purchase_date
end

#quantityObject

Returns the value of attribute quantity.



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

def quantity
  @quantity
end

#quantity_cancelledObject

Returns the value of attribute quantity_cancelled.



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

def quantity_cancelled
  @quantity_cancelled
end

#recurringObject

Returns the value of attribute recurring.



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

def recurring
  @recurring
end

#sequence_numberObject

Returns the value of attribute sequence_number.



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

def sequence_number
  @sequence_number
end

#serial_number_idsObject

Returns the value of attribute serial_number_ids.



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

def serial_number_ids
  @serial_number_ids
end

#slaObject

Returns the value of attribute sla.



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

def sla
  @sla
end

#special_order_flagObject

Returns the value of attribute special_order_flag.



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

def special_order_flag
  @special_order_flag
end

#sub_contractor_amount_limitObject

Returns the value of attribute sub_contractor_amount_limit.



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

def sub_contractor_amount_limit
  @sub_contractor_amount_limit
end

#sub_contractor_ship_to_idObject

Returns the value of attribute sub_contractor_ship_to_id.



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

def sub_contractor_ship_to_id
  @sub_contractor_ship_to_id
end

#taxable_flagObject

Returns the value of attribute taxable_flag.



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

def taxable_flag
  @taxable_flag
end

#vendorObject

Returns the value of attribute vendor.



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

def vendor
  @vendor
end

#vendor_skuObject

Returns the value of attribute vendor_sku.



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

def vendor_sku
  @vendor_sku
end

#warehouseObject

Returns the value of attribute warehouse.



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

def warehouse
  @warehouse
end

#warehouse_binObject

Returns the value of attribute warehouse_bin.



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

def warehouse_bin
  @warehouse_bin
end

Class Method Details

.attribute_mapObject

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



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
168
169
170
171
172
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 123

def self.attribute_map
  {
    :'id' => :'id',
    :'catalog_item' => :'catalogItem',
    :'charge_to_id' => :'chargeToId',
    :'charge_to_type' => :'chargeToType',
    :'description' => :'description',
    :'sequence_number' => :'sequenceNumber',
    :'quantity' => :'quantity',
    :'price' => :'price',
    :'cost' => :'cost',
    :'discount' => :'discount',
    :'price_method' => :'priceMethod',
    :'billable_option' => :'billableOption',
    :'agreement' => :'agreement',
    :'location_id' => :'locationId',
    :'business_unit_id' => :'businessUnitId',
    :'vendor' => :'vendor',
    :'vendor_sku' => :'vendorSku',
    :'taxable_flag' => :'taxableFlag',
    :'dropship_flag' => :'dropshipFlag',
    :'special_order_flag' => :'specialOrderFlag',
    :'phase_product_flag' => :'phaseProductFlag',
    :'cancelled_flag' => :'cancelledFlag',
    :'quantity_cancelled' => :'quantityCancelled',
    :'cancelled_reason' => :'cancelledReason',
    :'customer_description' => :'customerDescription',
    :'internal_notes' => :'internalNotes',
    :'product_supplied_flag' => :'productSuppliedFlag',
    :'sub_contractor_ship_to_id' => :'subContractorShipToId',
    :'sub_contractor_amount_limit' => :'subContractorAmountLimit',
    :'recurring' => :'recurring',
    :'sla' => :'sla',
    :'entity_type' => :'entityType',
    :'forecast_detail_id' => :'forecastDetailId',
    :'cancelled_by' => :'cancelledBy',
    :'cancelled_date' => :'cancelledDate',
    :'warehouse' => :'warehouse',
    :'warehouse_bin' => :'warehouseBin',
    :'purchase_date' => :'purchaseDate',
    :'integration_x_ref' => :'integrationXRef',
    :'list_price' => :'listPrice',
    :'serial_number_ids' => :'serialNumberIds',
    :'company' => :'company',
    :'forecast_status' => :'forecastStatus',
    :'_info' => :'_info',
    :'bypass_forecast_update' => :'bypassForecastUpdate',
    :'custom_fields' => :'customFields'
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    :'id' => :'Integer',
    :'catalog_item' => :'CatalogItemReference',
    :'charge_to_id' => :'Integer',
    :'charge_to_type' => :'String',
    :'description' => :'String',
    :'sequence_number' => :'Float',
    :'quantity' => :'Float',
    :'price' => :'Float',
    :'cost' => :'Float',
    :'discount' => :'Float',
    :'price_method' => :'String',
    :'billable_option' => :'String',
    :'agreement' => :'AgreementReference',
    :'location_id' => :'Integer',
    :'business_unit_id' => :'Integer',
    :'vendor' => :'CompanyReference',
    :'vendor_sku' => :'String',
    :'taxable_flag' => :'BOOLEAN',
    :'dropship_flag' => :'BOOLEAN',
    :'special_order_flag' => :'BOOLEAN',
    :'phase_product_flag' => :'BOOLEAN',
    :'cancelled_flag' => :'BOOLEAN',
    :'quantity_cancelled' => :'Float',
    :'cancelled_reason' => :'String',
    :'customer_description' => :'String',
    :'internal_notes' => :'String',
    :'product_supplied_flag' => :'BOOLEAN',
    :'sub_contractor_ship_to_id' => :'Integer',
    :'sub_contractor_amount_limit' => :'Float',
    :'recurring' => :'ProductRecurring',
    :'sla' => :'SLAReference',
    :'entity_type' => :'EntityTypeReference',
    :'forecast_detail_id' => :'Integer',
    :'cancelled_by' => :'Integer',
    :'cancelled_date' => :'DateTime',
    :'warehouse' => :'String',
    :'warehouse_bin' => :'String',
    :'purchase_date' => :'DateTime',
    :'integration_x_ref' => :'String',
    :'list_price' => :'Float',
    :'serial_number_ids' => :'Array<Integer>',
    :'company' => :'CompanyReference',
    :'forecast_status' => :'OpportunityStatusReference',
    :'_info' => :'Metadata',
    :'bypass_forecast_update' => :'BOOLEAN',
    :'custom_fields' => :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 575

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      catalog_item == o.catalog_item &&
      charge_to_id == o.charge_to_id &&
      charge_to_type == o.charge_to_type &&
      description == o.description &&
      sequence_number == o.sequence_number &&
      quantity == o.quantity &&
      price == o.price &&
      cost == o.cost &&
      discount == o.discount &&
      price_method == o.price_method &&
      billable_option == o.billable_option &&
      agreement == o.agreement &&
      location_id == o.location_id &&
      business_unit_id == o.business_unit_id &&
      vendor == o.vendor &&
      vendor_sku == o.vendor_sku &&
      taxable_flag == o.taxable_flag &&
      dropship_flag == o.dropship_flag &&
      special_order_flag == o.special_order_flag &&
      phase_product_flag == o.phase_product_flag &&
      cancelled_flag == o.cancelled_flag &&
      quantity_cancelled == o.quantity_cancelled &&
      cancelled_reason == o.cancelled_reason &&
      customer_description == o.customer_description &&
      internal_notes == o.internal_notes &&
      product_supplied_flag == o.product_supplied_flag &&
      sub_contractor_ship_to_id == o.sub_contractor_ship_to_id &&
      sub_contractor_amount_limit == o.sub_contractor_amount_limit &&
      recurring == o.recurring &&
      sla == o.sla &&
      entity_type == o.entity_type &&
      forecast_detail_id == o.forecast_detail_id &&
      cancelled_by == o.cancelled_by &&
      cancelled_date == o.cancelled_date &&
      warehouse == o.warehouse &&
      warehouse_bin == o.warehouse_bin &&
      purchase_date == o.purchase_date &&
      integration_x_ref == o.integration_x_ref &&
      list_price == o.list_price &&
      serial_number_ids == o.serial_number_ids &&
      company == o.company &&
      forecast_status == o.forecast_status &&
      _info == o._info &&
      bypass_forecast_update == o.bypass_forecast_update &&
      custom_fields == o.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



662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 662

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

#_to_hash(value) ⇒ Hash

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 728

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



641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 641

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


628
629
630
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 628

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



634
635
636
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 634

def hash
  [id, catalog_item, charge_to_id, charge_to_type, description, sequence_number, quantity, price, cost, discount, price_method, billable_option, agreement, location_id, business_unit_id, vendor, vendor_sku, taxable_flag, dropship_flag, special_order_flag, phase_product_flag, cancelled_flag, quantity_cancelled, cancelled_reason, customer_description, internal_notes, product_supplied_flag, sub_contractor_ship_to_id, sub_contractor_amount_limit, recurring, sla, entity_type, forecast_detail_id, cancelled_by, cancelled_date, warehouse, warehouse_bin, purchase_date, integration_x_ref, list_price, serial_number_ids, company, forecast_status, _info, bypass_forecast_update, custom_fields].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



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
462
463
464
465
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 426

def list_invalid_properties
  invalid_properties = Array.new
  if @catalog_item.nil?
    invalid_properties.push("invalid value for 'catalog_item', catalog_item cannot be nil.")
  end

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

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

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

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

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

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

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

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

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



708
709
710
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 708

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



714
715
716
717
718
719
720
721
722
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 714

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



702
703
704
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 702

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



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/connectwise-ruby-sdk/models/product_item.rb', line 469

def valid?
  return false if @catalog_item.nil?
  return false if @charge_to_id.nil?
  return false if @charge_to_type.nil?
  charge_to_type_validator = EnumAttributeValidator.new('String', ["Ticket", "Project", "Invoice", "Opportunity", "SalesOrder"])
  return false unless charge_to_type_validator.valid?(@charge_to_type)
  return false if !@description.nil? && @description.to_s.length > 2000
  price_method_validator = EnumAttributeValidator.new('String', ["FlatRateForRange", "PercentMarkupFromCost", "PercentMarkdownFromPrice", "PricePerUnit"])
  return false unless price_method_validator.valid?(@price_method)
  return false if @billable_option.nil?
  billable_option_validator = EnumAttributeValidator.new('String', ["Billable", "DoNotBill", "NoCharge"])
  return false unless billable_option_validator.valid?(@billable_option)
  return false if !@vendor_sku.nil? && @vendor_sku.to_s.length > 50
  return false if !@cancelled_reason.nil? && @cancelled_reason.to_s.length > 100
  return false if !@customer_description.nil? && @customer_description.to_s.length > 6000
  return false if !@internal_notes.nil? && @internal_notes.to_s.length > 1000
  return true
end