Class: ActionAlexa::Response
- Inherits:
-
Object
- Object
- ActionAlexa::Response
- Defined in:
- lib/action_alexa/response.rb
Overview
The return values from this class will go to the Alexa service and let the Alexa device announce the statements provided. There are hooks to onboard and send user cards to the end user accounts
Constant Summary collapse
- VERSION =
'1.0'.freeze
Instance Method Summary collapse
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #say(message, overrides = {}) ⇒ Object
- #with_link_account_card ⇒ Object
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
8 9 10 |
# File 'lib/action_alexa/response.rb', line 8 def initialize @payload = default_payload end |
Instance Method Details
#say(message, overrides = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/action_alexa/response.rb', line 12 def say(, overrides = {}) @payload[:response].merge!( outputSpeech: { type: 'PlainText', text: }, shouldEndSession: overrides.fetch(:should_end_session, true) ) with_link_account_card if link_account_card?(overrides) @payload end |
#with_link_account_card ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/action_alexa/response.rb', line 26 def with_link_account_card @payload[:response].merge!( card: { type: 'LinkAccount' } ) self end |