Class: EmailToFace::FaceAPI
- Inherits:
-
Object
- Object
- EmailToFace::FaceAPI
- Defined in:
- lib/email_to_face.rb
Class Method Summary collapse
Class Method Details
.get_center(url) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/email_to_face.rb', line 63 def self.get_center(url) return if url.match(/gravatar.com/) and @use_face_for_gravatar == false begin result = @client.faces_detect(:urls => url) result['photos'][0]['tags'].empty? ? nil : result['photos'][0]['tags'][0]['center'] rescue Exception => e puts e.inspect return nil end end |
.init(face_api_key, face_api_secret, use_face_for_gravatar) ⇒ Object
58 59 60 61 |
# File 'lib/email_to_face.rb', line 58 def self.init(face_api_key, face_api_secret, use_face_for_gravatar) @client = Face.get_client(:api_key => face_api_key, :api_secret => face_api_secret) @use_face_for_gravatar = use_face_for_gravatar || false end |