Skip to content

Instantly share code, notes, and snippets.

@pedro
Forked from mortenbagai/gist:137810
Created June 29, 2009 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedro/137834 to your computer and use it in GitHub Desktop.
Save pedro/137834 to your computer and use it in GitHub Desktop.
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