Class: Asdawqw::ImageUrlForCreate
- Defined in:
- lib/asdawqw/models/image_url_for_create.rb
Overview
Model with one image URL for one property used for inserting new image
Instance Attribute Summary collapse
-
#image ⇒ Image
Image 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, image = nil) ⇒ ImageUrlForCreate
constructor
A new instance of ImageUrlForCreate.
Methods inherited from BaseModel
Constructor Details
#initialize(product_id = nil, image = nil) ⇒ ImageUrlForCreate
Returns a new instance of ImageUrlForCreate.
25 26 27 28 29 |
# File 'lib/asdawqw/models/image_url_for_create.rb', line 25 def initialize(product_id = nil, image = nil) @product_id = product_id @image = image end |
Instance Attribute Details
#image ⇒ Image
Image for property
15 16 17 |
# File 'lib/asdawqw/models/image_url_for_create.rb', line 15 def image @image end |
#product_id ⇒ Integer
Id of the product
11 12 13 |
# File 'lib/asdawqw/models/image_url_for_create.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 |
# File 'lib/asdawqw/models/image_url_for_create.rb', line 32 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash['productId'] image = Image.from_hash(hash['image']) if hash['image'] # Create object from extracted values. ImageUrlForCreate.new(product_id, image) 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_for_create.rb', line 18 def self.names @_hash = {} if @_hash.nil? @_hash['product_id'] = 'productId' @_hash['image'] = 'image' @_hash end |