class Ditto::Image

Attributes

response[R]

Public Class Methods

new(response) click to toggle source
# File lib/ditto/image.rb, line 5
def initialize(response)
  @response = response
end

Public Instance Methods

faces() click to toggle source
# File lib/ditto/image.rb, line 29
def faces
  faces_array.map { |face| Face.new(face) }
end
height() click to toggle source
# File lib/ditto/image.rb, line 21
def height
  data[:image_height]
end
image_id() click to toggle source
# File lib/ditto/image.rb, line 13
def image_id
  response[:uid]
end
label_confidence_threshold() click to toggle source
# File lib/ditto/image.rb, line 25
def label_confidence_threshold
  attributes[:confidence_threshold]
end
labels() click to toggle source
# File lib/ditto/image.rb, line 41
def labels
  labels_array.map { |label| Label.new(label) }
end
logos() click to toggle source
# File lib/ditto/image.rb, line 37
def logos
  data[:matches].map { |logo| Logo.new(logo) }
end
moods() click to toggle source
# File lib/ditto/image.rb, line 33
def moods
  moods_array.map { |mood| Mood.new(mood) }
end
url() click to toggle source
# File lib/ditto/image.rb, line 9
def url
  response[:url]
end
width() click to toggle source
# File lib/ditto/image.rb, line 17
def width
  data[:image_width]
end

Private Instance Methods

attributes() click to toggle source
# File lib/ditto/image.rb, line 59
def attributes
  data[:attributes] || {}
end
data() click to toggle source
# File lib/ditto/image.rb, line 47
def data
  response[:data]
end
faces_array() click to toggle source
# File lib/ditto/image.rb, line 51
def faces_array
  data[:faces] || []
end
labels_array() click to toggle source
# File lib/ditto/image.rb, line 63
def labels_array
  data[:attributes].nil? ? [] : data[:attributes][:labels]
end
moods_array() click to toggle source
# File lib/ditto/image.rb, line 55
def moods_array
  data[:moods] || []
end