plaid 1.0.1 → 1.1.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 +7 -7
- data/lib/plaid.rb +2 -2
- data/lib/plaid/{auth.rb → add_user.rb} +3 -2
- data/lib/plaid/util.rb +2 -1
- data/lib/plaid/version.rb +1 -1
- data/spec/plaid_spec.rb +48 -29
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df30fbdad26bdf216850618dadf355fd17e3cee
|
4
|
+
data.tar.gz: 2e70845646767b8174a1b77314933b2bb8a384fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fba432e8eb41e8abd6603f00327aa8d07da2ed5be065cd63b73784f8205f4524e7e4b486ef497a9a666f4714570c34e432119802a454b12c588e7e0a621d062
|
7
|
+
data.tar.gz: 3a01497f2fe95e950924fb314d00cb1fbdeb01cc779e201a2c48f541d4c55ce6dcd6fe3726d0281afe972be9b121a4e00dda0696131368e7c4c6dbddf08d1203
|
data/README.md
CHANGED
@@ -4,11 +4,11 @@ Ruby bindings for the Plaid API
|
|
4
4
|
|
5
5
|
## Notes
|
6
6
|
|
7
|
-
Latest stable version: **1.
|
7
|
+
Latest stable version: **1.1.0**
|
8
8
|
|
9
|
-
Last stable version: 0.1
|
9
|
+
Last stable version: 1.0.1
|
10
10
|
|
11
|
-
**Warning: If you have been using any version < 1 please switch to the correct branch (V0.1.6). Installing without specifying a version from RubyGems results in V1.
|
11
|
+
**Warning: If you have been using any version < 1 please switch to the correct branch (V0.1.6). Installing without specifying a version from RubyGems results in V1.1 build. **
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -34,16 +34,16 @@ Configure the gem with your customer id, secret key, and the environment path yo
|
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
Plaid.config do |p|
|
37
|
-
p.customer_id =
|
38
|
-
p.secret =
|
39
|
-
p.environment_location =
|
37
|
+
p.customer_id = 'Plaid provided customer ID here'
|
38
|
+
p.secret = 'Plaid provided secret key here'
|
39
|
+
p.environment_location = 'URL for the development or production environment'
|
40
40
|
end
|
41
41
|
```
|
42
42
|
|
43
43
|
Authenticate a user to your desired level of api access (auth / connect).
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
user = Plaid.
|
46
|
+
user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
47
47
|
```
|
48
48
|
|
49
49
|
## Learn More
|
data/lib/plaid.rb
CHANGED
@@ -2,7 +2,7 @@ require 'plaid/version'
|
|
2
2
|
require 'plaid/config'
|
3
3
|
require 'plaid/util'
|
4
4
|
|
5
|
-
require 'plaid/
|
5
|
+
require 'plaid/add_user'
|
6
6
|
require 'plaid/user/user'
|
7
7
|
require 'plaid/institution/institution'
|
8
8
|
require 'plaid/category/category'
|
@@ -16,7 +16,7 @@ module Plaid
|
|
16
16
|
include Plaid::Util
|
17
17
|
|
18
18
|
# Includes the method to authenticate the user. Defined in auth.rb
|
19
|
-
include Plaid::
|
19
|
+
include Plaid::AddUser
|
20
20
|
|
21
21
|
# Builds the user object and returns on successful authentication
|
22
22
|
def user(res,api_level=nil)
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Plaid
|
2
|
-
module
|
3
|
-
def
|
2
|
+
module AddUser
|
3
|
+
def add_user(api_level,username,password,type,pin=nil)
|
4
4
|
begin
|
5
5
|
options = {username:username,password:password,type:type}
|
6
|
+
options.merge!(pin:pin) if pin
|
6
7
|
res = self.post(api_level,options)
|
7
8
|
self.user(res,api_level)
|
8
9
|
rescue => e
|
data/lib/plaid/util.rb
CHANGED
@@ -30,7 +30,7 @@ module Plaid
|
|
30
30
|
when 'Institution not supported'
|
31
31
|
raise 'Institution not supported'
|
32
32
|
when 'Corrupted token'
|
33
|
-
raise 'It appears that the
|
33
|
+
raise 'It appears that the access token has been corrupted'
|
34
34
|
else
|
35
35
|
raise err
|
36
36
|
end
|
@@ -68,5 +68,6 @@ module Plaid
|
|
68
68
|
error_handler('Server Error',res)
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
71
72
|
end
|
72
73
|
end
|
data/lib/plaid/version.rb
CHANGED
data/spec/plaid_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Plaid do
|
|
10
10
|
p.secret = 'test_secret'
|
11
11
|
p.environment_location = 'https://tartan.plaid.com/'
|
12
12
|
end
|
13
|
-
res = Plaid.
|
13
|
+
res = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
14
14
|
it { expect(res).to be_instance_of Plaid::User }
|
15
15
|
end
|
16
16
|
|
@@ -20,7 +20,7 @@ describe Plaid do
|
|
20
20
|
p.secret = 'test_secret'
|
21
21
|
p.environment_location = 'https://api.plaid.com/'
|
22
22
|
end
|
23
|
-
res = Plaid.
|
23
|
+
res = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
24
24
|
it { expect(res).to be_instance_of Plaid::User }
|
25
25
|
end
|
26
26
|
|
@@ -30,7 +30,7 @@ describe Plaid do
|
|
30
30
|
p.secret = 'test_bad'
|
31
31
|
p.environment_location = 'https://tartan.plaid.com/'
|
32
32
|
end
|
33
|
-
it { expect{Plaid.
|
33
|
+
it { expect{Plaid.add_user('connect','plaid_bad','plaid_bad','wells')}.to raise_error }
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'has invalid production keys' do
|
@@ -39,68 +39,87 @@ describe Plaid do
|
|
39
39
|
p.secret = 'test_bad'
|
40
40
|
p.environment_location = 'https://api.plaid.com/'
|
41
41
|
end
|
42
|
-
it { expect{Plaid.
|
42
|
+
it { expect{Plaid.add_user('connect','plaid_bad','plaid_bad','wells')}.to raise_error }
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
# Authentication flow specs - returns Plaid::User
|
47
47
|
# TODO: Abstract the config from each section with the result in passing tests
|
48
|
-
describe '.
|
48
|
+
describe '.add_user' do
|
49
49
|
|
50
|
-
context 'has correct credentials for single factor auth, authenticates to the connect
|
50
|
+
context 'has correct credentials for single factor auth, authenticates to the connect level of api access' do
|
51
51
|
Plaid.config do |p|
|
52
52
|
p.customer_id = 'test_id'
|
53
53
|
p.secret = 'test_secret'
|
54
54
|
p.environment_location = 'https://tartan.plaid.com/'
|
55
55
|
end
|
56
|
-
user = Plaid.
|
56
|
+
user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
57
57
|
it { expect(user.accounts.empty?).to be_falsey }
|
58
58
|
end
|
59
59
|
|
60
|
-
context 'has correct credentials for single factor auth, authenticates to the auth
|
60
|
+
context 'has correct credentials for single factor auth, authenticates to the auth level of api access' do
|
61
61
|
Plaid.config do |p|
|
62
62
|
p.customer_id = 'test_id'
|
63
63
|
p.secret = 'test_secret'
|
64
64
|
p.environment_location = 'https://tartan.plaid.com/'
|
65
65
|
end
|
66
|
-
user = Plaid.
|
66
|
+
user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
67
67
|
it { expect(user.accounts[0].numbers.nil?).to be_falsey }
|
68
68
|
end
|
69
69
|
|
70
|
-
context 'has correct username, but incorrect password for single factor auth under auth
|
70
|
+
context 'has correct username, but incorrect password for single factor auth under auth level of api access' do
|
71
71
|
Plaid.config do |p|
|
72
72
|
p.customer_id = 'test_id'
|
73
73
|
p.secret = 'test_secret'
|
74
74
|
p.environment_location = 'https://tartan.plaid.com/'
|
75
75
|
end
|
76
|
-
it { expect{Plaid.
|
76
|
+
it { expect{Plaid.add_user('auth','plaid_test','plaid_bad','wells')}.to raise_error }
|
77
77
|
end
|
78
78
|
|
79
|
-
context 'has incorrect username under auth
|
79
|
+
context 'has incorrect username under auth level of api access' do
|
80
80
|
Plaid.config do |p|
|
81
81
|
p.customer_id = 'test_id'
|
82
82
|
p.secret = 'test_secret'
|
83
83
|
p.environment_location = 'https://tartan.plaid.com/'
|
84
84
|
end
|
85
|
-
it { expect{Plaid.
|
85
|
+
it { expect{Plaid.add_user('auth','plaid_bad','plaid_bad','wells')}.to raise_error }
|
86
86
|
end
|
87
87
|
|
88
|
-
context 'has correct username, but incorrect password for single factor auth under connect
|
88
|
+
context 'has correct username, but incorrect password for single factor auth under connect level of api access' do
|
89
89
|
Plaid.config do |p|
|
90
90
|
p.customer_id = 'test_id'
|
91
91
|
p.secret = 'test_secret'
|
92
92
|
p.environment_location = 'https://tartan.plaid.com/'
|
93
93
|
end
|
94
|
-
it { expect{Plaid.
|
94
|
+
it { expect{Plaid.add_user('connect','plaid_test','plaid_bad','wells')}.to raise_error }
|
95
95
|
end
|
96
96
|
|
97
|
-
context 'has incorrect username under connect
|
97
|
+
context 'has incorrect username under connect level of api access' do
|
98
98
|
Plaid.config do |p|
|
99
99
|
p.customer_id = 'test_id'
|
100
100
|
p.secret = 'test_secret'
|
101
101
|
p.environment_location = 'https://tartan.plaid.com/'
|
102
102
|
end
|
103
|
-
it { expect{Plaid.
|
103
|
+
it { expect{Plaid.add_user('connect','plaid_bad','plaid_bad','wells')}.to raise_error }
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'enters pin for extra parameter authentication required by certain institutions' do
|
107
|
+
Plaid.config do |p|
|
108
|
+
p.customer_id = 'test_id'
|
109
|
+
p.secret = 'test_secret'
|
110
|
+
p.environment_location = 'https://tartan.plaid.com/'
|
111
|
+
end
|
112
|
+
user = Plaid.add_user('connect','plaid_test','plaid_good','usaa','1234')
|
113
|
+
it { expect(user.api_res).to eq 'Requires further authentication' }
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'enters incorrect pin for extra parameter authentication required by certain institutions' do
|
117
|
+
Plaid.config do |p|
|
118
|
+
p.customer_id = 'test_id'
|
119
|
+
p.secret = 'test_secret'
|
120
|
+
p.environment_location = 'https://tartan.plaid.com/'
|
121
|
+
end
|
122
|
+
it { expect{Plaid.add_user('connect','plaid_test','plaid_good','usaa','0000')}.to raise_error }
|
104
123
|
end
|
105
124
|
|
106
125
|
context 'has to enter MFA credentials' do
|
@@ -109,7 +128,7 @@ describe Plaid do
|
|
109
128
|
p.secret = 'test_secret'
|
110
129
|
p.environment_location = 'https://tartan.plaid.com/'
|
111
130
|
end
|
112
|
-
user = Plaid.
|
131
|
+
user = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa')
|
113
132
|
it { expect(user.api_res).to eq 'Requires further authentication' }
|
114
133
|
end
|
115
134
|
|
@@ -119,7 +138,7 @@ describe Plaid do
|
|
119
138
|
p.secret = 'test_secret'
|
120
139
|
p.environment_location = 'https://tartan.plaid.com/'
|
121
140
|
end
|
122
|
-
user = Plaid.
|
141
|
+
user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells')
|
123
142
|
it { expect(user.api_res).to eq 'User account is locked' }
|
124
143
|
end
|
125
144
|
end
|
@@ -205,7 +224,7 @@ describe Plaid do
|
|
205
224
|
p.secret = 'test_secret'
|
206
225
|
p.environment_location = 'https://tartan.plaid.com/'
|
207
226
|
end
|
208
|
-
new_mfa_user = Plaid.
|
227
|
+
new_mfa_user = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa')
|
209
228
|
new_mfa_user.mfa_authentication('tomato','bofa')
|
210
229
|
it { expect(new_mfa_user.accounts).to be_truthy }
|
211
230
|
end
|
@@ -216,7 +235,7 @@ describe Plaid do
|
|
216
235
|
p.secret = 'test_secret'
|
217
236
|
p.environment_location = 'https://tartan.plaid.com/'
|
218
237
|
end
|
219
|
-
mfa_again = Plaid.
|
238
|
+
mfa_again = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa')
|
220
239
|
mfa_again.mfa_authentication('again','bofa')
|
221
240
|
it { expect(mfa_again.api_res).to eq 'Requires further authentication' }
|
222
241
|
end
|
@@ -227,17 +246,17 @@ describe Plaid do
|
|
227
246
|
p.secret = 'test_secret'
|
228
247
|
p.environment_location = 'https://tartan.plaid.com/'
|
229
248
|
end
|
230
|
-
mfa_user = Plaid.
|
249
|
+
mfa_user = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa')
|
231
250
|
mfa_user.mfa_authentication('tomato','bofa')
|
232
|
-
mfa_user = Plaid.
|
251
|
+
mfa_user = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa')
|
233
252
|
it { expect { mfa_user.mfa_authentication('bad','bofa') }.to raise_error }
|
234
253
|
end
|
235
254
|
end
|
236
255
|
|
237
256
|
# Auth specs
|
238
257
|
describe '#get_auth' do
|
239
|
-
auth_user = Plaid.
|
240
|
-
connect_user = Plaid.
|
258
|
+
auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
259
|
+
connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
241
260
|
|
242
261
|
context 'has access and returns accounts' do
|
243
262
|
it { expect(auth_user.permissions[0]).to eq('auth') }
|
@@ -250,8 +269,8 @@ describe Plaid do
|
|
250
269
|
|
251
270
|
# Connect specs
|
252
271
|
describe '#get_connect' do
|
253
|
-
auth_user = Plaid.
|
254
|
-
connect_user = Plaid.
|
272
|
+
auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
273
|
+
connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
255
274
|
|
256
275
|
context 'has access and returns accounts' do
|
257
276
|
it { expect(connect_user.permissions[0]).to eq('connect') }
|
@@ -265,8 +284,8 @@ describe Plaid do
|
|
265
284
|
# Upgrade specs - either pass or fails
|
266
285
|
=begin TODO: Write upgrade methods to pass without paying
|
267
286
|
describe '#upgrade' do
|
268
|
-
auth_user = Plaid.
|
269
|
-
connect_user = Plaid.
|
287
|
+
auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells')
|
288
|
+
connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
|
270
289
|
|
271
290
|
context 'auth upgrade is successful' do
|
272
291
|
connect_user.upgrade
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Crites
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- lib/plaid.rb
|
70
|
-
- lib/plaid/
|
70
|
+
- lib/plaid/add_user.rb
|
71
71
|
- lib/plaid/category/category.rb
|
72
72
|
- lib/plaid/config.rb
|
73
73
|
- lib/plaid/institution/institution.rb
|