Created
January 11, 2011 14:44
-
-
Save tjl2/774491 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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