Class: ConnectWise::ProductItem

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

Raises:

  • (ArgumentError)


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

def _info
  @_info
end

#add_components_flagObject

Returns the value of attribute add_components_flag.



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

def add_components_flag
  @add_components_flag
end

#agreementObject

Returns the value of attribute agreement.



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

def agreement
  @agreement
end

#agreement_amountObject

Returns the value of attribute agreement_amount.



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

def agreement_amount
  @agreement_amount
end

#billable_optionObject

Returns the value of attribute billable_option.



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

def billable_option
  @billable_option
end

#business_unit_idObject

Required On Updates;



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

def business_unit_id
  @business_unit_id
end

#bypass_forecast_updateObject

Returns the value of attribute bypass_forecast_update.



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

def bypass_forecast_update
  @bypass_forecast_update
end

#calculated_costObject

Returns the value of attribute calculated_cost.



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

def calculated_cost
  @calculated_cost
end

#calculated_cost_flagObject

Returns the value of attribute calculated_cost_flag.



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

def calculated_cost_flag
  @calculated_cost_flag
end

#calculated_priceObject

Returns the value of attribute calculated_price.



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

def calculated_price
  @calculated_price
end

#calculated_price_flagObject

Returns the value of attribute calculated_price_flag.



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

def calculated_price_flag
  @calculated_price_flag
end

#cancelled_byObject

Returns the value of attribute cancelled_by.



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

def cancelled_by
  @cancelled_by
end

#cancelled_dateObject

Returns the value of attribute cancelled_date.



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

def cancelled_date
  @cancelled_date
end

#cancelled_flagObject

Returns the value of attribute cancelled_flag.



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

def cancelled_flag
  @cancelled_flag
end

#cancelled_reasonObject

Max length: 100;



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

def cancelled_reason
  @cancelled_reason
end

#catalog_itemObject

Returns the value of attribute catalog_item.



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

def catalog_item
  @catalog_item
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#costObject

Returns the value of attribute cost.



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

def cost
  @cost
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#customer_descriptionObject

Max length: 6000; Required On Updates;



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

def customer_description
  @customer_description
end

#descriptionObject

Max length: 2000;



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

def description
  @description
end

#discountObject

Returns the value of attribute discount.



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

def discount
  @discount
end

#dropship_flagObject

Returns the value of attribute dropship_flag.



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

def dropship_flag
  @dropship_flag
end

#entity_typeObject

Returns the value of attribute entity_type.



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

def entity_type
  @entity_type
end

#forecast_detail_idObject

Returns the value of attribute forecast_detail_id.



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

def forecast_detail_id
  @forecast_detail_id
end

#forecast_statusObject

Returns the value of attribute forecast_status.



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

def forecast_status
  @forecast_status
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#ignore_pricing_schedules_flagObject

Returns the value of attribute ignore_pricing_schedules_flag.



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

def ignore_pricing_schedules_flag
  @ignore_pricing_schedules_flag
end

#integration_x_refObject

Returns the value of attribute integration_x_ref.



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

def integration_x_ref
  @integration_x_ref
end

#internal_notesObject

Max length: 1000;



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

def internal_notes
  @internal_notes
end

#invoiceObject

Returns the value of attribute invoice.



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

def invoice
  @invoice
end

#invoice_groupingObject

Returns the value of attribute invoice_grouping.



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

def invoice_grouping
  @invoice_grouping
end

#list_priceObject

Returns the value of attribute list_price.



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

def list_price
  @list_price
end

#location_idObject

Required On Updates;



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

def location_id
  @location_id
end

#minimum_stock_flagObject

Returns the value of attribute minimum_stock_flag.



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

def minimum_stock_flag
  @minimum_stock_flag
end

#need_to_order_quantityObject

Returns the value of attribute need_to_order_quantity.



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

def need_to_order_quantity
  @need_to_order_quantity
end

#need_to_purchase_flagObject

Returns the value of attribute need_to_purchase_flag.



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

def need_to_purchase_flag
  @need_to_purchase_flag
end

#opportunityObject

Returns the value of attribute opportunity.



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

def opportunity
  @opportunity
end

#phaseObject

