class Dinero::Bank::Sdccu
San Diego County Credit Union
Constants
- ACCOUNTS_SUMMARY_PATH
- CONNECTION_TIMEOUT
- LOGIN_URL
Public Instance Methods
account_rows(table, type)
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 84 def account_rows table, type rows = table.xpath(".//tr").map{|m| m.xpath(".//td").map{|m| m.text.strip}} rows.select{|s| s.size == 7}.map{|m| m.reject(&:empty?) << type} end
account_table_rows()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 89 def account_table_rows account_rows(bank_accounts_table, :bank) + account_rows(loan_accounts_table, :loan) end
account_tables()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 72 def account_tables accounts_summary_document.xpath("//div[@id='accountBalancesContainer_accountBalancesModule_accountList']//table") end
accounts()
click to toggle source
extract account data from the account summary page
# File lib/dinero/banks/sdccu.rb, line 94 def accounts return @accounts if @accounts @accounts = account_table_rows.map do |row| acct_type = row.pop number = row.shift name = row.shift balance = row.shift.scan(NUMERIC_REGEXP).join available = acct_type == :loan ? "0.0" : balance Account.new(acct_type, name, number, balance, available) end end
after_successful_login()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 57 def after_successful_login # the subdomain frequently changes, so capture the actual URL # so we can return to the page if necessary. @accounts_summary_url = connection.current_url end
bank_accounts_table()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 76 def bank_accounts_table account_tables[0] end
default_options()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 9 def default_options { timeout: CONNECTION_TIMEOUT, login_url: LOGIN_URL } end
goto_accounts_summary_page()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 67 def goto_accounts_summary_page return if authenticated? && on_accounts_summary_page? authenticated? ? connection.navigate.to(@accounts_summary_url) : login! end
loan_accounts_table()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 80 def loan_accounts_table account_tables[1] end
on_accounts_summary_page?()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 63 def on_accounts_summary_page? connection.page_source =~ /Account Balances/ end
post_credentials!()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 51 def post_credentials! post_username! post_password! post_security_answer! end
post_password!()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 24 def post_password! screenshot_on_error do wait.until { connection.find_element(id: "ctlSignon_txtPassword") } password_field = connection.find_element(id: "ctlSignon_txtPassword") password_field.send_keys password login_btn = connection.find_element(id: "ctlSignon_btnLogin") login_btn.click end end
post_security_answer!()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 36 def post_security_answer! return if on_accounts_summary_page? screenshot_on_error do wait.until { connection.find_element(id: "lblChallengeQuestion") } question_text = connection.find_element(id: "lblChallengeQuestion").text answer = find_answer question_text answer_field = connection.find_element(id: "txtAnswer") answer_field.send_keys answer submit_button = connection.find_element(id:"btnSubmitAnswer") submit_button.click end end
post_username!()
click to toggle source
# File lib/dinero/banks/sdccu.rb, line 13 def post_username! screenshot_on_error do wait.until { connection.find_element(id: "ctlSignon_txtUserID") } username_field = connection.find_element(id: "ctlSignon_txtUserID") username_field.send_keys username submit_button = connection.find_element(id: "ctlSignon_btnNext") submit_button.click end end