Class: AlexaRuby::Context
- Inherits:
-
Object
- Object
- AlexaRuby::Context
- Defined in:
- lib/alexa_ruby/request/base_request/context.rb
Overview
Amazon Alexa request context - application, user and device info
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
readonly
Returns the value of attribute api_endpoint.
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#audio_state ⇒ Object
readonly
Returns the value of attribute audio_state.
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(context) ⇒ Context
constructor
Initialize new Context object.
Constructor Details
#initialize(context) ⇒ Context
Initialize new Context object
10 11 12 13 14 15 16 17 18 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 10 def initialize(context) @app_id = get_app_id(context[:System][:application]) raise ArgumentError, 'Missing application ID' unless @app_id @user = load_user(context[:System][:user]) @device = load_device(context[:System][:device]) @api_endpoint = context[:System][:apiEndpoint] @audio_state = load_audio_state(context[:AudioPlayer]) end |
Instance Attribute Details
#api_endpoint ⇒ Object (readonly)
Returns the value of attribute api_endpoint.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 4 def api_endpoint @api_endpoint end |
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 4 def app_id @app_id end |
#audio_state ⇒ Object (readonly)
Returns the value of attribute audio_state.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 4 def audio_state @audio_state end |
#device ⇒ Object (readonly)
Returns the value of attribute device.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 4 def device @device end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/alexa_ruby/request/base_request/context.rb', line 4 def user @user end |