tsrivishnu / alexa-rails Goto Github PK
View Code? Open in Web Editor NEWMake your Rails app serve Amazon Alexa skill requests
License: MIT License
Make your Rails app serve Amazon Alexa skill requests
License: MIT License
To keep it consistent, the view files, both speech.ssml.erb
and display.text.erb
can be renamed to default.ssml.erb
and default.text.erb
it should be able to work with database adapter from the project that it is included it.
Request locale gives the language and country code. At the moment, Alexa::Context
doesn't provide an interface to determine those individually. It woudl be nice to have the method #country_code
and #language_code
.
Refer documentation at https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html#request-locale
Delegate and all other kind of Responses are to be sharing common implementation through a base class.
alexa-rails
from alexa
.Cancel
, Stop
, Help
etc..Right now, by returning response
in an intent handler renders the default speech.ssml.erb
and display.text.erb
. These files need to handle all the different conditions if the response needs to be different for different conditions. This will pollute the view file with some if clauses and sharing variables from intent. For example. Consider the following:
# Intent handler class
class Alexa::IntentHandlers::SaveBookmark < Alexa::IntentHandlers::Base
attr_accessor :success
def handle
if some_condition
@sucess = true
else
@success = false
end
return response
end
end
# View - intent_handlers/save_bookmarks/speech.ssml.erb
<% if intent.success %>
<s> You request is successfully processed. </s>
<% else %>
<s>Unable to process your request.</s>
<% end %>
It would be nice if a the response
method on intent handlers can accept the response filename argument so that there can be multiple view files for conditions.
In above example.
# Intent handler
def handle
if some_condition
@sucess = true
return response(view_file: :success)
else
@success = false
return response(view_file: :failure)
end
end
# View - intent_handlers/save_bookmarks/success.ssml.erb
<s> You request is successfully processed. </s>
# View - intent_handlers/save_bookmarks/success.text.erb
Succesfull.
# View - intent_handlers/save_bookmarks/failure.ssml.erb
<s> You request couldn't be processed. </s>
# View - intent_handlers/save_bookmarks/failure.text.erb
Failed. Sorry!
Howdy! I've been updating this library to get it functional with the latest API's in our fork. If you're still maintaining or using this library, I'd be happy to split them up into PR's and send them back your way.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.