Class: A2z::Responses::Image
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#url ⇒ Object
Returns the value of attribute url.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize ⇒ Image
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
#height ⇒ Object
Returns the value of attribute height.
4 5 6 |
# File 'lib/a2z/responses/image.rb', line 4 def height @height end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/a2z/responses/image.rb', line 4 def url @url end |
#width ⇒ Object
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 |