Skip to content

Instantly share code, notes, and snippets.

@leereilly
Forked from maxwellE/rbconf.rb
Created October 4, 2012 03:44
Show Gist options
  • Save leereilly/3831359 to your computer and use it in GitHub Desktop.
Save leereilly/3831359 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