Class: Clarification::Objectifier
- Inherits:
-
Object
- Object
- Clarification::Objectifier
- Defined in:
- lib/clarification/objectifier.rb
Instance Attribute Summary collapse
-
#concepts ⇒ Object
readonly
Returns the value of attribute concepts.
-
#response_json ⇒ Object
readonly
Returns the value of attribute response_json.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #build_concept_objects ⇒ Object
-
#initialize(response) ⇒ Objectifier
constructor
A new instance of Objectifier.
Constructor Details
#initialize(response) ⇒ Objectifier
Returns a new instance of Objectifier.
6 7 8 9 10 11 12 |
# File 'lib/clarification/objectifier.rb', line 6 def initialize(response) @response_json = JSON.parse(response) @status = OpenStruct.new(@response_json["status"]) @concepts = [] build_concept_objects end |
Instance Attribute Details
#concepts ⇒ Object (readonly)
Returns the value of attribute concepts.
4 5 6 |
# File 'lib/clarification/objectifier.rb', line 4 def concepts @concepts end |
#response_json ⇒ Object (readonly)
Returns the value of attribute response_json.
4 5 6 |
# File 'lib/clarification/objectifier.rb', line 4 def response_json @response_json end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/clarification/objectifier.rb', line 4 def status @status end |
Instance Method Details
#build_concept_objects ⇒ Object
14 15 16 17 18 |
# File 'lib/clarification/objectifier.rb', line 14 def build_concept_objects @response_json["outputs"][0]["data"]["concepts"].each do |concept| @concepts << OpenStruct.new(concept) end end |