Module: ActionAlexa::RequestPayload::Session

Included in:
AlexaRequest
Defined in:
lib/action_alexa/request_payload/session.rb

Overview

Session compontent of the JSON blob from the Alexa request TO the application. This module contains utility methods to access the attributes

Instance Method Summary collapse

Instance Method Details

#access_tokenObject



28
29
30
# File 'lib/action_alexa/request_payload/session.rb', line 28

def access_token
  session_payload['user']['accessToken']
end

#application_idObject



16
17
18
# File 'lib/action_alexa/request_payload/session.rb', line 16

def application_id
  session_payload['application']['applicationId']
end

#new?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/action_alexa/request_payload/session.rb', line 8

def new?
  session_payload.key?('new') && session_payload['new']
end

#session_idObject



12
13
14
# File 'lib/action_alexa/request_payload/session.rb', line 12

def session_id
  session_payload['sessionId']
end

#user_access_token_present?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/action_alexa/request_payload/session.rb', line 24

def user_access_token_present?
  session_payload['user'].key?('accessToken')
end

#user_idObject



20
21
22
# File 'lib/action_alexa/request_payload/session.rb', line 20

def user_id
  session_payload['user']['userId']
end