Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (30 sloc) 1.174 kB
6676f5b Added new app
Your Name authored
1 require "google_spreadsheet"
2 require "sinatra"
3 require "json"
4 require "smsified"
5
6 post '/' do
7 response = JSON.parse(request.env["rack.input"].read)
8
9 message = response["inboundSMSMessageNotification"]["inboundSMSMessage"]["message"]
10 callerID = response["inboundSMSMessageNotification"]["inboundSMSMessage"]["senderAddress"]
11 trigger = message[0..1]
12 datetime = message[3..message.length]
13
14 if trigger == "Go"
15
16 smsified = Smsified::OneAPI.new(:username => 'sms_user', :password => 'sms_pass')
17 oneapi.send_sms :sender_address => '13215550100', :address => ['14075550100', '19545550100', '13055550100'], :message => "Can you make it to the game on #{datetime}?"
18
19 else
20 session = GoogleSpreadsheet.login("goog_user", "goog_pass")
21 ws = session.spreadsheet_by_key("YOUR_SPREADSHEET_KEY").worksheets[0]
22
23 if callerID == "tel:+14075550100"
24 ws[2, 1] = message
25 ws.save()
26 elsif callerID == "tel:+19545550100"
27 ws[2, 2] = message
28 ws.save()
29 elsif callerID == "tel:+13055550100"
30 ws[2, 3] = message
31 ws.save()
32 else
33 p "Not on the list"
34 end
35
36 end
37
38 end
Something went wrong with that request. Please try again.