class ActionAlexa::Response

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

Constants

VERSION

Public Class Methods

new() click to toggle source
# File lib/action_alexa/response.rb, line 8
def initialize
  @payload = default_payload
end

Public Instance Methods

say(message, overrides = {}) click to toggle source
# 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)
  )

  with_link_account_card if link_account_card?(overrides)

  @payload
end

Private Instance Methods

default_payload() click to toggle source
# File lib/action_alexa/response.rb, line 40
def default_payload
  {
    version: VERSION,
    response: {},
    sessionAttributes: {}
  }
end