pedro (owner)

Revisions

gist: 137834 Download_button fork
public
Public Clone URL: git://gist.github.com/137834.git
Ruby
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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