class Facehugger
Attributes
api_key[RW]
api_secret[RW]
Public Class Methods
new(args = {:api_key => "", :api_secret => ""})
click to toggle source
# File lib/facehugger.rb, line 11 def initialize(args = {:api_key => "", :api_secret => ""}) @api_key = args[:api_key] @api_secret = args[:api_secret] end
photos(response = {})
click to toggle source
# File lib/facehugger.rb, line 21 def self.photos(response = {}) photos = [] if response.has_key? 'photos' response['photos'].each do |photo| photos << Face::Photo.new(photo) end end photos end
Public Instance Methods
faces_detect(args = {})
click to toggle source
Calls superclass method
# File lib/facehugger.rb, line 33 def faces_detect(args = {}) response = super args return nil if response['status'] != 'success' photos = Facehugger.photos response return nil if photos.nil? photos.each do |photo| tags = [] photo.tags.sort_by! do |t| t['attributes']['face']['confidence'] end.reverse.each do |tag| tags << Face::Tag.new(tag) end photo.tags = tags end photos end
valid?()
click to toggle source
# File lib/facehugger.rb, line 16 def valid? response = account_limits response['status'] == 'success' end