Skip to content

Instantly share code, notes, and snippets.

View bleonard's full-sized avatar

Brian Leonard bleonard

View GitHub Profile
@bleonard
bleonard / .ruby-version
Last active August 29, 2015 14:22
Big Decimal
2.1.5
class SkillsController < ::ActionController::Base
def root
output = AlexaRubykit::Response.new
session_end = true
output.add_speech("Hello World")
render json: output.build_response(session_end)
end
end
{
"intents": [
{
"intent": "UserInput",
"slots": [
{
"name": "Generic",
"type": "AMAZON.LITERAL"
}
]
{
"intents": [
{
"intent": "AMAZON.YesIntent"
},
{
"intent": "AMAZON.NoIntent"
},
{
"intent": "AMAZON.CancelIntent"
require 'alexa_generator'
module Interactive
class AlexaModel
def self.get
@instance
end
def self.define(&block)
@instance = AlexaGenerator::InteractionModel.build do |model|
TaskPost {find me a handyman|Generic}
TaskPost {clean my house|Generic}
... many, many things here ...
TaskPost {wait in line|Generic}
TaskPost {ScheduleDate}
TaskPost {ScheduleDate} at {ScheduleTime}
TaskPost {ScheduleDate} {ScheduleTime}
TaskPost {ScheduleTime}
TaskPost {ScheduleTime} {ScheduleDate}
class SkillsController < ::ActionController::Base
def root
input = AlexaRubykit.build_request(params)
output = AlexaRubykit::Response.new
session_end = true
message = "There was an error." # unknown thing happened
case input.type
when "LAUNCH_REQUEST"
# user talked to our skill but did not say something matching intent
class SkillsController < ::ActionController::Base
def root
input = AlexaRubykit.build_request(params)
output = AlexaRubykit::Response.new
session_end = false # probably going to keep going
message = "There was an error." # unknown thing happened
session = Session.find_or_initialize_by(session_id: input.session.session_id)
case input.type
when "LAUNCH_REQUEST"
// name the test something relevant
it("should create a new post", function* (driver, done) {
// stub the fetch request to get the initial lists of posts with commonly used json
server.get("/api/posts/tester", fixtures.home());
// stub creation and set expectations of endpoint to create new post
server.post("/api/posts",
{id: 100, content: 'new post here', username: 'tester'}, // return this content
{content: 'new post here'} // expect this content
);
To rewrite, or not to rewrite- that is the question:
Whether 'tis better for the product to suffer
The features and debt of outrageous history
Or to once again battle a sea of edge cases,
And by forgetting relive them. To wish- to hope-
No more; and by hope to say we end
The heartache, and the thousand unnatural cases
That code can error to. 'Tis a codebase
Devoutly to be wish'd. To wish- to hope.
To hope- perchance to rebuild: ay, there's the rub!