Class: StickyIoRestfulApiV2025731::DataUpdateProduct

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/data_update_product.rb

Overview

DataUpdateProduct Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(is_trial_product:, is_shippable:, tax_code:, is_licensed:, id:, name:, description:, sku:, price:, weight:, declared_value:, restocking_fee:, cost_of_goods:, max_quantity:, created_at:, updated_at:, custom_fields:, vertical:, category_id:, category:, is_bundle:, is_custom_bundle:, shipping_restrictions:, paired_product_ids:, is_variant_enabled:, weight_unit:, bundle_type:, price_type:, bundle_children:, attributes:, variants:, images:, additional_properties: nil) ⇒ DataUpdateProduct

Returns a new instance of DataUpdateProduct.



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
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 188

def initialize(is_trial_product:, is_shippable:, tax_code:, is_licensed:,
               id:, name:, description:, sku:, price:, weight:,
               declared_value:, restocking_fee:, cost_of_goods:,
               max_quantity:, created_at:, updated_at:, custom_fields:,
               vertical:, category_id:, category:, is_bundle:,
               is_custom_bundle:, shipping_restrictions:,
               paired_product_ids:, is_variant_enabled:, weight_unit:,
               bundle_type:, price_type:, bundle_children:, attributes:,
               variants:, images:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @is_trial_product = is_trial_product
  @is_shippable = is_shippable
  @tax_code = tax_code
  @is_licensed = is_licensed
  @id = id
  @name = name
  @description = description
  @sku = sku
  @price = price
  @weight = weight
  @declared_value = declared_value
  @restocking_fee = restocking_fee
  @cost_of_goods = cost_of_goods
  @max_quantity = max_quantity
  @created_at = created_at
  @updated_at = updated_at
  @custom_fields = custom_fields
  @vertical = vertical
  @category_id = category_id
  @category = category
  @is_bundle = is_bundle
  @is_custom_bundle = is_custom_bundle
  @shipping_restrictions = shipping_restrictions
  @paired_product_ids = paired_product_ids
  @is_variant_enabled = is_variant_enabled
  @weight_unit = weight_unit
  @bundle_type = bundle_type
  @price_type = price_type
  @bundle_children = bundle_children
  @attributes = attributes
  @variants = variants
  @images = images
  @additional_properties = additional_properties
end

Instance Attribute Details

#attributesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


130
131
132
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 130

def attributes
  @attributes
end

#bundle_childrenArray[BundleChildData]

TODO: Write general description for this method

Returns:



126
127
128
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 126

def bundle_children
  @bundle_children
end

#bundle_typeBundleType

TODO: Write general description for this method

Returns:



118
119
120
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 118

def bundle_type
  @bundle_type
end

#categoryCategory

TODO: Write general description for this method

Returns:



90
91
92
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 90

def category
  @category
end

#category_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


86
87
88
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 86

def category_id
  @category_id
end

#cost_of_goodsString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 62

def cost_of_goods
  @cost_of_goods
end

#created_atCreatedAt

TODO: Write general description for this method

Returns:



70
71
72
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 70

def created_at
  @created_at
end

#custom_fieldsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


78
79
80
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 78

def custom_fields
  @custom_fields
end

#declared_valueString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 54

def declared_value
  @declared_value
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 38

def description
  @description
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 30

def id
  @id
end

#imagesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


138
139
140
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 138

def images
  @images
end

#is_bundleInteger

TODO: Write general description for this method

Returns:

  • (Integer)


94
95
96
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 94

def is_bundle
  @is_bundle
end

#is_custom_bundleInteger

TODO: Write general description for this method

Returns:

  • (Integer)


98
99
100
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 98

def is_custom_bundle
  @is_custom_bundle
end

#is_licensedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 26

def is_licensed
  @is_licensed
end

#is_shippableInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 18

def is_shippable
  @is_shippable
end

#is_trial_productInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 14

def is_trial_product
  @is_trial_product
end

#is_variant_enabledInteger

TODO: Write general description for this method

Returns:

  • (Integer)


110
111
112
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 110

def is_variant_enabled
  @is_variant_enabled
end

#max_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


66
67
68
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 66

def max_quantity
  @max_quantity
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 34

def name
  @name
end

#paired_product_idsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


106
107
108
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 106

def paired_product_ids
  @paired_product_ids
end

#priceString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 46

def price
  @price
end

#price_typePriceType

TODO: Write general description for this method

Returns:



122
123
124
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 122

def price_type
  @price_type
end

#restocking_feeString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 58

def restocking_fee
  @restocking_fee
end

#shipping_restrictionsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


102
103
104
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 102

def shipping_restrictions
  @shipping_restrictions
end

#skuString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 42

def sku
  @sku
end

#tax_codeString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 22

def tax_code
  @tax_code
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



74
75
76
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 74

def updated_at
  @updated_at
end

#variantsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


134
135
136
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 134

def variants
  @variants
end

#verticalArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


82
83
84
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 82

def vertical
  @vertical
end

#weightInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 50

def weight
  @weight
end

#weight_unitWeightUnit

TODO: Write general description for this method

Returns:



114
115
116
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 114

def weight_unit
  @weight_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 236

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_trial_product =
    hash.key?('is_trial_product') ? hash['is_trial_product'] : nil
  is_shippable = hash.key?('is_shippable') ? hash['is_shippable'] : nil
  tax_code = hash.key?('tax_code') ? hash['tax_code'] : nil
  is_licensed = hash.key?('is_licensed') ? hash['is_licensed'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  sku = hash.key?('sku') ? hash['sku'] : nil
  price = hash.key?('price') ? hash['price'] : nil
  weight = hash.key?('weight') ? hash['weight'] : nil
  declared_value =
    hash.key?('declared_value') ? hash['declared_value'] : nil
  restocking_fee =
    hash.key?('restocking_fee') ? hash['restocking_fee'] : nil
  cost_of_goods = hash.key?('cost_of_goods') ? hash['cost_of_goods'] : nil
  max_quantity = hash.key?('max_quantity') ? hash['max_quantity'] : nil
  created_at = CreatedAt.from_hash(hash['created_at']) if hash['created_at']
  updated_at = UpdatedAtData.from_hash(hash['updated_at']) if hash['updated_at']
  custom_fields = hash.key?('custom_fields') ? hash['custom_fields'] : nil
  vertical = hash.key?('vertical') ? hash['vertical'] : nil
  category_id = hash.key?('category_id') ? hash['category_id'] : nil
  category = Category.from_hash(hash['category']) if hash['category']
  is_bundle = hash.key?('is_bundle') ? hash['is_bundle'] : nil
  is_custom_bundle =
    hash.key?('is_custom_bundle') ? hash['is_custom_bundle'] : nil
  shipping_restrictions =
    hash.key?('shipping_restrictions') ? hash['shipping_restrictions'] : nil
  paired_product_ids =
    hash.key?('paired_product_ids') ? hash['paired_product_ids'] : nil
  is_variant_enabled =
    hash.key?('is_variant_enabled') ? hash['is_variant_enabled'] : nil
  weight_unit = WeightUnit.from_hash(hash['weight_unit']) if hash['weight_unit']
  bundle_type = BundleType.from_hash(hash['bundle_type']) if hash['bundle_type']
  price_type = PriceType.from_hash(hash['price_type']) if hash['price_type']
  # Parameter is an array, so we need to iterate through it
  bundle_children = nil
  unless hash['bundle_children'].nil?
    bundle_children = []
    hash['bundle_children'].each do |structure|
      bundle_children << (BundleChildData.from_hash(structure) if structure)
    end
  end

  bundle_children = nil unless hash.key?('bundle_children')
  attributes = hash.key?('attributes') ? hash['attributes'] : nil
  variants = hash.key?('variants') ? hash['variants'] : nil
  images = hash.key?('images') ? hash['images'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DataUpdateProduct.new(is_trial_product: is_trial_product,
                        is_shippable: is_shippable,
                        tax_code: tax_code,
                        is_licensed: is_licensed,
                        id: id,
                        name: name,
                        description: description,
                        sku: sku,
                        price: price,
                        weight: weight,
                        declared_value: declared_value,
                        restocking_fee: restocking_fee,
                        cost_of_goods: cost_of_goods,
                        max_quantity: max_quantity,
                        created_at: created_at,
                        updated_at: updated_at,
                        custom_fields: custom_fields,
                        vertical: vertical,
                        category_id: category_id,
                        category: category,
                        is_bundle: is_bundle,
                        is_custom_bundle: is_custom_bundle,
                        shipping_restrictions: shipping_restrictions,
                        paired_product_ids: paired_product_ids,
                        is_variant_enabled: is_variant_enabled,
                        weight_unit: weight_unit,
                        bundle_type: bundle_type,
                        price_type: price_type,
                        bundle_children: bundle_children,
                        attributes: attributes,
                        variants: variants,
                        images: images,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 141

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_trial_product'] = 'is_trial_product'
  @_hash['is_shippable'] = 'is_shippable'
  @_hash['tax_code'] = 'tax_code'
  @_hash['is_licensed'] = 'is_licensed'
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['sku'] = 'sku'
  @_hash['price'] = 'price'
  @_hash['weight'] = 'weight'
  @_hash['declared_value'] = 'declared_value'
  @_hash['restocking_fee'] = 'restocking_fee'
  @_hash['cost_of_goods'] = 'cost_of_goods'
  @_hash['max_quantity'] = 'max_quantity'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['custom_fields'] = 'custom_fields'
  @_hash['vertical'] = 'vertical'
  @_hash['category_id'] = 'category_id'
  @_hash['category'] = 'category'
  @_hash['is_bundle'] = 'is_bundle'
  @_hash['is_custom_bundle'] = 'is_custom_bundle'
  @_hash['shipping_restrictions'] = 'shipping_restrictions'
  @_hash['paired_product_ids'] = 'paired_product_ids'
  @_hash['is_variant_enabled'] = 'is_variant_enabled'
  @_hash['weight_unit'] = 'weight_unit'
  @_hash['bundle_type'] = 'bundle_type'
  @_hash['price_type'] = 'price_type'
  @_hash['bundle_children'] = 'bundle_children'
  @_hash['attributes'] = 'attributes'
  @_hash['variants'] = 'variants'
  @_hash['images'] = 'images'
  @_hash
end

.nullablesObject

An array for nullable fields



184
185
186
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 184

def self.nullables
  []
end

.optionalsObject

An array for optional fields



179
180
181
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 179

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 350

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_trial_product: #{@is_trial_product.inspect}, is_shippable:"\
  " #{@is_shippable.inspect}, tax_code: #{@tax_code.inspect}, is_licensed:"\
  " #{@is_licensed.inspect}, id: #{@id.inspect}, name: #{@name.inspect}, description:"\
  " #{@description.inspect}, sku: #{@sku.inspect}, price: #{@price.inspect}, weight:"\
  " #{@weight.inspect}, declared_value: #{@declared_value.inspect}, restocking_fee:"\
  " #{@restocking_fee.inspect}, cost_of_goods: #{@cost_of_goods.inspect}, max_quantity:"\
  " #{@max_quantity.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, custom_fields: #{@custom_fields.inspect}, vertical:"\
  " #{@vertical.inspect}, category_id: #{@category_id.inspect}, category:"\
  " #{@category.inspect}, is_bundle: #{@is_bundle.inspect}, is_custom_bundle:"\
  " #{@is_custom_bundle.inspect}, shipping_restrictions: #{@shipping_restrictions.inspect},"\
  " paired_product_ids: #{@paired_product_ids.inspect}, is_variant_enabled:"\
  " #{@is_variant_enabled.inspect}, weight_unit: #{@weight_unit.inspect}, bundle_type:"\
  " #{@bundle_type.inspect}, price_type: #{@price_type.inspect}, bundle_children:"\
  " #{@bundle_children.inspect}, attributes: #{@attributes.inspect}, variants:"\
  " #{@variants.inspect}, images: #{@images.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/sticky_io_restful_api_v2025731/models/data_update_product.rb', line 333

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_trial_product: #{@is_trial_product}, is_shippable: #{@is_shippable},"\
  " tax_code: #{@tax_code}, is_licensed: #{@is_licensed}, id: #{@id}, name: #{@name},"\
  " description: #{@description}, sku: #{@sku}, price: #{@price}, weight: #{@weight},"\
  " declared_value: #{@declared_value}, restocking_fee: #{@restocking_fee}, cost_of_goods:"\
  " #{@cost_of_goods}, max_quantity: #{@max_quantity}, created_at: #{@created_at}, updated_at:"\
  " #{@updated_at}, custom_fields: #{@custom_fields}, vertical: #{@vertical}, category_id:"\
  " #{@category_id}, category: #{@category}, is_bundle: #{@is_bundle}, is_custom_bundle:"\
  " #{@is_custom_bundle}, shipping_restrictions: #{@shipping_restrictions},"\
  " paired_product_ids: #{@paired_product_ids}, is_variant_enabled: #{@is_variant_enabled},"\
  " weight_unit: #{@weight_unit}, bundle_type: #{@bundle_type}, price_type: #{@price_type},"\
  " bundle_children: #{@bundle_children}, attributes: #{@attributes}, variants: #{@variants},"\
  " images: #{@images}, additional_properties: #{@additional_properties}>"
end