Class: BetterAlexaRubyKit::Request
- Inherits:
-
Object
- Object
- BetterAlexaRubyKit::Request
- Defined in:
- lib/better_alexa_rubykit/request.rb
Overview
-
SessionEndedRequest: Session has ended.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#json ⇒ Object
global.
-
#locale ⇒ Object
on request.
-
#request_id ⇒ Object
on request.
-
#session ⇒ Object
global.
-
#type ⇒ Object
global.
-
#version ⇒ Object
global.
Instance Method Summary collapse
-
#initialize(json_request) ⇒ Request
constructor
A new instance of Request.
- #intent_name ⇒ Object
Constructor Details
#initialize(json_request) ⇒ Request
Returns a new instance of Request.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/better_alexa_rubykit/request.rb', line 12 def initialize(json_request) @request_id = json_request['request']['requestId'] raise ArgumentError, 'Request ID should exist on all Requests' if @request_id.nil? @version = json_request['version'] @locale = json_request['request']['locale'] @json = json_request # TODO: We probably need better session handling. @session = BetterAlexaRubyKit::Session.new(json_request['session']) end |
Instance Attribute Details
#json ⇒ Object
global
9 10 11 |
# File 'lib/better_alexa_rubykit/request.rb', line 9 def json @json end |
#locale ⇒ Object
on request
10 11 12 |
# File 'lib/better_alexa_rubykit/request.rb', line 10 def locale @locale end |
#request_id ⇒ Object
on request
10 11 12 |
# File 'lib/better_alexa_rubykit/request.rb', line 10 def request_id @request_id end |
#session ⇒ Object
global
9 10 11 |
# File 'lib/better_alexa_rubykit/request.rb', line 9 def session @session end |
#type ⇒ Object
global
9 10 11 |
# File 'lib/better_alexa_rubykit/request.rb', line 9 def type @type end |
#version ⇒ Object
global
9 10 11 |
# File 'lib/better_alexa_rubykit/request.rb', line 9 def version @version end |
Instance Method Details
#intent_name ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/better_alexa_rubykit/request.rb', line 23 def intent_name if type == "LAUNCH_REQUEST" return 'LaunchRequest' elsif type == 'INTENT_REQUEST' return name else return 'SessionEndedRequest' end end |