zen-plaid 0.0.6 → 0.0.7
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/lib/zen-plaid/connect.rb +8 -0
- data/lib/zen-plaid/version.rb +1 -1
- data/lib/zen-plaid.rb +1 -3
- data/spec/auth_spec.rb +4 -4
- data/spec/connect_spec.rb +98 -4
- data/zen-plaid.gemspec +1 -1
- metadata +3 -5
- data/lib/zen-plaid/entity.rb +0 -7
- data/spec/entity_spec.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fa6f28665973a6deb6be5c37b29580c5051eec9
|
4
|
+
data.tar.gz: 6aeb57c3ca845aeb8575b4ce2ffb92715d46567f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 145454335a75b86ecf55b8c45be94f4f0f702336bd16f1c2edbda5dd814c657da176381099a03910094e40dcff3fbb3d19a005f27bdd43633c80596264da5561
|
7
|
+
data.tar.gz: 6a0e10bcc4873b693d47925b57fec10fb7c04d9a956244f69b4c54793ee5be93f09252c21744aa24c2c3b3558bb46ec41bfe7f4a28a3db6767998b54a5a64cef
|
data/lib/zen-plaid/connect.rb
CHANGED
@@ -11,5 +11,13 @@ module Plaid
|
|
11
11
|
def self.mfa_step(params)
|
12
12
|
Plaid.request(:post, 'connect/step', params)
|
13
13
|
end
|
14
|
+
|
15
|
+
def self.update_user(params)
|
16
|
+
Plaid.request(:patch, '/connect', params)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.update_mfa_step(params)
|
20
|
+
Plaid.request(:patch, '/connect/step', params)
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
data/lib/zen-plaid/version.rb
CHANGED
data/lib/zen-plaid.rb
CHANGED
@@ -10,7 +10,6 @@ require 'zen-plaid/auth'
|
|
10
10
|
require 'zen-plaid/balance'
|
11
11
|
require 'zen-plaid/category'
|
12
12
|
require 'zen-plaid/connect'
|
13
|
-
require 'zen-plaid/entity'
|
14
13
|
require 'zen-plaid/institution'
|
15
14
|
|
16
15
|
module Plaid
|
@@ -21,8 +20,7 @@ module Plaid
|
|
21
20
|
|
22
21
|
def self.handle_api_error(rcode, rbody)
|
23
22
|
error_obj = Util.symbolize_names(Oj.load(rbody))
|
24
|
-
|
25
|
-
{code: rcode, error: error_obj}
|
23
|
+
{code: rcode, plaid_code: error_obj[:code], http_code: rcode, error: error_obj}
|
26
24
|
end
|
27
25
|
|
28
26
|
def self.parse(response)
|
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 400 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(400)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -23,9 +23,9 @@ describe Plaid::Auth do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'forget pin when its needed' do
|
26
|
-
it "returns
|
26
|
+
it "returns 400 http code" do
|
27
27
|
connection = Plaid::Auth.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good'})
|
28
|
-
expect(connection[:code]).to eq(
|
28
|
+
expect(connection[:code]).to eq(400)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
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 400 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(400)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -81,9 +81,9 @@ describe Plaid::Connect do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'forget pin when its needed' do
|
84
|
-
it "returns
|
84
|
+
it "returns 400 http code" do
|
85
85
|
connection = Plaid::Connect.add({type: 'usaa', username: 'plaid_test', password: 'plaid_good'})
|
86
|
-
expect(connection[:code]).to eq(
|
86
|
+
expect(connection[:code]).to eq(400)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -243,4 +243,98 @@ describe Plaid::Connect do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
end
|
246
|
+
|
247
|
+
describe "#update_user" do
|
248
|
+
context 'missing access_token' do
|
249
|
+
it "returns 400 http code" do
|
250
|
+
connection = Plaid::Connect.update_user({type: 'amex', username: 'plaid_test', password: 'plaid_good'})
|
251
|
+
expect(connection[:code]).to eq(400)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
context 'missing password' do
|
256
|
+
it "returns 400 http code" do
|
257
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'amex', username: 'plaid_test'})
|
258
|
+
expect(connection[:code]).to eq(402)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context 'pin when its not needed' do
|
263
|
+
it "returns 200 http code" do
|
264
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'amex', username: 'plaid_test', password: 'plaid_good', pin: 1234})
|
265
|
+
expect(connection[:code]).to eq(200)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
context 'forget pin when its needed' do
|
270
|
+
it "returns 402 http code" do
|
271
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'usaa', username: 'plaid_test', password: 'plaid_good'})
|
272
|
+
expect(connection[:code]).to eq(402)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
context 'locked credentials with no mfa' do
|
277
|
+
it "returns 402 http code" do
|
278
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'amex', username: 'plaid_test', password: 'plaid_locked'})
|
279
|
+
expect(connection[:code]).to eq(402)
|
280
|
+
end
|
281
|
+
|
282
|
+
it "returns error message" do
|
283
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'amex', username: 'plaid_test', password: 'plaid_locked'})
|
284
|
+
expect(connection[:error][:message]).to eq('account locked')
|
285
|
+
end
|
286
|
+
|
287
|
+
it "returns error resolution" do
|
288
|
+
connection = Plaid::Connect.update_user({access_token: 'test', type: 'amex', username: 'plaid_test', password: 'plaid_locked'})
|
289
|
+
expect(connection[:error][:resolve]).to include('The account is locked.')
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
describe "#update_mfa_step" do
|
295
|
+
context 'correct mfa reply code' do
|
296
|
+
it "returns 200 http code" do
|
297
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'chase', mfa: '1234'})
|
298
|
+
expect(connection[:code]).to eq(200)
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
context 'wrong mfa reply code' do
|
303
|
+
it "returns 402 http code" do
|
304
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'chase', mfa: '666'})
|
305
|
+
expect(connection[:code]).to eq(402)
|
306
|
+
end
|
307
|
+
|
308
|
+
it "returns error message" do
|
309
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'chase', mfa: '666'})
|
310
|
+
expect(connection[:error][:message]).to eq("invalid mfa")
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
context 'correct mfa reply answer' do
|
315
|
+
it "returns 200 http code" do
|
316
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'us', mfa: 'tomato'})
|
317
|
+
expect(connection[:code]).to eq(200)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
context 'wrong mfa reply answer' do
|
322
|
+
it "returns 402 http code" do
|
323
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'us', mfa: 'wrong'})
|
324
|
+
expect(connection[:code]).to eq(402)
|
325
|
+
end
|
326
|
+
|
327
|
+
it "returns error message" do
|
328
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'us', mfa: 'wrong'})
|
329
|
+
expect(connection[:error][:message]).to eq("invalid mfa")
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
context 'correct mfa reply selections' do
|
334
|
+
it "returns 200 http code" do
|
335
|
+
connection = Plaid::Connect.update_mfa_step({access_token: 'test', type: 'citi', credentials: {pin: 1234}})
|
336
|
+
expect(connection[:code]).to eq(200)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
246
340
|
end
|
data/zen-plaid.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'zen-plaid/version'
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'zen-plaid'
|
6
6
|
s.version = Plaid::VERSION
|
7
|
-
s.date = '
|
7
|
+
s.date = '2015-03-05'
|
8
8
|
s.summary = 'Plaid Ruby Gem'
|
9
9
|
s.description = 'Ruby Gem wrapper for Plaid API.'
|
10
10
|
s.authors = ['Sean McCann']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean McCann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- lib/zen-plaid/category.rb
|
86
86
|
- lib/zen-plaid/configuration.rb
|
87
87
|
- lib/zen-plaid/connect.rb
|
88
|
-
- lib/zen-plaid/entity.rb
|
89
88
|
- lib/zen-plaid/institution.rb
|
90
89
|
- lib/zen-plaid/util.rb
|
91
90
|
- lib/zen-plaid/version.rb
|
@@ -93,7 +92,6 @@ files:
|
|
93
92
|
- spec/balance_spec.rb
|
94
93
|
- spec/category_spec.rb
|
95
94
|
- spec/connect_spec.rb
|
96
|
-
- spec/entity_spec.rb
|
97
95
|
- spec/institution_spec.rb
|
98
96
|
- spec/spec_helper.rb
|
99
97
|
- spec/util_spec.rb
|
@@ -118,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
116
|
version: '0'
|
119
117
|
requirements: []
|
120
118
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.4.6
|
122
120
|
signing_key:
|
123
121
|
specification_version: 4
|
124
122
|
summary: Plaid Ruby Gem
|
data/lib/zen-plaid/entity.rb
DELETED