Class: Aws::Lex::Conversation::Slot::Elicitation
- Inherits:
-
Object
- Object
- Aws::Lex::Conversation::Slot::Elicitation
- Defined in:
- lib/aws/lex/conversation/slot/elicitation.rb
Instance Attribute Summary collapse
-
#conversation ⇒ Object
Returns the value of attribute conversation.
-
#elicit ⇒ Object
Returns the value of attribute elicit.
-
#fallback ⇒ Object
Returns the value of attribute fallback.
-
#follow_up_messages ⇒ Object
Returns the value of attribute follow_up_messages.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #elicit! ⇒ Object
- #elicit? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Elicitation
constructor
A new instance of Elicitation.
Constructor Details
#initialize(opts = {}) ⇒ Elicitation
Returns a new instance of Elicitation.
11 12 13 14 15 16 17 18 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 11 def initialize(opts = {}) self.name = opts.fetch(:name) self.elicit = opts.fetch(:elicit) { ->(_c) { true } } self. = opts.fetch(:messages) self. = opts.fetch(:follow_up_messages) { opts.fetch(:messages) } self.fallback = opts[:fallback] self.max_retries = opts[:max_retries] || opts[:maximum_elicitations] || 0 end |
Instance Attribute Details
#conversation ⇒ Object
Returns the value of attribute conversation.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def conversation @conversation end |
#elicit ⇒ Object
Returns the value of attribute elicit.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def elicit @elicit end |
#fallback ⇒ Object
Returns the value of attribute fallback.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def fallback @fallback end |
#follow_up_messages ⇒ Object
Returns the value of attribute follow_up_messages.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def @follow_up_messages end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def max_retries @max_retries end |
#messages ⇒ Object
Returns the value of attribute messages.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def @messages end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 8 def name @name end |
Instance Method Details
#elicit! ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 20 def elicit! return false unless elicit? return fallback.call(conversation) if maximum_elicitations? increment_slot_elicitations! conversation.elicit_slot( slot_to_elicit: name, messages: ) end |
#elicit? ⇒ Boolean
31 32 33 34 35 |
# File 'lib/aws/lex/conversation/slot/elicitation.rb', line 31 def elicit? return false if maximum_elicitations? && fallback.nil? elicit.call(conversation) && !slot.filled? end |