class CognitiveVision::AnalyzeResponse

Attributes

adult[R]
categories[R]
description[R]
faces[R]
tags[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/cognitive_vision/analyze_response.rb, line 5
def initialize(options = {})
  @adult       = options.fetch(:adult, nil)
  @categories  = options.fetch(:categories, [])
  @description = options.fetch(:description, nil)
  @faces       = options.fetch(:faces, [])
  @tags        = options.fetch(:tags, [])
end
parse(response_hash, features) click to toggle source
# File lib/cognitive_vision/analyze_response.rb, line 13
def self.parse(response_hash, features)
  parsed = features.analyzers.map do |analyzer|
             [analyzer.key.to_sym, analyzer.parse(response_hash)]
           end
  new(Hash[parsed])
end