Skip to content

Instantly share code, notes, and snippets.

@tjl2
Created January 11, 2011 14:44
Show Gist options
  • Save tjl2/774491 to your computer and use it in GitHub Desktop.
Save tjl2/774491 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
require "mechanize"
def growl(title, message)
ENV['title'] = title
ENV['message'] = message
%x(/usr/local/bin/growlnotify "\$title" -m"\$message")
end
Mechanize.new do |agent|
page = agent.get('https://www.btopenzone.com:8443/en/wpb?wpb=sbux_loyalty')
if page.title != "Free Wi-Fi with Starbucks Card Rewards"
growl('Logging in to BTOpenzone failed', 'Starbucks rewards not available.')
exit
end
form = page.form('authenticateForm')
form.username = '**USERNAME**'
form.password = '**PASSWORD**'
form.checkbox_with(:name => 'isTermsAccepted').check
agent.submit(form, form.buttons.first)
growl('Logged in to BTOpenzone', 'Using StarBucks card info.')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment