Class: FaceDetect::Adapter::Google

Inherits:
Object
  • Object
show all
Defined in:
lib/face_detect/adapter/google.rb,
lib/face_detect/adapter/google/service.rb,
lib/face_detect/adapter/google/auth_helper.rb

Defined Under Namespace

Modules: AuthHelper Classes: Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Google

Returns a new instance of Google.



9
10
11
# File 'lib/face_detect/adapter/google.rb', line 9

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



7
8
9
# File 'lib/face_detect/adapter/google.rb', line 7

def file
  @file
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/face_detect/adapter/google.rb', line 13

def run
  batch_response = execute
  response = batch_response.responses.first
  if response && response.face_annotations
    response.face_annotations.map do |annotation|
      convert_face(annotation)
    end
  else
    []
  end
end