Class: Banks::BankOfAmerica
Overview
Note: If you are running the script for the first time, you need to go online
and validate your computer by answering security questions.
TODO: Ask the user to enter security questions.
Instance Method Summary collapse
-
#get_data(user, password) ⇒ Object
Returns all accounts with all transactions.
Instance Method Details
#get_data(user, password) ⇒ Object
Returns all accounts with all transactions. Currently supports Credit and Debit accounts.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/banks/bofa.rb', line 8 def get_data (user, password) # Connect browser = ::Watir::Browser.new #:"phantomjs" browser.goto 'http://bankofamerica.com' browser.text_field(:id => 'onlineId1').set user browser.text_field(:id => 'passcode1').set password browser.(:id => 'hp-sign-in-btn').click # Wait until logged in. # Watir wait did not work on Windows, so we do a hack. # http://watirwebdriver.com/waiting/ # http://stackoverflow.com/questions/3504322/watir-webdriver-wait-for-page-load until browser.ul(:class=>"AccountItems").exists? do sleep 1 end # Get accounts accounts = get_accounts browser.html accounts.each do |account| browser.goto "https://secure.bankofamerica.com" + account.link transactions = nil if account.type == Account::DEBIT transactions = get_debit_transactions browser.html elsif account.type == Account::CREDIT transactions = get_credit_transactions browser end account.transactions = transactions end # Clean-up browser.close # Return accounts. accounts end |