Class: NluAdapter::Adapters::WatsonAssistant::Intent
- Inherits:
-
Object
- Object
- NluAdapter::Adapters::WatsonAssistant::Intent
- Includes:
- NluAdapterIntent
- Defined in:
- lib/nlu_adapter/watson_assistant.rb
Overview
Class represents Intent in an IntentCollection
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
Attributes included from NluAdapterIntent
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Intent
constructor
Constructor.
-
#to_h ⇒ Hash
Convert self to Hash.
-
#to_json ⇒ json
convert self to json.
Constructor Details
#initialize(options = {}) ⇒ Intent
Constructor
130 131 132 133 134 135 |
# File 'lib/nlu_adapter/watson_assistant.rb', line 130 def initialize( = {}) @id = [:id] #check for is update @name = [:name] @description = [:description] @utterences = [:utterences] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
127 128 129 |
# File 'lib/nlu_adapter/watson_assistant.rb', line 127 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
127 128 129 |
# File 'lib/nlu_adapter/watson_assistant.rb', line 127 def id @id end |
Instance Method Details
#to_h ⇒ Hash
Convert self to Hash
140 141 142 143 144 145 146 |
# File 'lib/nlu_adapter/watson_assistant.rb', line 140 def to_h { name: @name, description: @description, examples: @utterences.map {|u| {"text" => u } } } end |
#to_json ⇒ json
convert self to json
151 152 153 |
# File 'lib/nlu_adapter/watson_assistant.rb', line 151 def to_json to_h.to_json end |