Class: AlexaRuby::Session
- Inherits:
-
Object
- Object
- AlexaRuby::Session
- Defined in:
- lib/alexa_ruby/request/base_request/session.rb
Overview
Amazon Alexa user session
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#end_reason ⇒ Object
Returns the value of attribute end_reason.
-
#error ⇒ Object
Returns the value of attribute error.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#state ⇒ Object
Returns the value of attribute state.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(session) ⇒ Session
constructor
Initialize new Session.
Constructor Details
#initialize(session) ⇒ Session
Initialize new Session
11 12 13 14 15 16 17 18 19 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 11 def initialize(session) @session = session raise ArgumentError, 'Empty user session' if invalid_session? @state = @session[:new] ? :new : :old @id = @session[:sessionId] @attributes = @session[:attributes] || {} @user = load_user unless @session[:user].nil? end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 4 def attributes @attributes end |
#end_reason ⇒ Object
Returns the value of attribute end_reason.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 4 def end_reason @end_reason end |
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 4 def error @error end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 4 def id @id end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 5 def state @state end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/session.rb', line 4 def user @user end |