Class: KoronaClient::Product
- Inherits:
-
Object
- Object
- KoronaClient::Product
- Defined in:
- lib/korona_client/models/product.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#active ⇒ Object
indicates whether the object is active for use or not.
-
#alternative_sector ⇒ Object
Returns the value of attribute alternative_sector.
-
#assortment ⇒ Object
Returns the value of attribute assortment.
-
#codes ⇒ Object
Returns the value of attribute codes.
-
#commodity_group ⇒ Object
Returns the value of attribute commodity_group.
-
#conversion ⇒ Object
Returns the value of attribute conversion.
-
#costs ⇒ Object
Returns the value of attribute costs.
-
#deactivated ⇒ Object
Returns the value of attribute deactivated.
-
#deposit ⇒ Object
Returns the value of attribute deposit.
-
#descriptions ⇒ Object
Returns the value of attribute descriptions.
-
#discountable ⇒ Object
Returns the value of attribute discountable.
-
#id ⇒ Object
global object uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
-
#image ⇒ Object
Returns the value of attribute image.
-
#info_texts ⇒ Object
Returns the value of attribute info_texts.
-
#item_sequence ⇒ Object
Returns the value of attribute item_sequence.
-
#last_purchase_price ⇒ Object
Returns the value of attribute last_purchase_price.
-
#listed ⇒ Object
Returns the value of attribute listed.
-
#listed_since ⇒ Object
Returns the value of attribute listed_since.
-
#max_price ⇒ Object
Returns the value of attribute max_price.
-
#media_urls ⇒ Object
Returns the value of attribute media_urls.
-
#min_price ⇒ Object
Returns the value of attribute min_price.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
number of the object, like it is set in backoffice; will be removed when active=false.
-
#packaging_quantity ⇒ Object
Returns the value of attribute packaging_quantity.
-
#packaging_required ⇒ Object
Returns the value of attribute packaging_required.
-
#packaging_unit ⇒ Object
Returns the value of attribute packaging_unit.
-
#personalization_required ⇒ Object
Returns the value of attribute personalization_required.
-
#price_changable ⇒ Object
Returns the value of attribute price_changable.
-
#prices ⇒ Object
Returns the value of attribute prices.
-
#print_tickets_separately ⇒ Object
Returns the value of attribute print_tickets_separately.
-
#production_type ⇒ Object
Returns the value of attribute production_type.
-
#quantity_denomination ⇒ Object
Returns the value of attribute quantity_denomination.
-
#recommended_retail_price ⇒ Object
Returns the value of attribute recommended_retail_price.
-
#related_products ⇒ Object
Returns the value of attribute related_products.
-
#revision ⇒ Object
the revision number of the object.
-
#sector ⇒ Object
Returns the value of attribute sector.
-
#serial_number_required ⇒ Object
Returns the value of attribute serial_number_required.
-
#stock_return_unsellable ⇒ Object
Returns the value of attribute stock_return_unsellable.
-
#subproduct_presentation ⇒ Object
Returns the value of attribute subproduct_presentation.
-
#subproducts ⇒ Object
Returns the value of attribute subproducts.
-
#supplier_prices ⇒ Object
Returns the value of attribute supplier_prices.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#ticket_definition ⇒ Object
Returns the value of attribute ticket_definition.
-
#track_inventory ⇒ Object
Returns the value of attribute track_inventory.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Product
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Product
Initializes the object
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 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 |
# File 'lib/korona_client/models/product.rb', line 233 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'active') self.active = attributes[:'active'] end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'number') self.number = attributes[:'number'] end if attributes.has_key?(:'revision') self.revision = attributes[:'revision'] end if attributes.has_key?(:'alternativeSector') self.alternative_sector = attributes[:'alternativeSector'] end if attributes.has_key?(:'assortment') self.assortment = attributes[:'assortment'] end if attributes.has_key?(:'codes') if (value = attributes[:'codes']).is_a?(Array) self.codes = value end end if attributes.has_key?(:'commodityGroup') self.commodity_group = attributes[:'commodityGroup'] end if attributes.has_key?(:'conversion') self.conversion = attributes[:'conversion'] end if attributes.has_key?(:'costs') self.costs = attributes[:'costs'] end if attributes.has_key?(:'deactivated') self.deactivated = attributes[:'deactivated'] end if attributes.has_key?(:'deposit') self.deposit = attributes[:'deposit'] end if attributes.has_key?(:'descriptions') if (value = attributes[:'descriptions']).is_a?(Array) self.descriptions = value end end if attributes.has_key?(:'discountable') self.discountable = attributes[:'discountable'] end if attributes.has_key?(:'image') self.image = attributes[:'image'] end if attributes.has_key?(:'infoTexts') if (value = attributes[:'infoTexts']).is_a?(Array) self.info_texts = value end end if attributes.has_key?(:'itemSequence') self.item_sequence = attributes[:'itemSequence'] end if attributes.has_key?(:'lastPurchasePrice') self.last_purchase_price = attributes[:'lastPurchasePrice'] end if attributes.has_key?(:'listed') self.listed = attributes[:'listed'] end if attributes.has_key?(:'listedSince') self.listed_since = attributes[:'listedSince'] end if attributes.has_key?(:'maxPrice') self.max_price = attributes[:'maxPrice'] end if attributes.has_key?(:'minPrice') self.min_price = attributes[:'minPrice'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'packagingQuantity') self.packaging_quantity = attributes[:'packagingQuantity'] end if attributes.has_key?(:'packagingRequired') self.packaging_required = attributes[:'packagingRequired'] end if attributes.has_key?(:'packagingUnit') self.packaging_unit = attributes[:'packagingUnit'] end if attributes.has_key?(:'personalizationRequired') self.personalization_required = attributes[:'personalizationRequired'] end if attributes.has_key?(:'priceChangable') self.price_changable = attributes[:'priceChangable'] end if attributes.has_key?(:'prices') if (value = attributes[:'prices']).is_a?(Array) self.prices = value end end if attributes.has_key?(:'printTicketsSeparately') self.print_tickets_separately = attributes[:'printTicketsSeparately'] end if attributes.has_key?(:'productionType') self.production_type = attributes[:'productionType'] end if attributes.has_key?(:'recommendedRetailPrice') self.recommended_retail_price = attributes[:'recommendedRetailPrice'] end if attributes.has_key?(:'relatedProducts') self. = attributes[:'relatedProducts'] end if attributes.has_key?(:'sector') self.sector = attributes[:'sector'] end if attributes.has_key?(:'serialNumberRequired') self.serial_number_required = attributes[:'serialNumberRequired'] end if attributes.has_key?(:'subproductPresentation') self.subproduct_presentation = attributes[:'subproductPresentation'] end if attributes.has_key?(:'subproducts') if (value = attributes[:'subproducts']).is_a?(Array) self.subproducts = value end end if attributes.has_key?(:'supplierPrices') if (value = attributes[:'supplierPrices']).is_a?(Array) self.supplier_prices = value end end if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = value end end if attributes.has_key?(:'ticketDefinition') self.ticket_definition = attributes[:'ticketDefinition'] end if attributes.has_key?(:'trackInventory') self.track_inventory = attributes[:'trackInventory'] end if attributes.has_key?(:'mediaUrls') if (value = attributes[:'mediaUrls']).is_a?(Array) self.media_urls = value end end if attributes.has_key?(:'quantityDenomination') self.quantity_denomination = attributes[:'quantityDenomination'] end if attributes.has_key?(:'stockReturnUnsellable') self.stock_return_unsellable = attributes[:'stockReturnUnsellable'] end end |
Instance Attribute Details
#active ⇒ Object
indicates whether the object is active for use or not
18 19 20 |
# File 'lib/korona_client/models/product.rb', line 18 def active @active end |
#alternative_sector ⇒ Object
Returns the value of attribute alternative_sector.
29 30 31 |
# File 'lib/korona_client/models/product.rb', line 29 def alternative_sector @alternative_sector end |
#assortment ⇒ Object
Returns the value of attribute assortment.
31 32 33 |
# File 'lib/korona_client/models/product.rb', line 31 def assortment @assortment end |
#codes ⇒ Object
Returns the value of attribute codes.
33 34 35 |
# File 'lib/korona_client/models/product.rb', line 33 def codes @codes end |
#commodity_group ⇒ Object
Returns the value of attribute commodity_group.
35 36 37 |
# File 'lib/korona_client/models/product.rb', line 35 def commodity_group @commodity_group end |
#conversion ⇒ Object
Returns the value of attribute conversion.
37 38 39 |
# File 'lib/korona_client/models/product.rb', line 37 def conversion @conversion end |
#costs ⇒ Object
Returns the value of attribute costs.
39 40 41 |
# File 'lib/korona_client/models/product.rb', line 39 def costs @costs end |
#deactivated ⇒ Object
Returns the value of attribute deactivated.
41 42 43 |
# File 'lib/korona_client/models/product.rb', line 41 def deactivated @deactivated end |
#deposit ⇒ Object
Returns the value of attribute deposit.
43 44 45 |
# File 'lib/korona_client/models/product.rb', line 43 def deposit @deposit end |
#descriptions ⇒ Object
Returns the value of attribute descriptions.
45 46 47 |
# File 'lib/korona_client/models/product.rb', line 45 def descriptions @descriptions end |
#discountable ⇒ Object
Returns the value of attribute discountable.
47 48 49 |
# File 'lib/korona_client/models/product.rb', line 47 def discountable @discountable end |
#id ⇒ Object
global object uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
21 22 23 |
# File 'lib/korona_client/models/product.rb', line 21 def id @id end |
#image ⇒ Object
Returns the value of attribute image.
49 50 51 |
# File 'lib/korona_client/models/product.rb', line 49 def image @image end |
#info_texts ⇒ Object
Returns the value of attribute info_texts.
51 52 53 |
# File 'lib/korona_client/models/product.rb', line 51 def info_texts @info_texts end |
#item_sequence ⇒ Object
Returns the value of attribute item_sequence.
53 54 55 |
# File 'lib/korona_client/models/product.rb', line 53 def item_sequence @item_sequence end |
#last_purchase_price ⇒ Object
Returns the value of attribute last_purchase_price.
55 56 57 |
# File 'lib/korona_client/models/product.rb', line 55 def last_purchase_price @last_purchase_price end |
#listed ⇒ Object
Returns the value of attribute listed.
57 58 59 |
# File 'lib/korona_client/models/product.rb', line 57 def listed @listed end |
#listed_since ⇒ Object
Returns the value of attribute listed_since.
59 60 61 |
# File 'lib/korona_client/models/product.rb', line 59 def listed_since @listed_since end |
#max_price ⇒ Object
Returns the value of attribute max_price.
61 62 63 |
# File 'lib/korona_client/models/product.rb', line 61 def max_price @max_price end |
#media_urls ⇒ Object
Returns the value of attribute media_urls.
103 104 105 |
# File 'lib/korona_client/models/product.rb', line 103 def media_urls @media_urls end |
#min_price ⇒ Object
Returns the value of attribute min_price.
63 64 65 |
# File 'lib/korona_client/models/product.rb', line 63 def min_price @min_price end |
#name ⇒ Object
Returns the value of attribute name.
65 66 67 |
# File 'lib/korona_client/models/product.rb', line 65 def name @name end |
#number ⇒ Object
number of the object, like it is set in backoffice; will be removed when active=false
24 25 26 |
# File 'lib/korona_client/models/product.rb', line 24 def number @number end |
#packaging_quantity ⇒ Object
Returns the value of attribute packaging_quantity.
67 68 69 |
# File 'lib/korona_client/models/product.rb', line 67 def packaging_quantity @packaging_quantity end |
#packaging_required ⇒ Object
Returns the value of attribute packaging_required.
69 70 71 |
# File 'lib/korona_client/models/product.rb', line 69 def packaging_required @packaging_required end |
#packaging_unit ⇒ Object
Returns the value of attribute packaging_unit.
71 72 73 |
# File 'lib/korona_client/models/product.rb', line 71 def packaging_unit @packaging_unit end |
#personalization_required ⇒ Object
Returns the value of attribute personalization_required.
73 74 75 |
# File 'lib/korona_client/models/product.rb', line 73 def personalization_required @personalization_required end |
#price_changable ⇒ Object
Returns the value of attribute price_changable.
75 76 77 |
# File 'lib/korona_client/models/product.rb', line 75 def price_changable @price_changable end |
#prices ⇒ Object
Returns the value of attribute prices.
77 78 79 |
# File 'lib/korona_client/models/product.rb', line 77 def prices @prices end |
#print_tickets_separately ⇒ Object
Returns the value of attribute print_tickets_separately.
79 80 81 |
# File 'lib/korona_client/models/product.rb', line 79 def print_tickets_separately @print_tickets_separately end |
#production_type ⇒ Object
Returns the value of attribute production_type.
81 82 83 |
# File 'lib/korona_client/models/product.rb', line 81 def production_type @production_type end |
#quantity_denomination ⇒ Object
Returns the value of attribute quantity_denomination.
105 106 107 |
# File 'lib/korona_client/models/product.rb', line 105 def quantity_denomination @quantity_denomination end |
#recommended_retail_price ⇒ Object
Returns the value of attribute recommended_retail_price.
83 84 85 |
# File 'lib/korona_client/models/product.rb', line 83 def recommended_retail_price @recommended_retail_price end |
#related_products ⇒ Object
Returns the value of attribute related_products.
85 86 87 |
# File 'lib/korona_client/models/product.rb', line 85 def @related_products end |
#revision ⇒ Object
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.
27 28 29 |
# File 'lib/korona_client/models/product.rb', line 27 def revision @revision end |
#sector ⇒ Object
Returns the value of attribute sector.
87 88 89 |
# File 'lib/korona_client/models/product.rb', line 87 def sector @sector end |
#serial_number_required ⇒ Object
Returns the value of attribute serial_number_required.
89 90 91 |
# File 'lib/korona_client/models/product.rb', line 89 def serial_number_required @serial_number_required end |
#stock_return_unsellable ⇒ Object
Returns the value of attribute stock_return_unsellable.
107 108 109 |
# File 'lib/korona_client/models/product.rb', line 107 def stock_return_unsellable @stock_return_unsellable end |
#subproduct_presentation ⇒ Object
Returns the value of attribute subproduct_presentation.
91 92 93 |
# File 'lib/korona_client/models/product.rb', line 91 def subproduct_presentation @subproduct_presentation end |
#subproducts ⇒ Object
Returns the value of attribute subproducts.
93 94 95 |
# File 'lib/korona_client/models/product.rb', line 93 def subproducts @subproducts end |
#supplier_prices ⇒ Object
Returns the value of attribute supplier_prices.
95 96 97 |
# File 'lib/korona_client/models/product.rb', line 95 def supplier_prices @supplier_prices end |
#tags ⇒ Object
Returns the value of attribute tags.
97 98 99 |
# File 'lib/korona_client/models/product.rb', line 97 def @tags end |
#ticket_definition ⇒ Object
Returns the value of attribute ticket_definition.
99 100 101 |
# File 'lib/korona_client/models/product.rb', line 99 def ticket_definition @ticket_definition end |
#track_inventory ⇒ Object
Returns the value of attribute track_inventory.
101 102 103 |
# File 'lib/korona_client/models/product.rb', line 101 def track_inventory @track_inventory end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
132 133 134 135 136 137 138 139 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 |
# File 'lib/korona_client/models/product.rb', line 132 def self.attribute_map { :'active' => :'active', :'id' => :'id', :'number' => :'number', :'revision' => :'revision', :'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', :'stock_return_unsellable' => :'stockReturnUnsellable' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/korona_client/models/product.rb', line 182 def self.swagger_types { :'active' => :'BOOLEAN', :'id' => :'String', :'number' => :'String', :'revision' => :'Integer', :'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' => :'DateTime', :'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', :'stock_return_unsellable' => :'BOOLEAN' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 |
# File 'lib/korona_client/models/product.rb', line 471 def ==(o) return true if self.equal?(o) self.class == o.class && active == o.active && id == o.id && number == o.number && revision == o.revision && 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 && == o. && sector == o.sector && serial_number_required == o.serial_number_required && subproduct_presentation == o.subproduct_presentation && subproducts == o.subproducts && supplier_prices == o.supplier_prices && == o. && ticket_definition == o.ticket_definition && track_inventory == o.track_inventory && media_urls == o.media_urls && quantity_denomination == o.quantity_denomination && stock_return_unsellable == o.stock_return_unsellable end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
# File 'lib/korona_client/models/product.rb', line 556 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 temp_model = KoronaClient.const_get(type).new temp_model.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
622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/korona_client/models/product.rb', line 622 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
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/korona_client/models/product.rb', line 535 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
522 523 524 |
# File 'lib/korona_client/models/product.rb', line 522 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
528 529 530 |
# File 'lib/korona_client/models/product.rb', line 528 def hash [active, id, number, revision, 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, , sector, serial_number_required, subproduct_presentation, subproducts, supplier_prices, , ticket_definition, track_inventory, media_urls, quantity_denomination, stock_return_unsellable].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
434 435 436 437 |
# File 'lib/korona_client/models/product.rb', line 434 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
602 603 604 |
# File 'lib/korona_client/models/product.rb', line 602 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
608 609 610 611 612 613 614 615 616 |
# File 'lib/korona_client/models/product.rb', line 608 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
596 597 598 |
# File 'lib/korona_client/models/product.rb', line 596 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
441 442 443 444 445 446 447 |
# File 'lib/korona_client/models/product.rb', line 441 def valid? packaging_unit_validator = EnumAttributeValidator.new('String', ['CUBIC_INCH', 'CUBIC_METER', 'FLUID_OUNCE', 'GALLON_FL', 'GRAM', 'INCH', 'KILOGRAM', 'LITER', 'METER', 'MILLILITER', 'OUNCE', 'POUND', 'SQUARE_INCH', 'SQUARE_METER']) 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 |