Automatic Bank Balance Checking at WaMu
This requires WWW::Mechanize, but it works quite well.
1 2 require 'rubygems' 3 require 'mechanize' 4 5 agent = WWW::Mechanize.new 6 7 # login to the account 8 puts "Login" 9 page = agent.get('https://online.wamu.com/IdentityManagement/Logon.aspx') 10 login_form = page.forms.with.name("frmLogin").first 11 login_form.txtUserID = '<UNAME>' 12 login_form.password = '<PWD>' 13 page = agent.submit(login_form, login_form.buttons.first) 14 15 # click on the download button 16 puts "Download" 17 dl_link = page.links.with.text(/WAMU FREE CHECKING/) 18 page = agent.click(dl_link) 19 20 line_items = [] 21 22 trs = (page/"table#_ctl0_depositTransactionsGrid/tr") 23 trs.shift 24 trs.each do |tr| 25 tds = (tr/:td) 26 27 dtd = tds[1].inner_html 28 js_call = dtd.match(/showDDATransactionDetails\('(.*)'\);/)[1] 29 js_fields = js_call.split("','") 30 31 item = {} 32 item['type'] = js_fields[1] 33 item['descr'] = js_fields[3] 34 item['amount'] = js_fields[4] 35 item['tranid'] = js_fields[6] 36 # if !tranid = ovedraft charge / bank fee 37 38 item['date'] = tds[0].inner_html 39 item['debit'] = tds[3].inner_html 40 item['credit'] = tds[4].inner_html 41 item['balance'] = tds[5].inner_html 42 43 line_items << item 44 end 45 46 pp line_items.first