Returns the value of attribute phase.



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

def phase
  @phase
end

#phase_product_flagObject

Returns the value of attribute phase_product_flag.



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

def phase_product_flag
  @phase_product_flag
end

#po_approved_flagObject

Returns the value of attribute po_approved_flag.



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

def po_approved_flag
  @po_approved_flag
end

#priceObject

Returns the value of attribute price.



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

def price
  @price
end

#price_methodObject

Returns the value of attribute price_method.



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

def price_method
  @price_method
end

#product_classObject

Returns the value of attribute product_class.



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

def product_class
  @product_class
end

#product_supplied_flagObject

Returns the value of attribute product_supplied_flag.



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

def product_supplied_flag
  @product_supplied_flag
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#purchase_dateObject

Returns the value of attribute purchase_date.



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

def purchase_date
  @purchase_date
end

#quantityObject

Returns the value of attribute quantity.



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

def quantity
  @quantity
end

#quantity_cancelledObject

Returns the value of attribute quantity_cancelled.



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

def quantity_cancelled
  @quantity_cancelled
end

#recurringObject

Returns the value of attribute recurring.



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

def recurring
  @recurring
end

#sales_orderObject

Returns the value of attribute sales_order.



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

def sales_order
  @sales_order
end

#sequence_numberObject

Returns the value of attribute sequence_number.



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

def sequence_number
  @sequence_number
end

#serial_number_idsObject

Returns the value of attribute serial_number_ids.



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

def serial_number_ids
  @serial_number_ids
end

#ship_setObject

Max length: 10;



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

def ship_set
  @ship_set
end

#slaObject

Returns the value of attribute sla.



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

def sla
  @sla
end

#special_order_flagObject

Returns the value of attribute special_order_flag.



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

def special_order_flag
  @special_order_flag
end

#sub_contractor_amount_limitObject

Returns the value of attribute sub_contractor_amount_limit.



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

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.



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

def sub_contractor_ship_to_id
  @sub_contractor_ship_to_id
end

#taxable_flagObject

Returns the value of attribute taxable_flag.



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

def taxable_flag
  @taxable_flag
end

#ticketObject

Returns the value of attribute ticket.



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

def ticket
  @ticket
end

#vendorObject

Returns the value of attribute vendor.



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

def vendor
  @vendor
end

#vendor_skuObject

Max length: 50;



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

def vendor_sku
  @vendor_sku
end

#warehouseObject

Returns the value of attribute warehouse.



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

def warehouse
  @warehouse
end

#warehouse_binObject

Returns the value of attribute warehouse_bin.



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

def warehouse_bin
  @warehouse_bin
end

#warehouse_bin_idObject

Returns the value of attribute warehouse_bin_id.



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

def warehouse_bin_id
  @warehouse_bin_id
end

#warehouse_idObject

Returns the value of attribute warehouse_id.



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

def warehouse_id
  @warehouse_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



136
137
138
# File 'lib/connect_wise/models/product_item.rb', line 136

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/connect_wise/models/product_item.rb', line 64

