Skip to content

Instantly share code, notes, and snippets.

@wstrinz
Last active December 31, 2015 02:48
Show Gist options
  • Save wstrinz/7922812 to your computer and use it in GitHub Desktop.
Save wstrinz/7922812 to your computer and use it in GitHub Desktop.
require 'mechanize'
name = ARGV[0] # Email or Card Number
pass = ARGV[1] # Password
agent = Mechanize.new
login = agent.get 'http://colectivocoffee.com/loyalty/member-login/'
form = login.forms.first
form.email_number = name
form.loyaltylogin_pass = pass
member_page = agent.submit form, form.buttons.first
points, dollars = %w{lpoint-total lpoint-cash-total}.map{ |selector|
member_page.search("span[class=#{selector}]").first.children.first.content
}
puts "#{name} has #{points} points, worth $#{dollars}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment