Class: ActionAlexa::Response

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeResponse

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(message, overrides = {})
  @payload[:response].merge!(
    outputSpeech: {
      type: 'PlainText',
      text: message
    },
    shouldEndSession: overrides.fetch(:should_end_session, true)
  )

   if (overrides)

  @payload
end


26
27
28
29
30
31
32
# File 'lib/action_alexa/response.rb', line 26

def 
  @payload[:response].merge!(
    card: { type: 'LinkAccount' }
  )

  self
end