Class: Asdawqw::ImageUrlForCreate

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#imageImage

Image for property

Returns:



15
16
17
# File 'lib/asdawqw/models/image_url_for_create.rb', line 15

def image
  @image
end

#product_idInteger

Id of the product

Returns:

  • (Integer)


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

.namesObject

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