Class: A2z::Responses::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/a2z/responses/image.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeImage

Returns a new instance of Image.



6
7
8
9
# File 'lib/a2z/responses/image.rb', line 6

def initialize
  @width = 0
  @height = 0
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



4
5
6
# File 'lib/a2z/responses/image.rb', line 4

def height
  @height
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/a2z/responses/image.rb', line 4

def url
  @url
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'lib/a2z/responses/image.rb', line 4

def width
  @width
end

Class Method Details

.from_response(data) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/a2z/responses/image.rb', line 19

def self.from_response(data)
  new.tap do |image|
    image.url = data['URL']
    image.width = data['Width']
    image.height = data['Height']
    image.freeze
  end
end