def self.attribute_map
  {
    billable_option: :billableOption,
    id: :id,
    catalog_item: :catalogItem,
    description: :description,
    sequence_number: :sequenceNumber,
    quantity: :quantity,
    price: :price,
    cost: :cost,
    discount: :discount,
    agreement_amount: :agreementAmount,
    price_method: :priceMethod,
    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,
    ticket: :ticket,
    project: :project,
    phase: :phase,
    sales_order: :salesOrder,
    opportunity: :opportunity,
    invoice: :invoice,
    warehouse_id: :warehouseId,
    warehouse_bin_id: :warehouseBinId,
    calculated_price_flag: :calculatedPriceFlag,
    calculated_cost_flag: :calculatedCostFlag,
    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,
    product_class: :productClass,
    need_to_purchase_flag: :needToPurchaseFlag,
    need_to_order_quantity: :needToOrderQuantity,
    minimum_stock_flag: :minimumStockFlag,
    ship_set: :shipSet,
    calculated_price: :calculatedPrice,
    calculated_cost: :calculatedCost,
    invoice_grouping: :invoiceGrouping,
    po_approved_flag: :poApprovedFlag,
    add_components_flag: :addComponentsFlag,
    ignore_pricing_schedules_flag: :ignorePricingSchedulesFlag,
    _info: :_info,
    bypass_forecast_update: :bypassForecastUpdate,
    custom_fields: :customFields
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



543
544
545
# File 'lib/connect_wise/models/product_item.rb', line 543

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

.openapi_nullableObject

List of attributes with nullable: true



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

def self.openapi_nullable
  Set.new(%i[
            billable_option
            sequence_number
            quantity
            price
            cost
            discount
            agreement_amount
            price_method
            location_id
            business_unit_id
            taxable_flag
            dropship_flag
            special_order_flag
            phase_product_flag
            cancelled_flag
            quantity_cancelled
            product_supplied_flag
            sub_contractor_ship_to_id
            sub_contractor_amount_limit
            warehouse_id
            warehouse_bin_id
            calculated_price_flag
            calculated_cost_flag
            forecast_detail_id
            cancelled_by
            list_price
            product_class
            need_to_purchase_flag
            need_to_order_quantity
            minimum_stock_flag
            calculated_price
            calculated_cost
            po_approved_flag
            add_components_flag
            ignore_pricing_schedules_flag
            bypass_forecast_update
          ])
end

.openapi_typesObject

Attribute type mapping.



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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/connect_wise/models/product_item.rb', line 141

def self.openapi_types
  {
    billable_option: :String,
    id: :Integer,
    catalog_item: :CatalogItemReference,
    description: :String,
    sequence_number: :Float,
    quantity: :Float,
    price: :Float,
    cost: :Float,
    discount: :Float,
    agreement_amount: :Float,
    price_method: :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,
    ticket: :TicketReference,
    project: :ProjectReference,
    phase: :ProjectPhaseReference,
    sales_order: :SalesOrderReference,
    opportunity: :OpportunityReference,
    invoice: :InvoiceReference,
    warehouse_id: :Integer,
    warehouse_bin_id: :Integer,
    calculated_price_flag: :Boolean,
    calculated_cost_flag: :Boolean,
    forecast_detail_id: :Integer,
    cancelled_by: :Integer,
    cancelled_date: :Time,
    warehouse: :String,
    warehouse_bin: :String,
    purchase_date: :Time,
    integration_x_ref: :String,
    list_price: :Float,
    serial_number_ids: :'Array<Integer>',
    company: :CompanyReference,
    forecast_status: :OpportunityStatusReference,
    product_class: :String,
    need_to_purchase_flag: :Boolean,
    need_to_order_quantity: :Integer,
    minimum_stock_flag: :Boolean,
    ship_set: :String,
    calculated_price: :Float,
    calculated_cost: :Float,
    invoice_grouping: :InvoiceGroupingReference,
    po_approved_flag: :Boolean,
    add_components_flag: :Boolean,
    ignore_pricing_schedules_flag: :Boolean,
    _info: :'Hash<String, String>',
    bypass_forecast_update: :Boolean,
    custom_fields: :'Array<CustomFieldValue>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/connect_wise/models/product_item.rb', line 456

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

  self.class == other.class &&
    billable_option == other.billable_option &&
    id == other.id &&
    catalog_item == other.catalog_item &&
    description == other.description &&
    sequence_number == other.sequence_number &&
    quantity == other.quantity &&
    price == other.price &&
    cost == other.cost &&
    discount == other.discount &&
    agreement_amount == other.agreement_amount &&
    price_method == other.price_method &&
    agreement == other.agreement &&
    location_id == other.location_id &&
    business_unit_id == other.business_unit_id &&
    vendor == other.vendor &&
    vendor_sku == other.vendor_sku &&
    taxable_flag == other.taxable_flag &&
    dropship_flag == other.dropship_flag &&
    special_order_flag == other.special_order_flag &&
    phase_product_flag == other.phase_product_flag &&
    cancelled_flag == other.cancelled_flag &&
    quantity_cancelled == other.quantity_cancelled &&
    cancelled_reason == other.cancelled_reason &&
    customer_description == other.customer_description &&
    internal_notes == other.internal_notes &&
    product_supplied_flag == other.product_supplied_flag &&
    sub_contractor_ship_to_id == other.sub_contractor_ship_to_id &&
    sub_contractor_amount_limit == other.sub_contractor_amount_limit &&
    recurring == other.recurring &&
    sla == other.sla &&
    entity_type == other.entity_type &&
    ticket == other.ticket &&
    project == other.project &&
    phase == other.phase &&
    sales_order == other.sales_order &&
    opportunity == other.opportunity &&
    invoice == other.invoice &&
    warehouse_id == other.warehouse_id &&
    warehouse_bin_id == other.warehouse_bin_id &&
    calculated_price_flag == other.calculated_price_flag &&
    calculated_cost_flag == other.calculated_cost_flag &&
    forecast_detail_id == other.forecast_detail_id &&
    cancelled_by == other.cancelled_by &&
    cancelled_date == other.cancelled_date &&
    warehouse == other.warehouse &&
    warehouse_bin == other.warehouse_bin &&
    purchase_date == other.purchase_date &&
    integration_x_ref == other.integration_x_ref &&
    list_price == other.list_price &&
    serial_number_ids == other.serial_number_ids &&
    company == other.company &&
    forecast_status == other.forecast_status &&
    product_class == other.product_class &&
    need_to_purchase_flag == other.need_to_purchase_flag &&
    need_to_order_quantity == other.need_to_order_quantity &&
    minimum_stock_flag == other.minimum_stock_flag &&
    ship_set == other.ship_set &&
    calculated_price == other.calculated_price &&
    calculated_cost == other.calculated_cost &&
    invoice_grouping == other.invoice_grouping &&
    po_approved_flag == other.po_approved_flag &&
    add_components_flag == other.add_components_flag &&
    ignore_pricing_schedules_flag == other.ignore_pricing_schedules_flag &&
    _info == other._info &&
    bypass_forecast_update == other.bypass_forecast_update &&
    custom_fields == other.custom_fields
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



573
574
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
# File 'lib/connect_wise/models/product_item.rb', line 573

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



644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/connect_wise/models/product_item.rb', line 644

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



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/connect_wise/models/product_item.rb', line 550

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

See Also:

  • `==` method


530
531
532
# File 'lib/connect_wise/models/product_item.rb', line 530

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.



536
537
538
# File 'lib/connect_wise/models/product_item.rb', line 536

def hash
  [billable_option, id, catalog_item, description, sequence_number, quantity, price, cost, discount, agreement_amount, price_method, 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, ticket, project, phase, sales_order, opportunity, invoice, warehouse_id, warehouse_bin_id, calculated_price_flag, calculated_cost_flag, forecast_detail_id, cancelled_by, cancelled_date, warehouse, warehouse_bin, purchase_date, integration_x_ref, list_price, serial_number_ids, company, forecast_status, product_class, need_to_purchase_flag, need_to_order_quantity, minimum_stock_flag, ship_set, calculated_price, calculated_cost, invoice_grouping, po_approved_flag, add_components_flag, ignore_pricing_schedules_flag, _info, bypass_forecast_update, custom_fields].hash
end

#list_invalid_propertiesObject

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



408
409
410
# File 'lib/connect_wise/models/product_item.rb', line 408

def list_invalid_properties
  []
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



620
621
622
# File 'lib/connect_wise/models/product_item.rb', line 620

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/connect_wise/models/product_item.rb', line 626

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



614
615
616
# File 'lib/connect_wise/models/product_item.rb', line 614

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/connect_wise/models/product_item.rb', line 414

def valid?
  billable_option_validator = EnumAttributeValidator.new('String', %w[Billable DoNotBill NoCharge])
  return false unless billable_option_validator.valid?(@billable_option)

  price_method_validator = EnumAttributeValidator.new('String', %w[FlatRateForRange PercentMarkupFromCost PercentMarkdownFromPrice PricePerUnit])
  return false unless price_method_validator.valid?(@price_method)

  product_class_validator = EnumAttributeValidator.new('String', %w[Agreement Bundle Inventory NonInventory Service])
  return false unless product_class_validator.valid?(@product_class)

  true
end