finapps 5.0.7 → 5.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/finapps.gemspec +1 -1
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +5 -1
- data/lib/finapps/rest/plaid/plaid_resources.rb +1 -1
- data/lib/finapps/rest/sessions.rb +6 -4
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/consumers_spec.rb +3 -9
- data/spec/rest/order_tokens_spec.rb +1 -3
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +38 -46
- data/spec/rest/sessions_spec.rb +4 -12
- data/spec/support/fake_api.rb +3 -0
- data/spec/support/fixtures/plaid/institution/consumer/show.json +19 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8649be674c821b90c09a46379fd7aef455ca72fe0132098dd31ee20cd0253aed
|
4
|
+
data.tar.gz: cbf53968080c0e7b5d3fc57dd407a8432eb8f6d6b458bdae3e79fde4b272cf26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6dacf98bbd260391a83a555f9ea40c03dfdda6ccc77ca8cf305ff0646f487baaa3b3c8b326410037c0b47f0b2a702f1e0b1936f3b69d6a23385d1cef927d6a2
|
7
|
+
data.tar.gz: 3c444a8a58f341b1e7b3ea173d4c777a11f448fc6a27015518ff0385ee61b5c87a0ffd7722db94e07109174c2bb9fcbd412046a05d8f8e88d09ade3c49f120a3
|
data/.gitignore
CHANGED
data/finapps.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = Dir['spec/**/*.rb']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'finapps_core', '~> 5.0', '>= 5.0.
|
23
|
+
spec.add_runtime_dependency 'finapps_core', '~> 5.0', '>= 5.0.3'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
26
26
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
|
@@ -15,12 +15,14 @@ module FinApps
|
|
15
15
|
begin
|
16
16
|
super params, path
|
17
17
|
rescue FinAppsCore::ApiUnauthenticatedError
|
18
|
-
return
|
19
|
-
nil,
|
18
|
+
return(
|
20
19
|
[
|
21
|
-
|
20
|
+
nil,
|
21
|
+
[
|
22
|
+
"Invalid #{path == CONSUMER_LOGIN ? 'Consumer' : 'Operator'} Identifier or Credentials"
|
23
|
+
]
|
22
24
|
]
|
23
|
-
|
25
|
+
)
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/consumers_spec.rb
CHANGED
@@ -23,9 +23,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
23
23
|
let(:create) { subject.create(email: 'email', password: 'password') }
|
24
24
|
|
25
25
|
it { expect { create }.not_to raise_error }
|
26
|
-
it('results is a Hash')
|
27
|
-
expect(results).to be_a(Hash)
|
28
|
-
end
|
26
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
29
27
|
it('performs a post and returns the response') do
|
30
28
|
expect(results).to have_key(:public_id)
|
31
29
|
end
|
@@ -59,9 +57,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
59
57
|
let(:error_messages) { show[1] }
|
60
58
|
|
61
59
|
it { expect { show }.not_to raise_error }
|
62
|
-
it('results is a Hash')
|
63
|
-
expect(results).to be_a(Hash)
|
64
|
-
end
|
60
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
65
61
|
it('performs a get and returns the response') do
|
66
62
|
expect(results).to have_key(:public_id)
|
67
63
|
end
|
@@ -131,9 +127,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
131
127
|
let(:error_messages) { update[1] }
|
132
128
|
|
133
129
|
it { expect { update }.not_to raise_error }
|
134
|
-
it('results is a Hash')
|
135
|
-
expect(results).to be_a(Hash)
|
136
|
-
end
|
130
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
137
131
|
it('the public_id is on the results') do
|
138
132
|
expect(results).to have_key(:public_id)
|
139
133
|
end
|
@@ -23,9 +23,7 @@ RSpec.describe FinApps::REST::OrderTokens,
|
|
23
23
|
context 'for valid token' do
|
24
24
|
let(:show) { subject.show(:valid_token) }
|
25
25
|
it { expect { show }.not_to raise_error }
|
26
|
-
it('results is a
|
27
|
-
expect(results).to be_a(Hash)
|
28
|
-
end
|
26
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
29
27
|
it('results contains a consumer_id') do
|
30
28
|
expect(results).to have_key(:consumer_id)
|
31
29
|
end
|
@@ -9,68 +9,60 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
|
|
9
9
|
let(:api_client) { client }
|
10
10
|
|
11
11
|
RSpec.shared_examples 'an API request' do |_parameter|
|
12
|
-
|
13
|
-
|
12
|
+
it do
|
13
|
+
expect do
|
14
|
+
# noinspection RubyBlockToMethodReference
|
15
|
+
subject
|
16
|
+
end.not_to raise_error
|
17
|
+
end
|
14
18
|
it('returns an array') { expect(subject).to be_a(Array) }
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
.new(api_client)
|
21
|
-
.create(public_token: 'le-token')
|
21
|
+
RSpec.shared_examples 'a successful request' do |_parameter|
|
22
|
+
it('returns no error messages') do
|
23
|
+
expect(subject[ERROR_MESSAGES]).to be_empty
|
22
24
|
end
|
25
|
+
end
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
RSpec.shared_examples 'a request that returns institution data' do |_parameter|
|
28
|
+
it('returns institution data') do
|
29
|
+
expect(subject[RESULTS]).to have_key(:_id)
|
30
|
+
end
|
31
|
+
end
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
+
describe '#create' do
|
34
|
+
subject(:create) do
|
35
|
+
FinApps::REST::PlaidConsumerInstitutions.new(api_client).create(
|
36
|
+
public_token: 'le-token'
|
37
|
+
)
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
40
|
+
it_behaves_like 'an API request'
|
41
|
+
it_behaves_like 'a successful request'
|
42
|
+
it_behaves_like 'a request that returns institution data'
|
43
|
+
end
|
37
44
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
describe '#show' do
|
46
|
+
subject(:show) do
|
47
|
+
FinApps::REST::PlaidConsumerInstitutions.new(api_client).show(
|
48
|
+
:consumer_institution_id
|
49
|
+
)
|
43
50
|
end
|
51
|
+
|
52
|
+
it_behaves_like 'an API request'
|
53
|
+
it_behaves_like 'a successful request'
|
54
|
+
it_behaves_like 'a request that returns institution data'
|
44
55
|
end
|
45
56
|
|
46
57
|
describe '#list' do
|
47
58
|
subject(:list) do
|
48
|
-
FinApps::REST::PlaidConsumerInstitutions
|
49
|
-
.new(api_client)
|
50
|
-
.list
|
59
|
+
FinApps::REST::PlaidConsumerInstitutions.new(api_client).list
|
51
60
|
end
|
52
61
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
result = list[RESULTS]
|
58
|
-
expect(result).to be_an(Array)
|
59
|
-
expect(result.first).to have_key(:_id)
|
60
|
-
end
|
61
|
-
it('returns no error messages') do
|
62
|
-
expect(list[ERROR_MESSAGES]).to be_empty
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'when invalid tenant token is provided' do
|
67
|
-
let(:api_client) { client(:invalid_tenant_token) }
|
68
|
-
|
69
|
-
it_behaves_like 'an API request'
|
70
|
-
it('results is nil') { expect(list[RESULTS]).to be_nil }
|
71
|
-
it('error messages array is populated') do
|
72
|
-
expect(list[ERROR_MESSAGES].first.downcase).to eq('resource not found')
|
73
|
-
end
|
62
|
+
it_behaves_like 'an API request'
|
63
|
+
it_behaves_like 'a successful request'
|
64
|
+
it('returns an Array of institution data') do
|
65
|
+
expect(list[RESULTS].first).to have_key(:_id)
|
74
66
|
end
|
75
67
|
end
|
76
68
|
end
|
data/spec/rest/sessions_spec.rb
CHANGED
@@ -45,12 +45,8 @@ RSpec.describe FinApps::REST::Sessions,
|
|
45
45
|
{ email: 'email@domain.com', password: 'valid_password' }
|
46
46
|
end
|
47
47
|
|
48
|
-
it('results is a
|
49
|
-
|
50
|
-
end
|
51
|
-
it('token value is in the result') do
|
52
|
-
expect(results).to have_key(:token)
|
53
|
-
end
|
48
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
49
|
+
it('token value is in the result') { expect(results).to have_key(:token) }
|
54
50
|
it('error_messages is empty') { expect(error_messages).to be_empty }
|
55
51
|
end
|
56
52
|
|
@@ -60,12 +56,8 @@ RSpec.describe FinApps::REST::Sessions,
|
|
60
56
|
{ email: 'email@domain.com', password: 'valid_password' }
|
61
57
|
end
|
62
58
|
|
63
|
-
it('results is a
|
64
|
-
|
65
|
-
end
|
66
|
-
it('token value is in the result') do
|
67
|
-
expect(results).to have_key(:token)
|
68
|
-
end
|
59
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
60
|
+
it('token value is in the result') { expect(results).to have_key(:token) }
|
69
61
|
it('returns operator for operator path') do
|
70
62
|
expect(results).to have_key(:role)
|
71
63
|
end
|
data/spec/support/fake_api.rb
CHANGED
@@ -26,6 +26,9 @@ class FakeApi < Sinatra::Base
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# plaid_institution_consumer
|
29
|
+
get("/#{version}/p/institution/consumer/:consumer_institution_id") do
|
30
|
+
json_response 200, 'plaid/institution/consumer/show.json'
|
31
|
+
end
|
29
32
|
get("/#{version}/p/institution/consumer") do
|
30
33
|
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
31
34
|
if tenant_token == 'invalid_tenant_token'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"_id": "5d435bb8c80c5c00010d88b1",
|
3
|
+
"status": 4,
|
4
|
+
"status_text": null,
|
5
|
+
"error": null,
|
6
|
+
"webhook": null,
|
7
|
+
"institution_name": "",
|
8
|
+
"plaid_institution_id": "",
|
9
|
+
"metrics": {
|
10
|
+
"available_products": null,
|
11
|
+
"billed_products": null,
|
12
|
+
"last_webhook": null,
|
13
|
+
"last_webhook_code": null,
|
14
|
+
"last_successful_transaction_update": null,
|
15
|
+
"last_failed_transaction_update": null
|
16
|
+
},
|
17
|
+
"created_date": "2019-08-01T21:38:00.261008261Z",
|
18
|
+
"modified_date": "2019-08-01T21:38:00.261008261Z"
|
19
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 5.0.
|
22
|
+
version: 5.0.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 5.0.
|
32
|
+
version: 5.0.3
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -385,6 +385,7 @@ files:
|
|
385
385
|
- spec/support/fixtures/plaid/institution/consumer/add-missing-public-token.json
|
386
386
|
- spec/support/fixtures/plaid/institution/consumer/add.json
|
387
387
|
- spec/support/fixtures/plaid/institution/consumer/list.json
|
388
|
+
- spec/support/fixtures/plaid/institution/consumer/show.json
|
388
389
|
- spec/support/fixtures/plaid/webhook.json
|
389
390
|
- spec/support/fixtures/portfolio.json
|
390
391
|
- spec/support/fixtures/portfolio_reports.json
|