Class: Ditto::Image

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/ditto/image.rb', line 3

def response
  @response
end

Instance Method Details

#facesObject



25
26
27
# File 'lib/ditto/image.rb', line 25

def faces
  faces_array.map { |face| Face.new(face) }
end

#heightObject



21
22
23
# File 'lib/ditto/image.rb', line 21

def height
  data[:image_height]
end

#image_idObject



13
14
15
# File 'lib/ditto/image.rb', line 13

def image_id
  response[:uid]
end

#logosObject



33
34
35
# File 'lib/ditto/image.rb', line 33

def logos
  data[:matches].map { || Logo.new() }
end

#moodsObject



29
30
31
# File 'lib/ditto/image.rb', line 29

def moods
  moods_array.map { |mood| Mood.new(mood) }
end

#urlObject



9
10
11
# File 'lib/ditto/image.rb', line 9

def url
  response[:url]
end

#widthObject



17
18
19
# File 'lib/ditto/image.rb', line 17

def width
  data[:image_width]
end