Class: Ditto::Image
- Inherits:
-
Object
- Object
- Ditto::Image
- Defined in:
- lib/ditto/image.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #faces ⇒ Object
- #height ⇒ Object
- #image_id ⇒ Object
-
#initialize(response) ⇒ Image
constructor
A new instance of Image.
- #logos ⇒ Object
- #moods ⇒ Object
- #url ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(response) ⇒ Image
Returns a new instance of Image.
5 6 7 |
# File 'lib/ditto/image.rb', line 5 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/ditto/image.rb', line 3 def response @response end |
Instance Method Details
#faces ⇒ Object
25 26 27 |
# File 'lib/ditto/image.rb', line 25 def faces faces_array.map { |face| Face.new(face) } end |
#height ⇒ Object
21 22 23 |
# File 'lib/ditto/image.rb', line 21 def height data[:image_height] end |
#image_id ⇒ Object
13 14 15 |
# File 'lib/ditto/image.rb', line 13 def image_id response[:uid] end |
#logos ⇒ Object
33 34 35 |
# File 'lib/ditto/image.rb', line 33 def logos data[:matches].map { |logo| Logo.new(logo) } end |
#moods ⇒ Object
29 30 31 |
# File 'lib/ditto/image.rb', line 29 def moods moods_array.map { |mood| Mood.new(mood) } end |
#url ⇒ Object
9 10 11 |
# File 'lib/ditto/image.rb', line 9 def url response[:url] end |
#width ⇒ Object
17 18 19 |
# File 'lib/ditto/image.rb', line 17 def width data[:image_width] end |