Skip to content

Instantly share code, notes, and snippets.

@maxwellE
Created October 4, 2012 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxwellE/3831323 to your computer and use it in GitHub Desktop.
Save maxwellE/3831323 to your computer and use it in GitHub Desktop.
Automated Twillio RubyConf ticket avaliability checker
require 'mechanize'
require 'twilio-ruby'
# Need to save a file with the html body to refer to later in the script since this is run
# in a cron job.
if File.exists?("rubyregistration.html")
body = File.read("rubyregistration.html")
else
File.open("rubyregistration.html","w+") do |file|
file.puts Mechanize.new.get("https://rubyconf2012.busyconf.com/bookings/new").search("/html/body/div/div/div/div[2]").inner_html
end
body = File.read("rubyregistration.html")
end
account_sid = 'YOUR ACCOUNT SID'
auth_token = 'AUTH TOKEN'
current_body = Mechanize.new.get("https://rubyconf2012.busyconf.com/bookings/new").search("/html/body/div/div/div/div[2]").inner_html
if current_body != body
@client = Twilio::REST::Client.new account_sid, auth_token
@client.account.sms.messages.create(
:from => 'FROM_NUM',
:to => 'CALL_NUM',
:body => 'RubyConf Tickets are ready right now!!!!!'
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment