Class: AlexaSkill::IntentBuilder
- Inherits:
-
Object
- Object
- AlexaSkill::IntentBuilder
- Defined in:
- lib/alexa-skill/intent_builder.rb
Instance Attribute Summary collapse
-
#card_response ⇒ Object
readonly
Returns the value of attribute card_response.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#slots ⇒ Object
readonly
Returns the value of attribute slots.
-
#utterances ⇒ Object
readonly
Returns the value of attribute utterances.
Class Method Summary collapse
Instance Method Summary collapse
- #card(&block) ⇒ Object
-
#initialize(&block) ⇒ IntentBuilder
constructor
A new instance of IntentBuilder.
- #respond(&block) ⇒ Object
- #slot(name, options = []) ⇒ Object
- #utterance(value) ⇒ Object
Constructor Details
#initialize(&block) ⇒ IntentBuilder
Returns a new instance of IntentBuilder.
6 7 8 9 10 |
# File 'lib/alexa-skill/intent_builder.rb', line 6 def initialize(&block) @slots = {} @utterances = [] self.instance_eval(&block) end |
Instance Attribute Details
#card_response ⇒ Object (readonly)
Returns the value of attribute card_response.
5 6 7 |
# File 'lib/alexa-skill/intent_builder.rb', line 5 def card_response @card_response end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/alexa-skill/intent_builder.rb', line 5 def response @response end |
#slots ⇒ Object (readonly)
Returns the value of attribute slots.
5 6 7 |
# File 'lib/alexa-skill/intent_builder.rb', line 5 def slots @slots end |
#utterances ⇒ Object (readonly)
Returns the value of attribute utterances.
5 6 7 |
# File 'lib/alexa-skill/intent_builder.rb', line 5 def utterances @utterances end |
Class Method Details
.build(builder) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/alexa-skill/intent_builder.rb', line 28 def self.build(builder) intent = AlexaSkill::Intent.new intent.slots = builder.slots intent.utterances = builder.utterances intent.response = builder.response intent.card = builder.card_response intent end |
Instance Method Details
#card(&block) ⇒ Object
16 17 18 |
# File 'lib/alexa-skill/intent_builder.rb', line 16 def card(&block) @card_response = block end |
#respond(&block) ⇒ Object
20 21 22 |
# File 'lib/alexa-skill/intent_builder.rb', line 20 def respond(&block) @response = block end |
#slot(name, options = []) ⇒ Object
12 13 14 |
# File 'lib/alexa-skill/intent_builder.rb', line 12 def slot(name, =[]) @slots[name] = end |
#utterance(value) ⇒ Object
24 25 26 |
# File 'lib/alexa-skill/intent_builder.rb', line 24 def utterance(value) @utterances << value end |