Class: Asdawqw::ImageUrlList
- Defined in:
- lib/asdawqw/models/image_url_list.rb
Overview
Model with list of URLs for one property
Instance Attribute Summary collapse
-
#images ⇒ List of Image
Images for property.
-
#product_id ⇒ Integer
Id of the product.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(product_id = nil, images = nil) ⇒ ImageUrlList
constructor
A new instance of ImageUrlList.
Methods inherited from BaseModel
Constructor Details
#initialize(product_id = nil, images = nil) ⇒ ImageUrlList
Returns a new instance of ImageUrlList.
25 26 27 28 29 |
# File 'lib/asdawqw/models/image_url_list.rb', line 25 def initialize(product_id = nil, images = nil) @product_id = product_id @images = images end |
Instance Attribute Details
#images ⇒ List of Image
Images for property
15 16 17 |
# File 'lib/asdawqw/models/image_url_list.rb', line 15 def images @images end |
#product_id ⇒ Integer
Id of the product
11 12 13 |
# File 'lib/asdawqw/models/image_url_list.rb', line 11 def product_id @product_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/asdawqw/models/image_url_list.rb', line 32 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash['productId'] # Parameter is an array, so we need to iterate through it images = nil unless hash['images'].nil? images = [] hash['images'].each do |structure| images << (Image.from_hash(structure) if structure) end end # Create object from extracted values. ImageUrlList.new(product_id, images) end |
.names ⇒ Object
A mapping from model property names to API property names.
18 19 20 21 22 23 |
# File 'lib/asdawqw/models/image_url_list.rb', line 18 def self.names @_hash = {} if @_hash.nil? @_hash['product_id'] = 'productId' @_hash['images'] = 'images' @_hash end |