ok excuses work
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -2,4 +2,5 @@
|
||||
source "https://rubygems.org"
|
||||
gem 'alexa_skills_ruby'
|
||||
gem 'sinatra'
|
||||
gem 'nokogiri'
|
||||
# gem "rails"
|
||||
|
||||
@@ -11,8 +11,11 @@ GEM
|
||||
multi_json (~> 1.0)
|
||||
concurrent-ruby (1.0.2)
|
||||
i18n (0.7.0)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.10.1)
|
||||
multi_json (1.12.1)
|
||||
nokogiri (1.6.7.2-x64-mingw32)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
rack (1.6.5)
|
||||
rack-protection (1.5.3)
|
||||
rack
|
||||
@@ -30,6 +33,7 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
alexa_skills_ruby
|
||||
nokogiri
|
||||
sinatra
|
||||
|
||||
BUNDLED WITH
|
||||
|
||||
19
app.rb
19
app.rb
@@ -1,16 +1,26 @@
|
||||
require 'sinatra'
|
||||
require 'alexa_skills_ruby'
|
||||
require 'rubygems'
|
||||
require 'nokogiri'
|
||||
require 'open-uri'
|
||||
|
||||
class CustomHandler < AlexaSkillsRuby::Handler
|
||||
|
||||
on_intent("GetDeveloperExcuse") do
|
||||
response.set_output_speech_text("Developer Excuses yo")
|
||||
response.set_output_speech_text(get_excuse)
|
||||
end
|
||||
|
||||
end
|
||||
get '/livecheck' do
|
||||
"hello"
|
||||
end
|
||||
|
||||
get '/excuse' do
|
||||
get_excuse
|
||||
end
|
||||
|
||||
|
||||
|
||||
post '/' do
|
||||
content_type :json
|
||||
|
||||
@@ -23,4 +33,9 @@ post '/' do
|
||||
403
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def get_excuse
|
||||
page = Nokogiri::HTML(open("http://programmingexcuses.com/"))
|
||||
page.css("a").text
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user