Class: StickyIoRestfulApiV2025731::DataAddProductPrebuiltFixedPriceBundle

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

Overview

DataAddProductPrebuiltFixedPriceBundle 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:, additional_properties: nil) ⇒ DataAddProductPrebuiltFixedPriceBundle

Returns a new instance of DataAddProductPrebuiltFixedPriceBundle.



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

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:,
               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
  @additional_properties = additional_properties
end

Instance Attribute Details

#bundle_childrenArray[BundleChild]

TODO: Write general description for this method

Returns:



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

def bundle_children
  @bundle_children
end

#bundle_typeBundleType

TODO: Write general description for this method

Returns:



102
103
104
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.rb', line 42

def price
  @price
end

#price_typePriceType

TODO: Write general description for this method

Returns:



106
107
108
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.rb', line 70

def updated_at
  @updated_at
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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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_prebuilt_fixed_price_bundle.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.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 194

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 = 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 << (BundleChild.from_hash(structure) if structure)
    end
  end

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

  # 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.
  DataAddProductPrebuiltFixedPriceBundle.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,
                                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 113

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
end

.nullablesObject

An array for nullable fields



149
150
151
152
153
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 149

def self.nullables
  %w[
    tax_code
  ]
end

.optionalsObject

An array for optional fields



144
145
146
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 144

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 288

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},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/sticky_io_restful_api_v2025731/models/data_add_product_prebuilt_fixed_price_bundle.rb', line 274

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}, additional_properties: #{@additional_properties}>"
end