No commit activity in last 3 years
No release in over 3 years
Responds to an Alexa Skill request using Ruby scripts embedded in a kind of XML format
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.7, >= 0.7.1
 Project Readme

Introduing the Alexa_skillresponse gem

require 'alexa_skillresponse'

req =  {"version"=>"1.0", "session"=>{"new"=>true, "sessionId"=>"amzn1.echo-api.session.1", "application"=>{"applicationId"=>"amzn1.ask.skill.0"}, "user"=>{"userId"=>"amzn1.ask.account.I"}}, "context"=>{"System"=>{"application"=>{"applicationId"=>"amzn1.ask.skill.0"}, "user"=>{"userId"=>"amzn1.ask.account.I"}, "device"=>{"deviceId"=>"amzn1.ask.device.A", "supportedInterfaces"=>{}}, "apiEndpoint"=>"https://api.eu.amazonalexa.com", "apiAccessToken"=>"A"}}, "request"=>{"type"=>"LaunchRequest", "requestId"=>"amzn1.echo-api.request.a", "timestamp"=>"2018-07-10T19:42:52Z", "locale"=>"en-GB", "shouldLinkResultBeReturned"=>false}}

h = JSON.parse req.to_json, symbolize_names: true
asr = AlexaSkillResponse.new(package='/home/james/tmp/icecream.rsf', debug: true)
asr.run(h)

file: icecream.rsf

<skill>
  <response id='welcome' attentive='false'>
    <script>
    'How can I help you?'
    </script>
  </response>
  <response id='IcecreamAsk' attentive='true'>
    <script>
    'Would you like a cone or a tub?'
    </script>
  </response>
</skill>

Output:

=> {:version=>"1.0", :response=>{:outputSpeech=>{:type=>"PlainText", :text=>"How can I help you?"}, :shouldEndSession=>false}}

The Alexa_skillresponse gem can be used with any web framework to process a request from an Alexa Skill. It relies upon the logical responses to be found from a kind of XML file known as an RSF file.

Resources

alexa amazon response skill gem request