Class: Alexa::IntentHandlersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Alexa::IntentHandlersController
- Includes:
- ContextHelper, RenderHelper
- Defined in:
- app/controllers/alexa/intent_handlers_controller.rb
Instance Method Summary collapse
Methods included from RenderHelper
Methods included from ContextHelper
#alexa_context, #alexa_request, #alexa_response, #alexa_response=, #context_alexa_user
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/alexa/intent_handlers_controller.rb', line 9 def create @resp = nil if alexa_request.valid? if alexa_request.intent_request? case alexa_request.intent_name when 'AMAZON.CancelIntent' @resp = Alexa::IntentHandlers::GoodBye.new(alexa_context).handle when 'AMAZON.StopIntent' @resp = Alexa::IntentHandlers::GoodBye.new(alexa_context).handle when 'AMAZON.HelpIntent' @resp = Alexa::IntentHandlers::Help.new(alexa_context).handle else @resp = "Alexa::IntentHandlers::#{alexa_request.intent_name}" .constantize .new(alexa_context) .handle end elsif alexa_request.launch_request? @resp = Alexa::IntentHandlers::LaunchApp.new(alexa_context).handle elsif alexa_request.session_ended_request? @resp = Alexa::IntentHandlers::SessionEnd.new(alexa_context).handle end end alexa_response = @resp respond_for_alexa_with(alexa_response) end |