Class: Dinero::Bank::GeorgiasOwn

Inherits:
Base
  • Object
show all
Defined in:
lib/dinero/banks/georgias_own.rb

Overview

San Diego County Credit Union

Constant Summary collapse

LOGIN_URL =
"https://www.georgiasown.org/index"
ACCOUNTS_SUMMARY_PATH =
"https://online.georgiasown.org/DashboardV2"
CONNECTION_TIMEOUT =
20

Instance Attribute Summary

Attributes inherited from Base

#login_url, #password, #security_questions, #timeout, #username

Instance Method Summary collapse

Methods inherited from Base

#accounts_summary_document, #authenticated?, #class_name, #connection, #establish_connection, #find_answer, #goto_login_page, #initialize, #login!, #screenshot_on_error, #snap, #validate!, #wait

Constructor Details

This class inherits a constructor from Dinero::Bank::Base

Instance Method Details

#account_table_rowsObject



76
77
78
79
# File 'lib/dinero/banks/georgias_own.rb', line 76

def 
  items = accounts_summary_document.xpath("//div[@id='module_accounts']//ul/li")
  items.select{|s| s.attributes["data-is-external-account"]}
end

#accountsObject

extract account data from the account summary page



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/dinero/banks/georgias_own.rb', line 82

def accounts
  return @accounts if @accounts

  @accounts = .map do |row|
    acct_type = :bank
    name = row.xpath(".//h4").text
    number = row.xpath(".//span[@class='account-number truncate']").text.strip

    amount = row.xpath(".//span[@class='bal available']").text
    balance = amount.strip.scan(NUMERIC_REGEXP).join
    available = balance

    Account.new(acct_type, name, number, balance, available)
  end
end

#after_successful_loginObject



61
62
63
64
65
# File 'lib/dinero/banks/georgias_own.rb', line 61

def 
  # 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

#default_optionsObject



9
10
11
# File 'lib/dinero/banks/georgias_own.rb', line 9

def default_options
  { timeout: CONNECTION_TIMEOUT, login_url: LOGIN_URL }
end

#goto_accounts_summary_pageObject



71
72
73
74
# File 'lib/dinero/banks/georgias_own.rb', line 71

def goto_accounts_summary_page
  return if authenticated? && on_accounts_summary_page?
  authenticated? ? connection.navigate.to(@accounts_summary_url) : login!
end

#on_accounts_summary_page?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/dinero/banks/georgias_own.rb', line 67

def on_accounts_summary_page?
  connection.page_source =~ /My Accounts/
end

#post_credentials!Object



54
55
56
57
58
59
# File 'lib/dinero/banks/georgias_own.rb', line 54

def post_credentials!
  post_username!
  # post_security_answer!
  post_password!
  wait.until { connection.find_elements(xpath: "//div[@id='module_accounts']//ul/li").size > 0 }
end

#post_password!Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dinero/banks/georgias_own.rb', line 26

def post_password!
  screenshot_on_error do
    wait.until { connection.find_element(id: "content") }
    form = connection.find_element(id: "content")

    password_field = form.find_element(id: "Password")
    password_field.send_keys password

     = form.find_element(xpath: ".//input[@type='submit']")
    .click
  end
end

#post_security_answer!Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/dinero/banks/georgias_own.rb', line 39

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: "QuestionAnswer")
  #   answer_field.send_keys answer
  #
  #   submit_button = logon_form.find_element(id:"btnSubmitAnswer")
  #   submit_button.click
  # end
end

#post_username!Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dinero/banks/georgias_own.rb', line 13

def post_username!
  screenshot_on_error do
    wait.until { connection.find_element(id: "login") }
     = connection.find_element(id: "login")

    username_field = .find_element(name: "UserName")
    username_field.send_keys username

    submit_button = .find_element(xpath: ".//input[@type='submit']")
    submit_button.click
  end
end