Class: KoronaCloudClient::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/korona-cloud-client/models/product.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Product

Initializes the object

Parameters:

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

    Model attributes in the form of hash



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/korona-cloud-client/models/product.rb', line 258

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaCloudClient::Product` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaCloudClient::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'active')
    self.active = attributes[:'active']
  end

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

  if attributes.key?(:'revision')
    self.revision = attributes[:'revision']
  end

  if attributes.key?(:'number')
    self.number = attributes[:'number']
  end

  if attributes.key?(:'alternative_sector')
    self.alternative_sector = attributes[:'alternative_sector']
  end

  if attributes.key?(:'assortment')
    self.assortment = attributes[:'assortment']
  end

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

  if attributes.key?(:'commodity_group')
    self.commodity_group = attributes[:'commodity_group']
  end

  if attributes.key?(:'conversion')
    self.conversion = attributes[:'conversion']
  end

  if attributes.key?(:'costs')
    self.costs = attributes[:'costs']
  end

  if attributes.key?(:'deactivated')
    self.deactivated = attributes[:'deactivated']
  end

  if attributes.key?(:'deposit')
    self.deposit = attributes[:'deposit']
  end

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

  if attributes.key?(:'discountable')
    self.discountable = attributes[:'discountable']
  end

  if attributes.key?(:'image')
    self.image = attributes[:'image']
  end

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

  if attributes.key?(:'item_sequence')
    self.item_sequence = attributes[:'item_sequence']
  end

  if attributes.key?(:'last_purchase_price')
    self.last_purchase_price = attributes[:'last_purchase_price']
  end

  if attributes.key?(:'listed')
    self.listed = attributes[:'listed']
  end

  if attributes.key?(:'listed_since')
    self.listed_since = attributes[:'listed_since']
  end

  if attributes.key?(:'max_price')
    self.max_price = attributes[:'max_price']
  end

  if attributes.key?(:'min_price')
    self.min_price = attributes[:'min_price']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'packaging_quantity')
    self.packaging_quantity = attributes[:'packaging_quantity']
  end

  if attributes.key?(:'packaging_required')
    self.packaging_required = attributes[:'packaging_required']
  end

  if attributes.key?(:'packaging_unit')
    self.packaging_unit = attributes[:'packaging_unit']
  end

  if attributes.key?(:'personalization_required')
    self.personalization_required = attributes[:'personalization_required']
  end

  if attributes.key?(:'price_changable')
    self.price_changable = attributes[:'price_changable']
  end

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

  if attributes.key?(:'print_tickets_separately')
    self.print_tickets_separately = attributes[:'print_tickets_separately']
  end

  if attributes.key?(:'production_type')
    self.production_type = attributes[:'production_type']
  end

  if attributes.key?(:'recommended_retail_price')
    self.recommended_retail_price = attributes[:'recommended_retail_price']
  end

  if attributes.key?(:'related_products')
    self.related_products = attributes[:'related_products']
  end

  if attributes.key?(:'sector')
    self.sector = attributes[:'sector']
  end

  if attributes.key?(:'serial_number_required')
    self.serial_number_required = attributes[:'serial_number_required']
  end

  if attributes.key?(:'subproduct_presentation')
    self.subproduct_presentation = attributes[:'subproduct_presentation']
  end

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

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

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

  if attributes.key?(:'ticket_definition')
    self.ticket_definition = attributes[:'ticket_definition']
  end

  if attributes.key?(:'track_inventory')
    self.track_inventory = attributes[:'track_inventory']
  end

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

  if attributes.key?(:'quantity_denomination')
    self.quantity_denomination = attributes[:'quantity_denomination']
  end

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

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

  if attributes.key?(:'sales_lock')
    self.sales_lock = attributes[:'sales_lock']
  end

  if attributes.key?(:'stock_return_unsellable')
    self.stock_return_unsellable = attributes[:'stock_return_unsellable']
  end
end

Instance Attribute Details

#activeObject

indicates whether the object is active for use or not



19
20
21
# File 'lib/korona-cloud-client/models/product.rb', line 19

def active
  @active
end

#alternative_sectorObject

Returns the value of attribute alternative_sector.



30
31
32
# File 'lib/korona-cloud-client/models/product.rb', line 30

def alternative_sector
  @alternative_sector
end

#assortmentObject

Returns the value of attribute assortment.



32
33
34
# File 'lib/korona-cloud-client/models/product.rb', line 32

def assortment
  @assortment
end

#codesObject

Returns the value of attribute codes.



34
35
36
# File 'lib/korona-cloud-client/models/product.rb', line 34

def codes
  @codes
end

#commodity_groupObject

Returns the value of attribute commodity_group.



36
37
38
# File 'lib/korona-cloud-client/models/product.rb', line 36

def commodity_group
  @commodity_group
end

#conversionObject

Returns the value of attribute conversion.



38
39
40
# File 'lib/korona-cloud-client/models/product.rb', line 38

def conversion
  @conversion
end

#costsObject

Returns the value of attribute costs.



40
41
42
# File 'lib/korona-cloud-client/models/product.rb', line 40

def costs
  @costs
end

#deactivatedObject

Returns the value of attribute deactivated.



42
43
44
# File 'lib/korona-cloud-client/models/product.rb', line 42

def deactivated
  @deactivated
end

#depositObject

Returns the value of attribute deposit.



44
45
46
# File 'lib/korona-cloud-client/models/product.rb', line 44

def deposit
  @deposit
end

#descriptionsObject

Returns the value of attribute descriptions.



46
47
48
# File 'lib/korona-cloud-client/models/product.rb', line 46

def descriptions
  @descriptions
end

#discountableObject

Returns the value of attribute discountable.



48
49
50
# File 'lib/korona-cloud-client/models/product.rb', line 48

def discountable
  @discountable
end

#idObject

global object uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)



22
23
24
# File 'lib/korona-cloud-client/models/product.rb', line 22

def id
  @id
end

#imageObject

Returns the value of attribute image.



50
51
52
# File 'lib/korona-cloud-client/models/product.rb', line 50

def image
  @image
end

#info_textsObject

Returns the value of attribute info_texts.



52
53
54
# File 'lib/korona-cloud-client/models/product.rb', line 52

def info_texts
  @info_texts
end

#item_sequenceObject

Returns the value of attribute item_sequence.



54
55
56
# File 'lib/korona-cloud-client/models/product.rb', line 54

def item_sequence
  @item_sequence
end

#last_purchase_priceObject

Returns the value of attribute last_purchase_price.



56
57
58
# File 'lib/korona-cloud-client/models/product.rb', line 56

def last_purchase_price
  @last_purchase_price
end

#listedObject

Returns the value of attribute listed.



58
59
60
# File 'lib/korona-cloud-client/models/product.rb', line 58

def listed
  @listed
end

#listed_sinceObject

Format: yyyy-MM-dd’T’HH:mm:ssXXX



61
62
63
# File 'lib/korona-cloud-client/models/product.rb', line 61

def listed_since
  @listed_since
end

#max_priceObject

Returns the value of attribute max_price.



63
64
65
# File 'lib/korona-cloud-client/models/product.rb', line 63

def max_price
  @max_price
end

#media_urlsObject

Returns the value of attribute media_urls.



105
106
107
# File 'lib/korona-cloud-client/models/product.rb', line 105

def media_urls
  @media_urls
end

#min_priceObject

Returns the value of attribute min_price.



65
66
67
# File 'lib/korona-cloud-client/models/product.rb', line 65

def min_price
  @min_price
end

#nameObject

Returns the value of attribute name.



67
68
69
# File 'lib/korona-cloud-client/models/product.rb', line 67

def name
  @name
end

#numberObject

number of the object, like it is set in backoffice; will be removed when active=false



28
29
30
# File 'lib/korona-cloud-client/models/product.rb', line 28

def number
  @number
end

#packaging_quantityObject

Returns the value of attribute packaging_quantity.



69
70
71
# File 'lib/korona-cloud-client/models/product.rb', line 69

def packaging_quantity
  @packaging_quantity
end

#packaging_requiredObject

Returns the value of attribute packaging_required.



71
72
73
# File 'lib/korona-cloud-client/models/product.rb', line 71

def packaging_required
  @packaging_required
end

#packaging_unitObject

Returns the value of attribute packaging_unit.



73
74
75
# File 'lib/korona-cloud-client/models/product.rb', line 73

def packaging_unit
  @packaging_unit
end

#personalization_requiredObject

Returns the value of attribute personalization_required.



75
76
77
# File 'lib/korona-cloud-client/models/product.rb', line 75

def personalization_required
  @personalization_required
end

#price_changableObject

Returns the value of attribute price_changable.



77
78
79
# File 'lib/korona-cloud-client/models/product.rb', line 77

def price_changable
  @price_changable
end

#pricesObject

Returns the value of attribute prices.



79
80
81
# File 'lib/korona-cloud-client/models/product.rb', line 79

def prices
  @prices
end

Returns the value of attribute print_tickets_separately.



81
82
83
# File 'lib/korona-cloud-client/models/product.rb', line 81

def print_tickets_separately
  @print_tickets_separately
end

#production_typeObject

Returns the value of attribute production_type.



83
84
85
# File 'lib/korona-cloud-client/models/product.rb', line 83

def production_type
  @production_type
end

#quantity_denominationObject

Returns the value of attribute quantity_denomination.



107
108
109
# File 'lib/korona-cloud-client/models/product.rb', line 107

def quantity_denomination
  @quantity_denomination
end

Returns the value of attribute recommended_retail_price.



85
86
87
# File 'lib/korona-cloud-client/models/product.rb', line 85

def recommended_retail_price
  @recommended_retail_price
end

Returns the value of attribute related_products.



87
88
89
# File 'lib/korona-cloud-client/models/product.rb', line 87

def related_products
  @related_products
end

#revisionObject

the revision number of the object. revision numbers are unique per object-type. there is is no object of the same type with identical revision numbers.



25
26
27
# File 'lib/korona-cloud-client/models/product.rb', line 25

def revision
  @revision
end

#sales_lockObject

Returns the value of attribute sales_lock.



113
114
115
# File 'lib/korona-cloud-client/models/product.rb', line 113

def sales_lock
  @sales_lock
end

#sectorObject

Returns the value of attribute sector.



89
90
91
# File 'lib/korona-cloud-client/models/product.rb', line 89

def sector
  @sector
end

#serial_number_requiredObject

Returns the value of attribute serial_number_required.



91
92
93
# File 'lib/korona-cloud-client/models/product.rb', line 91

def serial_number_required
  @serial_number_required
end

#special_pricesObject

Returns the value of attribute special_prices.



109
110
111
# File 'lib/korona-cloud-client/models/product.rb', line 109

def special_prices
  @special_prices
end

#stock_return_unsellableObject

Returns the value of attribute stock_return_unsellable.



115
116
117
# File 'lib/korona-cloud-client/models/product.rb', line 115

def stock_return_unsellable
  @stock_return_unsellable
end

#subproduct_presentationObject

Returns the value of attribute subproduct_presentation.



93
94
95
# File 'lib/korona-cloud-client/models/product.rb', line 93

def subproduct_presentation
  @subproduct_presentation
end

#subproductsObject

Returns the value of attribute subproducts.



95
96
97
# File 'lib/korona-cloud-client/models/product.rb', line 95

def subproducts
  @subproducts
end

#supplier_pricesObject

Returns the value of attribute supplier_prices.



97
98
99
# File 'lib/korona-cloud-client/models/product.rb', line 97

def supplier_prices
  @supplier_prices
end

#tagsObject

Returns the value of attribute tags.



99
100
101
# File 'lib/korona-cloud-client/models/product.rb', line 99

def tags
  @tags
end

#ticket_definitionObject

Returns the value of attribute ticket_definition.



101
102
103
# File 'lib/korona-cloud-client/models/product.rb', line 101

def ticket_definition
  @ticket_definition
end

#track_inventoryObject

Returns the value of attribute track_inventory.



103
104
105
# File 'lib/korona-cloud-client/models/product.rb', line 103

def track_inventory
  @track_inventory
end

#verification_requirementsObject

Returns the value of attribute verification_requirements.



111
112
113
# File 'lib/korona-cloud-client/models/product.rb', line 111

def verification_requirements
  @verification_requirements
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



193
194
195
# File 'lib/korona-cloud-client/models/product.rb', line 193

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/korona-cloud-client/models/product.rb', line 140

def self.attribute_map
  {
    :'active' => :'active',
    :'id' => :'id',
    :'revision' => :'revision',
    :'number' => :'number',
    :'alternative_sector' => :'alternativeSector',
    :'assortment' => :'assortment',
    :'codes' => :'codes',
    :'commodity_group' => :'commodityGroup',
    :'conversion' => :'conversion',
    :'costs' => :'costs',
    :'deactivated' => :'deactivated',
    :'deposit' => :'deposit',
    :'descriptions' => :'descriptions',
    :'discountable' => :'discountable',
    :'image' => :'image',
    :'info_texts' => :'infoTexts',
    :'item_sequence' => :'itemSequence',
    :'last_purchase_price' => :'lastPurchasePrice',
    :'listed' => :'listed',
    :'listed_since' => :'listedSince',
    :'max_price' => :'maxPrice',
    :'min_price' => :'minPrice',
    :'name' => :'name',
    :'packaging_quantity' => :'packagingQuantity',
    :'packaging_required' => :'packagingRequired',
    :'packaging_unit' => :'packagingUnit',
    :'personalization_required' => :'personalizationRequired',
    :'price_changable' => :'priceChangable',
    :'prices' => :'prices',
    :'print_tickets_separately' => :'printTicketsSeparately',
    :'production_type' => :'productionType',
    :'recommended_retail_price' => :'recommendedRetailPrice',
    :'related_products' => :'relatedProducts',
    :'sector' => :'sector',
    :'serial_number_required' => :'serialNumberRequired',
    :'subproduct_presentation' => :'subproductPresentation',
    :'subproducts' => :'subproducts',
    :'supplier_prices' => :'supplierPrices',
    :'tags' => :'tags',
    :'ticket_definition' => :'ticketDefinition',
    :'track_inventory' => :'trackInventory',
    :'media_urls' => :'mediaUrls',
    :'quantity_denomination' => :'quantityDenomination',
    :'special_prices' => :'specialPrices',
    :'verification_requirements' => :'verificationRequirements',
    :'sales_lock' => :'salesLock',
    :'stock_return_unsellable' => :'stockReturnUnsellable'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



592
593
594
# File 'lib/korona-cloud-client/models/product.rb', line 592

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

.openapi_nullableObject

List of attributes with nullable: true



251
252
253
254
# File 'lib/korona-cloud-client/models/product.rb', line 251

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/korona-cloud-client/models/product.rb', line 198

def self.openapi_types
  {
    :'active' => :'Boolean',
    :'id' => :'String',
    :'revision' => :'Integer',
    :'number' => :'String',
    :'alternative_sector' => :'ModelReference',
    :'assortment' => :'ModelReference',
    :'codes' => :'Array<ProductCode>',
    :'commodity_group' => :'ModelReference',
    :'conversion' => :'Boolean',
    :'costs' => :'Float',
    :'deactivated' => :'Boolean',
    :'deposit' => :'Boolean',
    :'descriptions' => :'Array<ProductDescription>',
    :'discountable' => :'Boolean',
    :'image' => :'ModelReference',
    :'info_texts' => :'Array<ModelReference>',
    :'item_sequence' => :'ModelReference',
    :'last_purchase_price' => :'Float',
    :'listed' => :'Boolean',
    :'listed_since' => :'Time',
    :'max_price' => :'Float',
    :'min_price' => :'Float',
    :'name' => :'String',
    :'packaging_quantity' => :'Float',
    :'packaging_required' => :'Boolean',
    :'packaging_unit' => :'String',
    :'personalization_required' => :'Boolean',
    :'price_changable' => :'Boolean',
    :'prices' => :'Array<ProductPrice>',
    :'print_tickets_separately' => :'Boolean',
    :'production_type' => :'ModelReference',
    :'recommended_retail_price' => :'Float',
    :'related_products' => :'ModelReference',
    :'sector' => :'ModelReference',
    :'serial_number_required' => :'Boolean',
    :'subproduct_presentation' => :'String',
    :'subproducts' => :'Array<ProductSubproduct>',
    :'supplier_prices' => :'Array<ProductSupplierPrice>',
    :'tags' => :'Array<ModelReference>',
    :'ticket_definition' => :'ModelReference',
    :'track_inventory' => :'Boolean',
    :'media_urls' => :'Array<MediaUrl>',
    :'quantity_denomination' => :'Float',
    :'special_prices' => :'Array<ProductSpecialPrice>',
    :'verification_requirements' => :'Array<ModelReference>',
    :'sales_lock' => :'Boolean',
    :'stock_return_unsellable' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/korona-cloud-client/models/product.rb', line 525

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active == o.active &&
      id == o.id &&
      revision == o.revision &&
      number == o.number &&
      alternative_sector == o.alternative_sector &&
      assortment == o.assortment &&
      codes == o.codes &&
      commodity_group == o.commodity_group &&
      conversion == o.conversion &&
      costs == o.costs &&
      deactivated == o.deactivated &&
      deposit == o.deposit &&
      descriptions == o.descriptions &&
      discountable == o.discountable &&
      image == o.image &&
      info_texts == o.info_texts &&
      item_sequence == o.item_sequence &&
      last_purchase_price == o.last_purchase_price &&
      listed == o.listed &&
      listed_since == o.listed_since &&
      max_price == o.max_price &&
      min_price == o.min_price &&
      name == o.name &&
      packaging_quantity == o.packaging_quantity &&
      packaging_required == o.packaging_required &&
      packaging_unit == o.packaging_unit &&
      personalization_required == o.personalization_required &&
      price_changable == o.price_changable &&
      prices == o.prices &&
      print_tickets_separately == o.print_tickets_separately &&
      production_type == o.production_type &&
      recommended_retail_price == o.recommended_retail_price &&
      related_products == o.related_products &&
      sector == o.sector &&
      serial_number_required == o.serial_number_required &&
      subproduct_presentation == o.subproduct_presentation &&
      subproducts == o.subproducts &&
      supplier_prices == o.supplier_prices &&
      tags == o.tags &&
      ticket_definition == o.ticket_definition &&
      track_inventory == o.track_inventory &&
      media_urls == o.media_urls &&
      quantity_denomination == o.quantity_denomination &&
      special_prices == o.special_prices &&
      verification_requirements == o.verification_requirements &&
      sales_lock == o.sales_lock &&
      stock_return_unsellable == o.stock_return_unsellable
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/korona-cloud-client/models/product.rb', line 623

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 = KoronaCloudClient.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'lib/korona-cloud-client/models/product.rb', line 694

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/korona-cloud-client/models/product.rb', line 599

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)
      self.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
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


579
580
581
# File 'lib/korona-cloud-client/models/product.rb', line 579

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



585
586
587
# File 'lib/korona-cloud-client/models/product.rb', line 585

def hash
  [active, id, revision, number, alternative_sector, assortment, codes, commodity_group, conversion, costs, deactivated, deposit, descriptions, discountable, image, info_texts, item_sequence, last_purchase_price, listed, listed_since, max_price, min_price, name, packaging_quantity, packaging_required, packaging_unit, personalization_required, price_changable, prices, print_tickets_separately, production_type, recommended_retail_price, related_products, sector, serial_number_required, subproduct_presentation, subproducts, supplier_prices, tags, ticket_definition, track_inventory, media_urls, quantity_denomination, special_prices, verification_requirements, sales_lock, stock_return_unsellable].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



482
483
484
485
# File 'lib/korona-cloud-client/models/product.rb', line 482

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



670
671
672
# File 'lib/korona-cloud-client/models/product.rb', line 670

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



676
677
678
679
680
681
682
683
684
685
686
687
688
# File 'lib/korona-cloud-client/models/product.rb', line 676

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.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

Returns:

  • (String)

    String presentation of the object



664
665
666
# File 'lib/korona-cloud-client/models/product.rb', line 664

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



489
490
491
492
493
494
495
# File 'lib/korona-cloud-client/models/product.rb', line 489

def valid?
  packaging_unit_validator = EnumAttributeValidator.new('String', ["CUBIC_INCH", "CUBIC_METER", "FLUID_OUNCE", "GALLON_FL", "GRAM", "ONE_HUNDRED_METERS", "INCH", "KILOGRAM", "LITER", "CENTIMETER", "METER", "MILLILITER", "OUNCE", "POUND", "SQUARE_INCH", "SQUARE_METER", "PORTION", "PIECE", "CARTON"])
  return false unless packaging_unit_validator.valid?(@packaging_unit)
  subproduct_presentation_validator = EnumAttributeValidator.new('String', ["DEFAULT", "HIDE_ALL", "HIDE_PRICES", "HIDE_QUANTITIES"])
  return false unless subproduct_presentation_validator.valid?(@subproduct_presentation)
  true
end