Class: StickyIoRestfulApiV2025731::DataAddProductWithAttributesAutocreateVariants

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

Overview

DataAddProductWithAttributesAutocreateVariants 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_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:, is_bundle:, is_custom_bundle:, shipping_restrictions:, weight_unit:, bundle_type:, price_type:, bundle_children:, attributes:, variants:, additional_properties: nil) ⇒ DataAddProductWithAttributesAutocreateVariants

Returns a new instance of DataAddProductWithAttributesAutocreateVariants.



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

def initialize(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:,
               is_bundle:, is_custom_bundle:, shipping_restrictions:,
               weight_unit:, bundle_type:, price_type:, bundle_children:,
               attributes:, variants:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @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
  @is_bundle = is_bundle
  @is_custom_bundle = is_custom_bundle
  @shipping_restrictions = shipping_restrictions
  @weight_unit = weight_unit
  @bundle_type = bundle_type
  @price_type = price_type
  @bundle_children = bundle_children
  @attributes = attributes
  @variants = variants
  @additional_properties = additional_properties
end

Instance Attribute Details

#attributesArray[AttributeData2]

TODO: Write general description for this method

Returns:



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

def attributes
  @attributes
end

#bundle_childrenArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def bundle_children
  @bundle_children
end

#bundle_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def bundle_type
  @bundle_type
end

#category_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def category_id
  @category_id
end

#cost_of_goodsString

TODO: Write general description for this method

Returns:

  • (String)


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

def cost_of_goods
  @cost_of_goods
end

#created_atCreatedAt

TODO: Write general description for this method

Returns:



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

def created_at
  @created_at
end

#custom_fieldsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def custom_fields
  @custom_fields
end

#declared_valueString

TODO: Write general description for this method

Returns:

  • (String)


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

def declared_value
  @declared_value
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#is_bundleInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_bundle
  @is_bundle
end

#is_custom_bundleInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_custom_bundle
  @is_custom_bundle
end

#is_licensedInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_licensed
  @is_licensed
end

#is_shippableInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def is_shippable
  @is_shippable
end

#max_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def max_quantity
  @max_quantity
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#priceString

TODO: Write general description for this method

Returns:

  • (String)


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

def price
  @price
end

#price_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def price_type
  @price_type
end

#restocking_feeString

TODO: Write general description for this method

Returns:

  • (String)


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

def restocking_fee
  @restocking_fee
end

#shipping_restrictionsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def shipping_restrictions
  @shipping_restrictions
end

#skuString

TODO: Write general description for this method

Returns:

  • (String)


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

def sku
  @sku
end

#tax_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def tax_code
  @tax_code
end

#updated_atUpdatedAtData

TODO: Write general description for this method

Returns:



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

def updated_at
  @updated_at
end

#variantsArray[VariantData]

TODO: Write general description for this method

Returns:



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

def variants
  @variants
end

#verticalArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def vertical
  @vertical
end

#weightInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def weight
  @weight
end

#weight_unitWeightUnit

TODO: Write general description for this method

Returns:



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

def weight_unit
  @weight_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_with_attributes_autocreate_variants.rb', line 208

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  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
  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
  weight_unit = WeightUnit.from_hash(hash['weight_unit']) if hash['weight_unit']
  bundle_type = hash.key?('bundle_type') ? hash['bundle_type'] : nil
  price_type = hash.key?('price_type') ? hash['price_type'] : nil
  bundle_children =
    hash.key?('bundle_children') ? hash['bundle_children'] : nil
  # Parameter is an array, so we need to iterate through it
  attributes = nil
  unless hash['attributes'].nil?
    attributes = []
    hash['attributes'].each do |structure|
      attributes << (AttributeData2.from_hash(structure) if structure)
    end
  end

  attributes = nil unless hash.key?('attributes')
  # Parameter is an array, so we need to iterate through it
  variants = nil
  unless hash['variants'].nil?
    variants = []
    hash['variants'].each do |structure|
      variants << (VariantData.from_hash(structure) if structure)
    end
  end

  variants = nil unless hash.key?('variants')

  # 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.
  DataAddProductWithAttributesAutocreateVariants.new(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,
                                                     is_bundle: is_bundle,
                                                     is_custom_bundle: is_custom_bundle,
                                                     shipping_restrictions: shipping_restrictions,
                                                     weight_unit: weight_unit,
                                                     bundle_type: bundle_type,
                                                     price_type: price_type,
                                                     bundle_children: bundle_children,
                                                     attributes: attributes,
                                                     variants: variants,
                                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_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['is_bundle'] = 'is_bundle'
  @_hash['is_custom_bundle'] = 'is_custom_bundle'
  @_hash['shipping_restrictions'] = 'shipping_restrictions'
  @_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
end

.nullablesObject

An array for nullable fields



159
160
161
162
163
164
165
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_with_attributes_autocreate_variants.rb', line 159

def self.nullables
  %w[
    tax_code
    bundle_type
    price_type
  ]
end

.optionalsObject

An array for optional fields



154
155
156
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_with_attributes_autocreate_variants.rb', line 154

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_with_attributes_autocreate_variants.rb', line 317

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}, is_bundle:"\
  " #{@is_bundle.inspect}, is_custom_bundle: #{@is_custom_bundle.inspect},"\
  " shipping_restrictions: #{@shipping_restrictions.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}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_with_attributes_autocreate_variants.rb', line 302

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}, is_bundle: #{@is_bundle},"\
  " is_custom_bundle: #{@is_custom_bundle}, shipping_restrictions: #{@shipping_restrictions},"\
  " weight_unit: #{@weight_unit}, bundle_type: #{@bundle_type}, price_type: #{@price_type},"\
  " bundle_children: #{@bundle_children}, attributes: #{@attributes}, variants: #{@variants},"\
  " additional_properties: #{@additional_properties}>"
end