Class: AlexaToolbox::Context
- Inherits:
-
Object
- Object
- AlexaToolbox::Context
- Defined in:
- lib/alexa_toolbox/context.rb
Overview
Handles the session object in requests.
Instance Attribute Summary collapse
-
#audioplayer ⇒ Object
readonly
Returns the value of attribute audioplayer.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#system ⇒ Object
readonly
Returns the value of attribute system.
Instance Method Summary collapse
- #application_id ⇒ Object
- #device_id ⇒ Object
-
#initialize(context) ⇒ Context
constructor
A new instance of Context.
- #user_id ⇒ Object
Constructor Details
#initialize(context) ⇒ Context
Returns a new instance of Context.
7 8 9 10 11 |
# File 'lib/alexa_toolbox/context.rb', line 7 def initialize (context) @system = context.key?(:System) ? context[:System] : "" @audioplayer = context.key?(:AudioPlayer) ? AlexaToolbox::AudioPlayer.new(context[:AudioPlayer]) : nil @json = context end |
Instance Attribute Details
#audioplayer ⇒ Object (readonly)
Returns the value of attribute audioplayer.
5 6 7 |
# File 'lib/alexa_toolbox/context.rb', line 5 def audioplayer @audioplayer end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
5 6 7 |
# File 'lib/alexa_toolbox/context.rb', line 5 def json @json end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
5 6 7 |
# File 'lib/alexa_toolbox/context.rb', line 5 def system @system end |
Instance Method Details
#application_id ⇒ Object
13 14 15 |
# File 'lib/alexa_toolbox/context.rb', line 13 def application_id return self.system[:application][:applicationId] end |
#device_id ⇒ Object
21 22 23 |
# File 'lib/alexa_toolbox/context.rb', line 21 def device_id return self.system[:device][:deviceId] end |
#user_id ⇒ Object
17 18 19 |
# File 'lib/alexa_toolbox/context.rb', line 17 def user_id return self.system[:user][:userId] end |