Class: NluAdapter::Adapters::Lex::IntentCollection
- Inherits:
-
Object
- Object
- NluAdapter::Adapters::Lex::IntentCollection
- Includes:
- NluAdapterIntentCollection
- Defined in:
- lib/nlu_adapter/lex.rb
Overview
Class represents a collection of Intents
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
Attributes included from NluAdapterIntentCollection
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ IntentCollection
constructor
Constructor.
-
#to_h ⇒ Hash
Convert self to Hash.
-
#to_json ⇒ Json
Convert self to Json.
Constructor Details
#initialize(options = {}) ⇒ IntentCollection
Constructor
176 177 178 179 180 |
# File 'lib/nlu_adapter/lex.rb', line 176 def initialize( = {}) @name = [:name] @checksum = [:checksum] @intents = [:intents] end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
173 174 175 |
# File 'lib/nlu_adapter/lex.rb', line 173 def extra @extra end |
Instance Method Details
#to_h ⇒ Hash
Convert self to Hash
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/nlu_adapter/lex.rb', line 185 def to_h intents = [] @intents.each do |i| intents << { intent_name: i.name, intent_version: '$LATEST' } end { name: @name, intents: intents, locale: "en-US", child_directed: false, voice_id: "0", clarification_prompt: { max_attempts: 1, messages: [ { content: "I'm sorry, Can you please repeat that?", content_type: "PlainText" }, { content: "Can you say that again?", content_type: "PlainText" } ] }, abort_statement: { messages: [ { content: "I don't understand. Can you try again?", content_type: "PlainText" }, { content: "I'm sorry, I don't understand.", content_type: "PlainText" } ] }, checksum: @checksum } end |
#to_json ⇒ Json
Convert self to Json
232 233 234 |
# File 'lib/nlu_adapter/lex.rb', line 232 def to_json to_h.to_json end |