zen-plaid 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/lib/zen-plaid/auth.rb +1 -1
- data/lib/zen-plaid/connect.rb +1 -1
- data/lib/zen-plaid/util.rb +17 -0
- data/lib/zen-plaid/version.rb +1 -1
- data/spec/auth_spec.rb +13 -18
- data/spec/connect_spec.rb +8 -13
- data/spec/util_spec.rb +42 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3e87f8a6171381574d7e3e643f3cb6f23c7baa
|
4
|
+
data.tar.gz: 60efc4c37af64802d244e641b0647d2a487ea4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33bf4ec03e57e8d21f4bbcf067c85c65e9603dce1281be7cd91a94fa8e7b3208770c697d4d5facc224a0b595875e73369788d019ad8362f93c23aa44470d84bf
|
7
|
+
data.tar.gz: 5ade6cc8a485d42e881c4d2ddd1b7a8a7ffd0fa06b6ef390cf652e74c1319c3ff1b671635b2bf67bf97a9dffe92694e1becfcf88a49e09d708da26b597202645
|
data/.rspec
CHANGED
data/lib/zen-plaid/auth.rb
CHANGED
data/lib/zen-plaid/connect.rb
CHANGED
data/lib/zen-plaid/util.rb
CHANGED
@@ -63,5 +63,22 @@ module Plaid
|
|
63
63
|
end
|
64
64
|
result
|
65
65
|
end
|
66
|
+
|
67
|
+
def self.credentials_params(params)
|
68
|
+
unless params.has_key?(:credentials)
|
69
|
+
warn "You should use credentials to pass in username/password/pin"
|
70
|
+
|
71
|
+
params[:credentials] = {}
|
72
|
+
params[:credentials][:username] = params[:username] if params[:username]
|
73
|
+
params[:credentials][:password] = params[:password] if params[:password]
|
74
|
+
params[:credentials][:pin] = params[:pin] if params[:pin]
|
75
|
+
end
|
76
|
+
|
77
|
+
params.delete(:username)
|
78
|
+
params.delete(:password)
|
79
|
+
params.delete(:pin)
|
80
|
+
|
81
|
+
params
|
82
|
+
end
|
66
83
|
end
|
67
84
|
end
|
data/lib/zen-plaid/version.rb
CHANGED
data/spec/auth_spec.rb
CHANGED
@@ -9,9 +9,9 @@ describe Plaid::Auth do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
context 'missing password' do
|
12
|
-
it "returns
|
12
|
+
it "returns 402 http code" do
|
13
13
|
connection = Plaid::Auth.add({type: 'bofa', username: 'plaid_test'})
|
14
|
-
expect(connection[:code]).to eq(
|
14
|
+
expect(connection[:code]).to eq(402)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -75,22 +75,17 @@ describe Plaid::Auth do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
# it "returns transactions" do
|
90
|
-
# connection = Plaid::Auth.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
91
|
-
# expect(connection[:message]).to have_key(:transactions)
|
92
|
-
# end
|
93
|
-
# end
|
78
|
+
context 'correct credentials with pin' do
|
79
|
+
it "returns 201 http code" do
|
80
|
+
connection = Plaid::Auth.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
81
|
+
expect(connection[:code]).to eq(201)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns mfa question" do
|
85
|
+
connection = Plaid::Auth.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
86
|
+
expect(connection[:message]).to have_key(:mfa)
|
87
|
+
end
|
88
|
+
end
|
94
89
|
|
95
90
|
context 'correct credentials with default chase mfa' do
|
96
91
|
it "returns 201 http code" do
|
data/spec/connect_spec.rb
CHANGED
@@ -67,9 +67,9 @@ describe Plaid::Connect do
|
|
67
67
|
|
68
68
|
describe "#add" do
|
69
69
|
context 'missing password' do
|
70
|
-
it "returns
|
70
|
+
it "returns 402 http code" do
|
71
71
|
connection = Plaid::Connect.add({type: 'amex', username: 'plaid_test'})
|
72
|
-
expect(connection[:code]).to eq(
|
72
|
+
expect(connection[:code]).to eq(402)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -156,19 +156,14 @@ describe Plaid::Connect do
|
|
156
156
|
end
|
157
157
|
|
158
158
|
context 'correct credentials with pin' do
|
159
|
-
it "returns
|
160
|
-
connection = Plaid::Connect.add({type: '
|
161
|
-
expect(connection[:code]).to eq(
|
162
|
-
end
|
163
|
-
|
164
|
-
it "returns accounts" do
|
165
|
-
connection = Plaid::Connect.add({type: 'amex', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
166
|
-
expect(connection[:message]).to have_key(:accounts)
|
159
|
+
it "returns 201 http code" do
|
160
|
+
connection = Plaid::Connect.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
161
|
+
expect(connection[:code]).to eq(201)
|
167
162
|
end
|
168
163
|
|
169
|
-
it "returns
|
170
|
-
connection = Plaid::
|
171
|
-
expect(connection[:message]).to have_key(:
|
164
|
+
it "returns mfa question" do
|
165
|
+
connection = Plaid::Auth.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
166
|
+
expect(connection[:message]).to have_key(:mfa)
|
172
167
|
end
|
173
168
|
end
|
174
169
|
|
data/spec/util_spec.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe Plaid::Util do
|
4
|
+
describe ".credentials_params" do
|
5
|
+
context 'already has credentials' do
|
6
|
+
let(:params) { { credentials: {username: 'plaid_test', password: 'plaid_good'}, type: 'chase' } }
|
7
|
+
let(:fixed_params) { Plaid::Util.credentials_params(params) }
|
8
|
+
|
9
|
+
it { expect(fixed_params).to have_key(:credentials) }
|
10
|
+
it { expect(fixed_params[:credentials]).to have_key(:username) }
|
11
|
+
it { expect(fixed_params[:credentials]).to have_key(:password) }
|
12
|
+
it { expect(fixed_params[:credentials]).to_not have_key(:pin) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'no credentials' do
|
16
|
+
let(:params) { { username: 'plaid_test', password: 'plaid_good', type: 'chase' } }
|
17
|
+
let(:fixed_params) { Plaid::Util.credentials_params(params) }
|
18
|
+
|
19
|
+
it { expect(fixed_params).to have_key(:credentials) }
|
20
|
+
it { expect(fixed_params[:credentials]).to have_key(:username) }
|
21
|
+
it { expect(fixed_params[:credentials]).to have_key(:password) }
|
22
|
+
|
23
|
+
it { expect(fixed_params).to_not have_key(:username) }
|
24
|
+
it { expect(fixed_params).to_not have_key(:password) }
|
25
|
+
it { expect(fixed_params[:credentials]).to_not have_key(:pin) }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'no credentials with pin' do
|
29
|
+
let(:params) { { username: 'plaid_test', password: 'plaid_good', pin: 1234, type: 'chase' } }
|
30
|
+
let(:fixed_params) { Plaid::Util.credentials_params(params) }
|
31
|
+
|
32
|
+
it { expect(fixed_params).to have_key(:credentials) }
|
33
|
+
it { expect(fixed_params[:credentials]).to have_key(:username) }
|
34
|
+
it { expect(fixed_params[:credentials]).to have_key(:password) }
|
35
|
+
it { expect(fixed_params[:credentials]).to have_key(:pin) }
|
36
|
+
|
37
|
+
it { expect(fixed_params).to_not have_key(:username) }
|
38
|
+
it { expect(fixed_params).to_not have_key(:password) }
|
39
|
+
it { expect(fixed_params).to_not have_key(:pin) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zen-plaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean McCann
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- spec/entity_spec.rb
|
97
97
|
- spec/institution_spec.rb
|
98
98
|
- spec/spec_helper.rb
|
99
|
+
- spec/util_spec.rb
|
99
100
|
- zen-plaid.gemspec
|
100
101
|
homepage: https://github.com/seanmccann/zen-plaid
|
101
102
|
licenses:
|