Class: Dinero::Bank::GeorgiasOwn
- Inherits:
-
Base
- Object
- Base
- Dinero::Bank::GeorgiasOwn
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
Instance Method Details
#account_table_rows ⇒ Object
76
77
78
79
|
# File 'lib/dinero/banks/georgias_own.rb', line 76
def account_table_rows
items = accounts_summary_document.xpath("//div[@id='module_accounts']//ul/li")
items.select{|s| s.attributes["data-is-external-account"]}
end
|
#accounts ⇒ Object
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 = account_table_rows.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_login ⇒ Object
61
62
63
64
65
|
# File 'lib/dinero/banks/georgias_own.rb', line 61
def after_successful_login
@accounts_summary_url = connection.current_url
end
|
#default_options ⇒ Object
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_page ⇒ Object
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
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_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
login_btn = form.find_element(xpath: ".//input[@type='submit']")
login_btn.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!
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") }
login_area = connection.find_element(id: "login")
username_field = login_area.find_element(name: "UserName")
username_field.send_keys username
submit_button = login_area.find_element(xpath: ".//input[@type='submit']")
submit_button.click
end
end
|