Class: Services::Builders::Request
- Inherits:
-
Object
- Object
- Services::Builders::Request
- Defined in:
- lib/services/builders/request.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(image_path, safe_search, face_detection) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(image_path, safe_search, face_detection) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 |
# File 'lib/services/builders/request.rb', line 9 def initialize(image_path, safe_search, face_detection) @image_path = image_path @safe_search = safe_search @face_detection = face_detection @features = [] end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/services/builders/request.rb', line 16 def call vision = Services::Builders::Vision.new.call @features << Services::Builders::Feature.new("SAFE_SEARCH_DETECTION").call if @safe_search @features << Services::Builders::Feature.new("FACE_DETECTION").call if @face_detection image = Services::Builders::Image.new(@image_path).call annotate_image = Services::Builders::AnnotateImage.new(image, @features).call batch_annotate = Services::Builders::BatchAnnotateImages.new([annotate_image]).call vision.annotate_image(batch_annotate).to_h[:responses].first end |