require 'sinatra' | |
require 'builder' | |
def home | |
content_type 'text/xml', :charset => 'utf-8' | |
builder do |xml| | |
xml.instruct! | |
xml.Response do | |
xml.Gather("numDigits" => "1", "action" => "press", "method" => "POST") do | |
xml.Say "For a good time, press 1" | |
end | |
end | |
end | |
end | |
post '/' do | |
home | |
end | |
post '/press' do | |
digits = params[:digits] | |
if digits != '1' | |
puts "DIGITS = #{digits}" | |
home | |
else | |
content_type 'text/xml', :charset => 'utf-8' | |
builder do |xml| | |
xml.instruct! | |
xml.Response do | |
xml.Say("You pressed #{digits}") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment