fine_ants 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/fine_ants/adapters/chase.rb +72 -0
- data/lib/fine_ants/adapters.rb +1 -0
- data/lib/fine_ants/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa66f515564aac911448db2c86e2657720b037ff
|
4
|
+
data.tar.gz: 2db921e79de8fb46b7f8c1321c2e12180c04c772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f0b77656425eabd3ce562f1c19f96cd32b98030a2bf4111b40965246a32c09b68194230e85afc26e1535d585e10a1cebe69321462a5c915774688e6433f13a
|
7
|
+
data.tar.gz: 27de194d5cfbca097eebd86926261d2f9b8a4d00abcfd42347de93fe5cf2abbe1955d374d6a416abe16763d7ccfc4340f5092859b60360a5939db781f9139c32
|
data/README.md
CHANGED
@@ -59,6 +59,8 @@ Right now, FineAnts ships with adapters for:
|
|
59
59
|
|
60
60
|
* [Vanguard Personal Investment](https://personal.vanguard.com/us/hnwnesc/nesc/LoginPage)
|
61
61
|
* [PNC Personal Banking](https://www.pnc.com/en/personal-banking.html)
|
62
|
+
* [Betterment](https://www.betterment.com)
|
63
|
+
* [Chase](https://www.chase.com)
|
62
64
|
|
63
65
|
You can also implement your own adapter and pass it to `FineAnts.download`. The
|
64
66
|
expected public contract of an adapter is:
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require "bigdecimal"
|
2
|
+
|
3
|
+
module FineAnts
|
4
|
+
module Adapters
|
5
|
+
class Chase
|
6
|
+
def initialize(credentials)
|
7
|
+
@user = credentials[:user]
|
8
|
+
@password = credentials[:password]
|
9
|
+
end
|
10
|
+
|
11
|
+
def login
|
12
|
+
visit "https://www.chase.com"
|
13
|
+
fill_in "User name", :with => @user
|
14
|
+
fill_in "Password", :with => @password
|
15
|
+
click_link "Sign in"
|
16
|
+
verify_login!
|
17
|
+
end
|
18
|
+
|
19
|
+
def logout
|
20
|
+
click_button "Sign out"
|
21
|
+
end
|
22
|
+
|
23
|
+
def download
|
24
|
+
# Select credit card
|
25
|
+
find("h3", text: "CREDIT CARDS")
|
26
|
+
.find(:xpath, "../..")
|
27
|
+
.find("section")
|
28
|
+
.first("div")
|
29
|
+
.click
|
30
|
+
|
31
|
+
credit_card_table = find("table.dl-box")
|
32
|
+
|
33
|
+
balance = credit_card_table.find("#accountCurrentBalance").text
|
34
|
+
available_balance = credit_card_table.find("#accountAvailableCreditBalance").text
|
35
|
+
next_due_date = credit_card_table.find("#nextPaymentDueDate").text
|
36
|
+
|
37
|
+
accounts = [
|
38
|
+
{
|
39
|
+
:adapter => :chase,
|
40
|
+
:user => @user,
|
41
|
+
:id => find(".ACTNAME").text,
|
42
|
+
:name => find(".ACTNAME").text,
|
43
|
+
:type => :credit_card,
|
44
|
+
:amount => -1 * parse_currency(balance),
|
45
|
+
:available_amount => parse_currency(available_balance),
|
46
|
+
:next_due_date => parse_due_date(next_due_date)
|
47
|
+
}
|
48
|
+
]
|
49
|
+
|
50
|
+
logout
|
51
|
+
accounts
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def parse_currency(currency_string)
|
57
|
+
BigDecimal.new(currency_string.match(/\$(.*)$/)[1].gsub(/,/,''))
|
58
|
+
end
|
59
|
+
|
60
|
+
def parse_due_date(due_date_string)
|
61
|
+
Date.strptime(due_date_string, "%b %d, %Y")
|
62
|
+
end
|
63
|
+
|
64
|
+
def verify_login!
|
65
|
+
find '[data-attr="LOGON_DETAILS.lastLogonDetailsLabel"]'
|
66
|
+
rescue Capybara::ElementNotFound
|
67
|
+
raise FineAnts::LoginFailedError.new
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
data/lib/fine_ants/adapters.rb
CHANGED
data/lib/fine_ants/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fine_ants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/fine_ants.rb
|
99
99
|
- lib/fine_ants/adapters.rb
|
100
100
|
- lib/fine_ants/adapters/betterment.rb
|
101
|
+
- lib/fine_ants/adapters/chase.rb
|
101
102
|
- lib/fine_ants/adapters/pnc.rb
|
102
103
|
- lib/fine_ants/adapters/vanguard.rb
|
103
104
|
- lib/fine_ants/capybara_setup.rb
|