fine_ants 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/fine_ants/adapters/amex.rb +57 -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: 93f5d15f0956372b0b8a42a5795f2db70f78338e
|
4
|
+
data.tar.gz: b82758ebec062d8146f7b57787e2d587f8bb45c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff28856051092d04aebf6209b519cc0dbaf70278688ee0ef35d1a25917ce41a1baa2dbb2b7edddd99828d04c179b7ec20531f09d7f5c26d00f3c17454f7f6fe1
|
7
|
+
data.tar.gz: d88e0c3c99362b1bac8b483d0f34b435e60368ee7bbef26172d03f9dc791227c60fc361962d02e70dc245221231d135eba3e16c8b027e92d263d14884342470d
|
data/README.md
CHANGED
@@ -64,6 +64,7 @@ Right now, FineAnts ships with adapters for:
|
|
64
64
|
| [Betterment](https://www.betterment.com) | `:betterment` |
|
65
65
|
| [E*Trade](https://www.etrade.com) | `:etrade` |
|
66
66
|
| [Chase](https://www.chase.com) | `:chase` |
|
67
|
+
| [American Express](https://www.americanexpress.com) | `:amex` |
|
67
68
|
| [Simple (BBVA)](https://www.simple.com) | `:simple` |
|
68
69
|
| [Simple (Bancorp)](https://www.simple.com) | `:simple_bancorp` |
|
69
70
|
| [Target REDcard](https://rcam.target.com) | `:target` |
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "bigdecimal"
|
2
|
+
|
3
|
+
module FineAnts
|
4
|
+
module Adapters
|
5
|
+
class Amex
|
6
|
+
def initialize(credentials)
|
7
|
+
@user = credentials[:user]
|
8
|
+
@password = credentials[:password]
|
9
|
+
end
|
10
|
+
|
11
|
+
def login
|
12
|
+
visit "https://www.americanexpress.com"
|
13
|
+
within "#ssoform" do
|
14
|
+
fill_in "User ID", :with => @user
|
15
|
+
fill_in "Password", :with => @password
|
16
|
+
click_link "Log In"
|
17
|
+
end
|
18
|
+
verify_login!
|
19
|
+
end
|
20
|
+
|
21
|
+
def download
|
22
|
+
visit "https://global.americanexpress.com/accounts"
|
23
|
+
all(".card-block > div").map do |account|
|
24
|
+
name = account.find('.heading-3').text
|
25
|
+
owed = account.all("table td").size == 3
|
26
|
+
{
|
27
|
+
:adapter => :amex,
|
28
|
+
:user => @user,
|
29
|
+
:id => name,
|
30
|
+
:name => name,
|
31
|
+
:amount => BigDecimal.new(if owed
|
32
|
+
account.find("table td:nth-child(2) span").text.gsub(/[\$,]/,'')
|
33
|
+
else
|
34
|
+
"0"
|
35
|
+
end)
|
36
|
+
}
|
37
|
+
end.tap do
|
38
|
+
page.driver.go_back
|
39
|
+
click_button "Log Out"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def verify_login!
|
46
|
+
find_button "Log Out"
|
47
|
+
rescue
|
48
|
+
raise FineAnts::LoginFailedError.new
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
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.7.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: 2017-
|
11
|
+
date: 2017-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- fine_ants.gemspec
|
98
98
|
- lib/fine_ants.rb
|
99
99
|
- lib/fine_ants/adapters.rb
|
100
|
+
- lib/fine_ants/adapters/amex.rb
|
100
101
|
- lib/fine_ants/adapters/betterment.rb
|
101
102
|
- lib/fine_ants/adapters/chase.rb
|
102
103
|
- lib/fine_ants/adapters/etrade.rb
|