Class: AliseeksApi::Product
- Inherits:
-
Object
- Object
- AliseeksApi::Product
- Defined in:
- lib/aliseeks_api/models/product.rb
Overview
AliExpress product
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Attributes associated with the AliExpress product.
-
#category_id ⇒ Object
The item category.
-
#company_id ⇒ Object
The company ID.
-
#count_per_lot ⇒ Object
The number of items per lot.
-
#html_description ⇒ Object
The product HTML description.
-
#id ⇒ Object
The AliExpress item ID.
-
#multi_unit ⇒ Object
The unit for multiple items.
-
#price_summary ⇒ Object
Returns the value of attribute price_summary.
-
#prices ⇒ Object
All the variations of an AliExpress item and prices associated with each variation.
-
#product_images ⇒ Object
The item images.
-
#promotion ⇒ Object
Returns the value of attribute promotion.
-
#reviews ⇒ Object
Returns the value of attribute reviews.
-
#seller ⇒ Object
Returns the value of attribute seller.
-
#seller_id ⇒ Object
The seller ID.
-
#shipping ⇒ Object
The shipping options of an AliExpress item.
-
#status ⇒ Object
The AliExpress status.
-
#status_id ⇒ Object
The AliExpress status ID.
-
#title ⇒ Object
The subject / title of the item.
-
#trade ⇒ Object
Returns the value of attribute trade.
-
#unit ⇒ Object
The unit of the item.
-
#wish_list_count ⇒ Object
Number of times the item has been added to a wishlist.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.openapi_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
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/aliseeks_api/models/product.rb', line 154 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?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'categoryId') self.category_id = attributes[:'categoryId'] end if attributes.has_key?(:'companyId') self.company_id = attributes[:'companyId'] end if attributes.has_key?(:'sellerId') self.seller_id = attributes[:'sellerId'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'statusId') self.status_id = attributes[:'statusId'] end if attributes.has_key?(:'status') self.status = attributes[:'status'] end if attributes.has_key?(:'countPerLot') self.count_per_lot = attributes[:'countPerLot'] end if attributes.has_key?(:'wishListCount') self.wish_list_count = attributes[:'wishListCount'] end if attributes.has_key?(:'unit') self.unit = attributes[:'unit'] end if attributes.has_key?(:'multiUnit') self.multi_unit = attributes[:'multiUnit'] end if attributes.has_key?(:'seller') self.seller = attributes[:'seller'] end if attributes.has_key?(:'reviews') self.reviews = attributes[:'reviews'] end if attributes.has_key?(:'trade') self.trade = attributes[:'trade'] end if attributes.has_key?(:'promotion') self.promotion = attributes[:'promotion'] end if attributes.has_key?(:'productImages') if (value = attributes[:'productImages']).is_a?(Array) self.product_images = value end end if attributes.has_key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Array) self.attributes = value end end if attributes.has_key?(:'htmlDescription') self.html_description = attributes[:'htmlDescription'] end if attributes.has_key?(:'priceSummary') self.price_summary = attributes[:'priceSummary'] end if attributes.has_key?(:'prices') if (value = attributes[:'prices']).is_a?(Array) self.prices = value end end if attributes.has_key?(:'shipping') if (value = attributes[:'shipping']).is_a?(Array) self.shipping = value end end end |
Instance Attribute Details
#attributes ⇒ Object
Attributes associated with the AliExpress product
63 64 65 |
# File 'lib/aliseeks_api/models/product.rb', line 63 def attributes @attributes end |
#category_id ⇒ Object
The item category
22 23 24 |
# File 'lib/aliseeks_api/models/product.rb', line 22 def category_id @category_id end |
#company_id ⇒ Object
The company ID
25 26 27 |
# File 'lib/aliseeks_api/models/product.rb', line 25 def company_id @company_id end |
#count_per_lot ⇒ Object
The number of items per lot
40 41 42 |
# File 'lib/aliseeks_api/models/product.rb', line 40 def count_per_lot @count_per_lot end |
#html_description ⇒ Object
The product HTML description
66 67 68 |
# File 'lib/aliseeks_api/models/product.rb', line 66 def html_description @html_description end |
#id ⇒ Object
The AliExpress item ID
19 20 21 |
# File 'lib/aliseeks_api/models/product.rb', line 19 def id @id end |
#multi_unit ⇒ Object
The unit for multiple items
49 50 51 |
# File 'lib/aliseeks_api/models/product.rb', line 49 def multi_unit @multi_unit end |
#price_summary ⇒ Object
Returns the value of attribute price_summary.
68 69 70 |
# File 'lib/aliseeks_api/models/product.rb', line 68 def price_summary @price_summary end |
#prices ⇒ Object
All the variations of an AliExpress item and prices associated with each variation
71 72 73 |
# File 'lib/aliseeks_api/models/product.rb', line 71 def prices @prices end |
#product_images ⇒ Object
The item images
60 61 62 |
# File 'lib/aliseeks_api/models/product.rb', line 60 def product_images @product_images end |
#promotion ⇒ Object
Returns the value of attribute promotion.
57 58 59 |
# File 'lib/aliseeks_api/models/product.rb', line 57 def promotion @promotion end |
#reviews ⇒ Object
Returns the value of attribute reviews.
53 54 55 |
# File 'lib/aliseeks_api/models/product.rb', line 53 def reviews @reviews end |
#seller ⇒ Object
Returns the value of attribute seller.
51 52 53 |
# File 'lib/aliseeks_api/models/product.rb', line 51 def seller @seller end |
#seller_id ⇒ Object
The seller ID
28 29 30 |
# File 'lib/aliseeks_api/models/product.rb', line 28 def seller_id @seller_id end |
#shipping ⇒ Object
The shipping options of an AliExpress item
74 75 76 |
# File 'lib/aliseeks_api/models/product.rb', line 74 def shipping @shipping end |
#status ⇒ Object
The AliExpress status
37 38 39 |
# File 'lib/aliseeks_api/models/product.rb', line 37 def status @status end |
#status_id ⇒ Object
The AliExpress status ID
34 35 36 |
# File 'lib/aliseeks_api/models/product.rb', line 34 def status_id @status_id end |
#title ⇒ Object
The subject / title of the item
31 32 33 |
# File 'lib/aliseeks_api/models/product.rb', line 31 def title @title end |
#trade ⇒ Object
Returns the value of attribute trade.
55 56 57 |
# File 'lib/aliseeks_api/models/product.rb', line 55 def trade @trade end |
#unit ⇒ Object
The unit of the item
46 47 48 |
# File 'lib/aliseeks_api/models/product.rb', line 46 def unit @unit end |
#wish_list_count ⇒ Object
Number of times the item has been added to a wishlist
43 44 45 |
# File 'lib/aliseeks_api/models/product.rb', line 43 def wish_list_count @wish_list_count end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/aliseeks_api/models/product.rb', line 99 def self.attribute_map { :'id' => :'id', :'category_id' => :'categoryId', :'company_id' => :'companyId', :'seller_id' => :'sellerId', :'title' => :'title', :'status_id' => :'statusId', :'status' => :'status', :'count_per_lot' => :'countPerLot', :'wish_list_count' => :'wishListCount', :'unit' => :'unit', :'multi_unit' => :'multiUnit', :'seller' => :'seller', :'reviews' => :'reviews', :'trade' => :'trade', :'promotion' => :'promotion', :'product_images' => :'productImages', :'attributes' => :'attributes', :'html_description' => :'htmlDescription', :'price_summary' => :'priceSummary', :'prices' => :'prices', :'shipping' => :'shipping' } end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/aliseeks_api/models/product.rb', line 126 def self.openapi_types { :'id' => :'String', :'category_id' => :'String', :'company_id' => :'String', :'seller_id' => :'String', :'title' => :'String', :'status_id' => :'Integer', :'status' => :'String', :'count_per_lot' => :'Integer', :'wish_list_count' => :'Integer', :'unit' => :'String', :'multi_unit' => :'String', :'seller' => :'ProductSeller', :'reviews' => :'ProductReviews', :'trade' => :'TradeInformation', :'promotion' => :'ProductPromotion', :'product_images' => :'Array<String>', :'attributes' => :'Array<ProductAttribute>', :'html_description' => :'String', :'price_summary' => :'PriceSummary', :'prices' => :'Array<SkuPriceOption>', :'shipping' => :'Array<ProductShippingOptions>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 |
# File 'lib/aliseeks_api/models/product.rb', line 280 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && category_id == o.category_id && company_id == o.company_id && seller_id == o.seller_id && title == o.title && status_id == o.status_id && status == o.status && count_per_lot == o.count_per_lot && wish_list_count == o.wish_list_count && unit == o.unit && multi_unit == o.multi_unit && seller == o.seller && reviews == o.reviews && trade == o.trade && promotion == o.promotion && product_images == o.product_images && attributes == o.attributes && html_description == o.html_description && price_summary == o.price_summary && prices == o.prices && shipping == o.shipping end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 |
# File 'lib/aliseeks_api/models/product.rb', line 342 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 = AliseeksApi.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
408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/aliseeks_api/models/product.rb', line 408 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
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/aliseeks_api/models/product.rb', line 321 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_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
308 309 310 |
# File 'lib/aliseeks_api/models/product.rb', line 308 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
314 315 316 |
# File 'lib/aliseeks_api/models/product.rb', line 314 def hash [id, category_id, company_id, seller_id, title, status_id, status, count_per_lot, wish_list_count, unit, multi_unit, seller, reviews, trade, promotion, product_images, attributes, html_description, price_summary, prices, shipping].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
255 256 257 258 |
# File 'lib/aliseeks_api/models/product.rb', line 255 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
388 389 390 |
# File 'lib/aliseeks_api/models/product.rb', line 388 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
394 395 396 397 398 399 400 401 402 |
# File 'lib/aliseeks_api/models/product.rb', line 394 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
382 383 384 |
# File 'lib/aliseeks_api/models/product.rb', line 382 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
262 263 264 265 266 |
# File 'lib/aliseeks_api/models/product.rb', line 262 def valid? status_validator = EnumAttributeValidator.new('String', ['active', 'inactive']) return false unless status_validator.valid?(@status) true end |