Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (34 sloc) 2.31 KB
require "rubygems"
require "sinatra"
require "smsified"
get '/' do
'<html><head><style type="text/css"> body { background: url("/speech-bubble.jpg"); background-repeat:no-repeat; background-color: #124D9D; margin: 100 100px; font-size:large; }</style></head><body><h1>Welcome to the SMS Bar!</h1><p>You can now send SMS messages from your web browser\'s address bar using the following format:</p><p>http://smsbar.heroku.com/username/password/smsified_number/to_mobile_number/encoded+message</p><br/><p>Powered by <br/><a href="http://smsified.com"><img src="/header-logo.png"></a></p></body></html>'
end
get '/:username/:password/:from/:to/:message' do
begin
oneapi = Smsified::OneAPI.new :username => params[:username],
:password => params[:password]
oneapi.send_sms :address => params[:to],
:message => params[:message] + " via SMSified.com",
:sender_address => params[:from]
'<html><head><style type="text/css"> body { background: url("/speech-bubble.jpg"); background-repeat:no-repeat; background-color: #124D9D; margin: 100 100px; font-size:large; }</style></head><body><h1>Yay! Message sent to ' + params[:to] + '</h1><p><a href="\">Go back</a></p><br/><p>Powered by <br/><a href="http://smsified.com"><img src="/header-logo.png"></a></p></body></html>'
rescue => error
"Sad panda error message goes here - your SMS did not get delivered :("
end
end
# get '/:to/:message' do
# begin
#
# oneapi = Smsified::OneAPI.new :username => 'smsbar',
# :password => 'secret'
#
# oneapi.send_sms :address => params[:to],
# :message => params[:message] + " via SMSified.com",
# :sender_address => '4433058582'
#
# '<html><head><style type="text/css"> body { background: url("/speech-bubble.jpg"); background-repeat:no-repeat; background-color: #124D9D; margin: 100 100px; font-size:large; }</style></head><body><h1>Yay! Message sent to ' + params[:to] + '</h1><p><a href="\">Go back</a></p><br/><p>Powered by <br/><a href="http://smsified.com"><img src="/header-logo.png"></a></p></body></html>'
#
# rescue => error
# "Sad panda error message goes here - your SMS did not get delivered :("
# end
# end