Skip to content

Instantly share code, notes, and snippets.

@iconnor
Created September 15, 2012 13:37
Show Gist options
  • Save iconnor/3727941 to your computer and use it in GitHub Desktop.
Save iconnor/3727941 to your computer and use it in GitHub Desktop.
Script to get account balance from Delta Sky Miles
require 'mechanize'
#Usage: ruby -rubygems skymiles.rb 123456789 1234 smith
acct = ARGV[0]
pin = ARGV[1]
lastName = ARGV[2]
@agent = Mechanize.new
page = @agent.get("http://www.delta.com/skymiles/manage_account/index.jsp")
form = page.form("smlogin_login")
form.acct = acct
form.pin = pin
form.lastName = lastName
page2 = form.submit
miles = page2.at("#smMiles").inner_text.strip
puts "You have #{miles}"
@iconnor
Copy link
Author

iconnor commented Sep 15, 2012

© 2012 Ian Connor - may be used by anyone except Delta Air Lines or their lawyers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment