Class: CognitiveVision::AnalyzeResponse
- Inherits:
-
Object
- Object
- CognitiveVision::AnalyzeResponse
- Defined in:
- lib/cognitive_vision/analyze_response.rb
Instance Attribute Summary collapse
-
#adult ⇒ Object
readonly
Returns the value of attribute adult.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#faces ⇒ Object
readonly
Returns the value of attribute faces.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AnalyzeResponse
constructor
A new instance of AnalyzeResponse.
Constructor Details
#initialize(options = {}) ⇒ AnalyzeResponse
Returns a new instance of AnalyzeResponse.
5 6 7 8 9 10 11 |
# File 'lib/cognitive_vision/analyze_response.rb', line 5 def initialize( = {}) @adult = .fetch(:adult, nil) @categories = .fetch(:categories, []) @description = .fetch(:description, nil) @faces = .fetch(:faces, []) @tags = .fetch(:tags, []) end |
Instance Attribute Details
#adult ⇒ Object (readonly)
Returns the value of attribute adult.
3 4 5 |
# File 'lib/cognitive_vision/analyze_response.rb', line 3 def adult @adult end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
3 4 5 |
# File 'lib/cognitive_vision/analyze_response.rb', line 3 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/cognitive_vision/analyze_response.rb', line 3 def description @description end |
#faces ⇒ Object (readonly)
Returns the value of attribute faces.
3 4 5 |
# File 'lib/cognitive_vision/analyze_response.rb', line 3 def faces @faces end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/cognitive_vision/analyze_response.rb', line 3 def @tags end |
Class Method Details
.parse(response_hash, features) ⇒ Object
13 14 15 16 17 18 |
# 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 |