finapps 2.0.20 → 2.0.21
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/finapps.rb +3 -0
- data/lib/finapps/rest/client.rb +12 -0
- data/lib/finapps/rest/orders.rb +12 -0
- data/lib/finapps/rest/user_institutions.rb +54 -0
- data/lib/finapps/rest/user_institutions_forms.rb +17 -0
- data/lib/finapps/rest/user_institutions_statuses.rb +23 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +22 -2
- data/spec/rest/orders_spec.rb +45 -0
- data/spec/rest/user_institutions_forms_spec.rb +26 -0
- data/spec/rest/user_institutions_spec.rb +118 -0
- data/spec/rest/user_institutions_statuses_spec.rb +37 -0
- data/spec/support/fake_api.rb +26 -0
- data/spec/support/fixtures/invalid_request_body.json +5 -0
- data/spec/support/fixtures/invalid_user_institution_id.json +5 -0
- data/spec/support/fixtures/user_institution_refresh_all.json +89 -0
- data/spec/support/fixtures/user_institution_status.json +7 -0
- data/spec/support/fixtures/user_institutions_list.json +162 -0
- data/spec/support/fixtures/user_institutions_show.json +24 -0
- metadata +31 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f90c05a3e356a0316489b32a0842e65d95e34b0
|
4
|
+
data.tar.gz: f1086de23facb3c0b933ddfe1fb600d2a2863080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43339a974da89238793047527cb29739eb81366d447465074a0cac543bfbb57db45d6365917979bbccd89599988b4a423054f4bb60ae06033e71e478a96e45c9
|
7
|
+
data.tar.gz: a4a63d8c72e182b9e86b6cf8024e8c42cea347ba30c0d9e0daa83fb7caebe3b5a36e11b5bdc972bcdbbe23c2bf2b38d9de7ec19a1df7ba4c5eab041361a2d7e0
|
data/lib/finapps.rb
CHANGED
@@ -27,6 +27,9 @@ require 'finapps/rest/order_tokens'
|
|
27
27
|
require 'finapps/rest/orders'
|
28
28
|
require 'finapps/rest/institutions_forms'
|
29
29
|
require 'finapps/rest/institutions'
|
30
|
+
require 'finapps/rest/user_institutions_statuses'
|
31
|
+
require 'finapps/rest/user_institutions'
|
32
|
+
require 'finapps/rest/user_institutions_forms'
|
30
33
|
|
31
34
|
require 'finapps/rest/configuration'
|
32
35
|
require 'finapps/rest/credentials'
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -43,6 +43,18 @@ module FinApps
|
|
43
43
|
def institutions_forms
|
44
44
|
@institutions_forms ||= FinApps::REST::InstitutionsForms.new self
|
45
45
|
end
|
46
|
+
|
47
|
+
def user_institutions_statuses
|
48
|
+
@user_institutions_statuses ||= FinApps::REST::UserInstitutionsStatuses.new self
|
49
|
+
end
|
50
|
+
|
51
|
+
def user_institutions
|
52
|
+
@user_institutions ||= FinApps::REST::UserInstitutions.new self
|
53
|
+
end
|
54
|
+
|
55
|
+
def user_institutions_forms
|
56
|
+
@user_institutions_forms ||= FinApps::REST::UserInstitutionsForms.new self
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
48
60
|
end
|
data/lib/finapps/rest/orders.rb
CHANGED
@@ -23,6 +23,18 @@ module FinApps
|
|
23
23
|
|
24
24
|
super 'list/orders/1/10000/date/false'
|
25
25
|
end
|
26
|
+
|
27
|
+
def update(id, params)
|
28
|
+
raise MissingArgumentsError.new 'Missing argument: id.' if id.blank?
|
29
|
+
raise MissingArgumentsError.new 'Missing argument: params' if params.blank?
|
30
|
+
# Params array need matching Institution ids & Account ids
|
31
|
+
# Validations to check each Institution id has at least one account id
|
32
|
+
# Validations to check at least 1 Institution id or 1 account "params.length >= 1"
|
33
|
+
|
34
|
+
path = "#{end_point}/#{ERB::Util.url_encode(id)}"
|
35
|
+
|
36
|
+
super params, path
|
37
|
+
end
|
26
38
|
end
|
27
39
|
end
|
28
40
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class UserInstitutions < FinApps::REST::Resources # :nodoc:
|
5
|
+
require 'erb'
|
6
|
+
|
7
|
+
END_POINT = 'institutions/user'
|
8
|
+
|
9
|
+
using ObjectExtensions
|
10
|
+
using StringExtensions
|
11
|
+
|
12
|
+
def list
|
13
|
+
path = 'institutions/user'
|
14
|
+
super path
|
15
|
+
end
|
16
|
+
|
17
|
+
def show(id)
|
18
|
+
raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
|
19
|
+
|
20
|
+
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
|
21
|
+
super id, path
|
22
|
+
end
|
23
|
+
|
24
|
+
def credentials_update(id, params)
|
25
|
+
raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
|
26
|
+
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
27
|
+
|
28
|
+
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/credentials"
|
29
|
+
update params, path
|
30
|
+
end
|
31
|
+
|
32
|
+
def mfa_update(id, params)
|
33
|
+
raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
|
34
|
+
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
35
|
+
|
36
|
+
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/mfa"
|
37
|
+
update params, path
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy(id)
|
41
|
+
raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
|
42
|
+
|
43
|
+
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
|
44
|
+
super id, path
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def update(params, path)
|
50
|
+
super params, path
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class UserInstitutionsForms < FinApps::REST::Resources
|
5
|
+
require 'erb'
|
6
|
+
using ObjectExtensions
|
7
|
+
using StringExtensions
|
8
|
+
|
9
|
+
def show(id)
|
10
|
+
raise MissingArgumentsError.new 'Missing argument: id.' if id.blank?
|
11
|
+
|
12
|
+
path = "institutions/user/#{ERB::Util.url_encode(id)}/form"
|
13
|
+
super id, path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class UserInstitutionsStatuses < FinApps::REST::Resources # :nodoc:
|
5
|
+
require 'erb'
|
6
|
+
|
7
|
+
using ObjectExtensions
|
8
|
+
using StringExtensions
|
9
|
+
|
10
|
+
def show(id)
|
11
|
+
raise MissingArgumentsError.new 'Missing argument: ui_id' if id.blank?
|
12
|
+
|
13
|
+
path = "institutions/user/#{ERB::Util.url_encode(id)}/status"
|
14
|
+
super id, path
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
path = 'institutions/user/refresh'
|
19
|
+
super nil, path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -13,7 +13,7 @@ RSpec.describe FinApps::REST::Client do
|
|
13
13
|
context 'an instance of Client' do
|
14
14
|
subject { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
15
15
|
|
16
|
-
%i(users sessions orders order_tokens).each do |method|
|
16
|
+
%i(users sessions orders order_tokens institutions institutions_forms user_institutions_statuses user_institutions user_institutions_forms).each do |method|
|
17
17
|
it "responds to #{method}" do
|
18
18
|
expect(subject).to respond_to(method)
|
19
19
|
end
|
@@ -35,10 +35,30 @@ RSpec.describe FinApps::REST::Client do
|
|
35
35
|
it { expect(subject.orders).to be_an_instance_of(FinApps::REST::Orders) }
|
36
36
|
end
|
37
37
|
|
38
|
+
describe '#institutions' do
|
39
|
+
it { expect(subject.institutions).to be_an_instance_of(FinApps::REST::Institutions) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#institutions_forms' do
|
43
|
+
it { expect(subject.institutions_forms).to be_an_instance_of(FinApps::REST::InstitutionsForms) }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#user_institutions_statuses' do
|
47
|
+
it { expect(subject.user_institutions_statuses).to be_an_instance_of(FinApps::REST::UserInstitutionsStatuses) }
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#user_institutions' do
|
51
|
+
it { expect(subject.user_institutions).to be_an_instance_of(FinApps::REST::UserInstitutions) }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#user_institutions_forms' do
|
55
|
+
it { expect(subject.user_institutions_forms).to be_an_instance_of(FinApps::REST::UserInstitutionsForms) }
|
56
|
+
end
|
57
|
+
|
38
58
|
# [:users, :institutions, :user_institutions, :transactions, :categories,
|
39
59
|
# :budget_models, :budget_calculation, :budgets, :cashflows,
|
40
60
|
# :alert, :alert_definition, :alert_preferences, :alert_settings, :rule_sets]
|
41
|
-
%i(users sessions orders order_tokens).each do |method|
|
61
|
+
%i(users sessions orders order_tokens institutions institutions_forms user_institutions_statuses user_institutions user_institutions_forms).each do |method|
|
42
62
|
it "memoizes the result of #{method}" do
|
43
63
|
first = subject.send(method)
|
44
64
|
second = subject.send(method)
|
data/spec/rest/orders_spec.rb
CHANGED
@@ -29,4 +29,49 @@ RSpec.describe FinApps::REST::Orders do
|
|
29
29
|
it('returns no error messages') { expect(subject[1]).to be_empty }
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
describe '#update' do
|
34
|
+
subject(:orders) { FinApps::REST::Orders.new(client) }
|
35
|
+
|
36
|
+
context 'when missing id' do
|
37
|
+
let(:update) { subject.update(nil, :params) }
|
38
|
+
it ('returns missing argument error') { expect { update }.to raise_error(FinApps::MissingArgumentsError) }
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when missing params' do
|
42
|
+
let(:update) { subject.update(:id, nil) }
|
43
|
+
it ('returns missing argument error') { expect { update }.to raise_error(FinApps::MissingArgumentsError) }
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when valid id and params are provided' do
|
47
|
+
let(:update) { subject.update('valid_id', {accounts: 'valid_account'}) } #how to stub params
|
48
|
+
let(:results) { update[0] }
|
49
|
+
let(:error_messages) { update[1] }
|
50
|
+
|
51
|
+
it { expect { update }.not_to raise_error }
|
52
|
+
it('results is nil') { expect(results).to be_nil }
|
53
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when invalid id is provided' do
|
57
|
+
let(:update) { subject.update('invalid_id', :params) }
|
58
|
+
let(:results) { update[0] }
|
59
|
+
let(:error_messages) { update[1] }
|
60
|
+
|
61
|
+
it { expect { update }.not_to raise_error }
|
62
|
+
it('results is nil') { expect(results).to be_nil }
|
63
|
+
it('error messages array is populated') { expect(error_messages.first.downcase).to eq('resource not found') }
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when invalid params are provided' do
|
67
|
+
let(:update) { subject.update('valid_id', {accounts: 'invalid_account'}) }
|
68
|
+
let(:results) { update[0] }
|
69
|
+
let(:error_messages) { update[1] }
|
70
|
+
|
71
|
+
it { expect { update }.not_to raise_error }
|
72
|
+
it('results is nil') { expect(results).to be_nil }
|
73
|
+
it('error messages array is populated') { expect(error_messages.first.downcase).to eq('invalid request body') }
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
32
77
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe FinApps::REST::UserInstitutionsForms do
|
3
|
+
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
+
describe '#show' do
|
5
|
+
context 'when missing site id' do
|
6
|
+
subject { FinApps::REST::UserInstitutionsForms.new(client).show(nil) }
|
7
|
+
it('raises missing argument error') { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'when valid site id provided' do
|
11
|
+
subject { FinApps::REST::UserInstitutionsForms.new(client).show('valid_id') }
|
12
|
+
|
13
|
+
it { expect { subject }.not_to raise_error }
|
14
|
+
it('performs a get and returns the login html') { expect(subject[0]).to respond_to(:login_form_html) }
|
15
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when invalid site id provided' do
|
19
|
+
subject { FinApps::REST::UserInstitutionsForms.new(client).show('invalid_id') }
|
20
|
+
|
21
|
+
it { expect { subject }.not_to raise_error }
|
22
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
23
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid institution id') }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe FinApps::REST::UserInstitutions do
|
3
|
+
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
+
describe '#list' do
|
5
|
+
context 'when successful' do
|
6
|
+
subject { FinApps::REST::UserInstitutions.new(client).list }
|
7
|
+
|
8
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
9
|
+
it('performs a get and returns array of user institutions') { expect(subject[0]).to be_a(Array) }
|
10
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#show' do
|
15
|
+
context 'when missing id' do
|
16
|
+
subject { FinApps::REST::UserInstitutions.new(client).show(nil) }
|
17
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when valid id is provided' do
|
21
|
+
subject { FinApps::REST::UserInstitutions.new(client).show('valid_id') }
|
22
|
+
|
23
|
+
it { expect { subject }.not_to raise_error }
|
24
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
25
|
+
it('performs a get and returns the response') { expect(subject[0]).to respond_to(:_id) }
|
26
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when invalid id is provided' do
|
30
|
+
subject { FinApps::REST::UserInstitutions.new(client).show('invalid_id') }
|
31
|
+
|
32
|
+
it { expect { subject }.not_to raise_error }
|
33
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
34
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#mfa_update' do
|
39
|
+
context 'when missing id' do
|
40
|
+
subject { FinApps::REST::UserInstitutions.new(client).mfa_update(nil, :params) }
|
41
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when missing params' do
|
45
|
+
subject { FinApps::REST::UserInstitutions.new(client).mfa_update(:id, nil) }
|
46
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when valid id and params are provided' do
|
50
|
+
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('valid_id', :params) }
|
51
|
+
|
52
|
+
it { expect { subject }.not_to raise_error }
|
53
|
+
it('performs a post and returns the response') { expect(subject[0]).to respond_to(:user_institution) }
|
54
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when invalid id is provided w/ params' do
|
58
|
+
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('invalid_id', :params) }
|
59
|
+
|
60
|
+
it { expect { subject }.not_to raise_error }
|
61
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
62
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#credentials_update' do
|
67
|
+
context 'when missing id' do
|
68
|
+
subject { FinApps::REST::UserInstitutions.new(client).credentials_update(nil, :params) }
|
69
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when missing params' do
|
73
|
+
subject { FinApps::REST::UserInstitutions.new(client).credentials_update(:id, nil) }
|
74
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when valid id and params are provided' do
|
78
|
+
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('valid_id', :params) }
|
79
|
+
|
80
|
+
it { expect { subject }.not_to raise_error }
|
81
|
+
it('performs a post and returns the response') { expect(subject[0]).to respond_to(:user_institution) }
|
82
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when invalid id is provided w/ params' do
|
86
|
+
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('invalid_id', :params) }
|
87
|
+
|
88
|
+
it { expect { subject }.not_to raise_error }
|
89
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
90
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#destroy' do
|
95
|
+
context 'when missing id' do
|
96
|
+
subject { FinApps::REST::UserInstitutions.new(client).destroy(nil) }
|
97
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'when valid id is provided' do
|
101
|
+
subject { FinApps::REST::UserInstitutions.new(client).destroy('valid_id') }
|
102
|
+
|
103
|
+
it { expect { subject }.not_to raise_error }
|
104
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
105
|
+
it('performs a delete and returns empty response') { expect(subject[0]).to be_nil }
|
106
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when invalid id is provided' do
|
110
|
+
subject { FinApps::REST::UserInstitutions.new(client).destroy('invalid_id') }
|
111
|
+
|
112
|
+
it { expect { subject }.not_to raise_error }
|
113
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
114
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
115
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
3
|
+
let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
|
4
|
+
describe '#show' do
|
5
|
+
context 'when missing id' do
|
6
|
+
subject { FinApps::REST::UserInstitutionsStatuses.new(client).show(nil) }
|
7
|
+
it { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'when valid id is provided' do
|
11
|
+
subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('valid_id') }
|
12
|
+
|
13
|
+
it { expect { subject }.not_to raise_error }
|
14
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
15
|
+
it('performs a get and returns the response') { expect(subject[0]).to respond_to(:_id) }
|
16
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when invalid id is provided' do
|
20
|
+
subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('invalid_id') }
|
21
|
+
|
22
|
+
it { expect { subject }.not_to raise_error }
|
23
|
+
it('results is nil') { expect(subject[0]).to be_nil }
|
24
|
+
it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid user institution id') }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#update' do
|
29
|
+
context 'when successful' do
|
30
|
+
subject { FinApps::REST::UserInstitutions.new(client).list }
|
31
|
+
|
32
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
33
|
+
it('performs a get and returns array of user institutions statuses') { expect(subject[0]).to be_a(Array) }
|
34
|
+
it('returns no error messages') { expect(subject[1]).to be_empty }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/support/fake_api.rb
CHANGED
@@ -15,6 +15,17 @@ class FakeApi < Sinatra::Base
|
|
15
15
|
post('/v2/orders/invalid_token') { json_response 404, 'resource_not_found.json' }
|
16
16
|
get('/v2/orders/:id') { json_response 200, 'resource.json' }
|
17
17
|
get('/v2/list/orders/:page/:requested/:sort/:asc') { json_response 200, 'orders.json' }
|
18
|
+
put('/v2/orders/invalid_id') { json_response 404, 'resource_not_found.json' }
|
19
|
+
put('/v2/orders/valid_id') do
|
20
|
+
request.body.rewind
|
21
|
+
request_payload = JSON.parse request.body.read
|
22
|
+
if request_payload['accounts'] == 'valid_account'
|
23
|
+
status 204
|
24
|
+
else
|
25
|
+
json_response 400, 'invalid_request_body.json'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
18
29
|
|
19
30
|
# institutions
|
20
31
|
get('/v2/institutions/site/valid_site_id/form') { json_response 200, 'institution_login_form.json' }
|
@@ -23,6 +34,21 @@ class FakeApi < Sinatra::Base
|
|
23
34
|
post('/v2/institutions/site/invalid_site_id/add') { json_response 400, 'invalid_institution_id.json' }
|
24
35
|
get('/v2/institutions/search/:search_term') { json_response 200, 'institutions_search_list.json' }
|
25
36
|
|
37
|
+
# user institutions
|
38
|
+
get('/v2/institutions/user/valid_id/status') { json_response 200, 'user_institution_status.json' }
|
39
|
+
get('/v2/institutions/user/invalid_id/status') { json_response 400, 'invalid_user_institution_id.json' }
|
40
|
+
get('/v2/institutions/user') { json_response 200, 'user_institutions_list.json' }
|
41
|
+
get('/v2/institutions/user/valid_id') { json_response 200, 'user_institutions_show.json' }
|
42
|
+
get('/v2/institutions/user/invalid_id') { json_response 400, 'invalid_user_institution_id.json' }
|
43
|
+
put('/v2/institutions/user/refresh') { json_response 200, 'user_institutions_refresh_all.json' }
|
44
|
+
put('/v2/institutions/user/valid_id/credentials') { json_response 200, 'institution_add.json' }
|
45
|
+
put('/v2/institutions/user/invalid_id/credentials') { json_response 400, 'invalid_user_institution_id.json' }
|
46
|
+
put('/v2/institutions/user/valid_id/mfa') { json_response 200, 'institution_add.json' }
|
47
|
+
put('/v2/institutions/user/invalid_id/mfa') { json_response 400, 'invalid_user_institution_id.json' }
|
48
|
+
delete('/v2/institutions/user/valid_id') { status 204 }
|
49
|
+
delete('/v2/institutions/user/invalid_id') { json_response 400, 'invalid_user_institution_id.json' }
|
50
|
+
get('/v2/institutions/user/valid_id/form') { json_response 200, 'institution_login_form.json' }
|
51
|
+
get('/v2/institutions/user/invalid_id/form') { json_response 400, 'invalid_institution_id.json' }
|
26
52
|
|
27
53
|
# users
|
28
54
|
get('/v2/users/valid_public_id') { json_response 200, 'user.json' }
|
@@ -0,0 +1,89 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"_id": "57ade50924fb4800013042de",
|
4
|
+
"name": "Dag Site (US)",
|
5
|
+
"status": 3,
|
6
|
+
"status_message": "queued",
|
7
|
+
"last_refreshed": "2016-08-12T15:02:33.416Z"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"_id": "57ae12f1b0ac9800012b2a00",
|
11
|
+
"name": "Dag Site (US)",
|
12
|
+
"status": 3,
|
13
|
+
"status_message": "queued",
|
14
|
+
"last_refreshed": "2016-08-12T18:18:34.518Z"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"_id": "57ae12f9b0ac9800012b2a04",
|
18
|
+
"name": "Dag Site (US)",
|
19
|
+
"status": 3,
|
20
|
+
"status_message": "queued",
|
21
|
+
"last_refreshed": "2016-08-12T18:18:33.952Z"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"_id": "57ae1304b0ac9800012b2a08",
|
25
|
+
"name": "Dag Site (US)",
|
26
|
+
"status": 6,
|
27
|
+
"status_message": "login failure",
|
28
|
+
"last_refreshed": "2016-08-12T18:18:48.043Z",
|
29
|
+
"reason": "login failure"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"_id": "57ae13a7b0ac9800012b2a0d",
|
33
|
+
"name": "Dag Site (US)",
|
34
|
+
"status": 6,
|
35
|
+
"status_message": "login failure",
|
36
|
+
"last_refreshed": "2016-08-12T18:21:35.988Z",
|
37
|
+
"reason": "login failure"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"_id": "57b1c04624fb48000130432f",
|
41
|
+
"name": "Dag Site (US)",
|
42
|
+
"status": 3,
|
43
|
+
"status_message": "queued",
|
44
|
+
"last_refreshed": "2016-08-15T13:14:46.019Z"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"_id": "57b1c06524fb480001304333",
|
48
|
+
"name": "Dag Site (US)",
|
49
|
+
"status": 6,
|
50
|
+
"status_message": "login failure",
|
51
|
+
"last_refreshed": "2016-08-15T13:15:21.701Z",
|
52
|
+
"reason": "login failure"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"_id": "57b1d13324fb48000130437c",
|
56
|
+
"name": "Dag Site (US)",
|
57
|
+
"status": 3,
|
58
|
+
"status_message": "queued",
|
59
|
+
"last_refreshed": "2016-08-15T14:26:59.886Z"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"_id": "57ae161924fb480001304327",
|
63
|
+
"name": "Genesis Credit (US)",
|
64
|
+
"status": 3,
|
65
|
+
"status_message": "queued",
|
66
|
+
"last_refreshed": "2016-08-12T18:32:58.586Z"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"_id": "57b1c0c6b0ac9800012b2a22",
|
70
|
+
"name": "Genesis Credit (US)",
|
71
|
+
"status": 3,
|
72
|
+
"status_message": "queued",
|
73
|
+
"last_refreshed": "2016-08-15T13:16:54.964Z"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"_id": "57ae154224fb48000130431e",
|
77
|
+
"name": "Pincher Creek CU Limited (Canada)",
|
78
|
+
"status": 3,
|
79
|
+
"status_message": "queued",
|
80
|
+
"last_refreshed": "2016-08-12T18:28:43.752Z"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"_id": "57ae15b824fb480001304322",
|
84
|
+
"name": "United Auto Credit (US)",
|
85
|
+
"status": 3,
|
86
|
+
"status_message": "queued",
|
87
|
+
"last_refreshed": "2016-08-12T18:30:26.659Z"
|
88
|
+
}
|
89
|
+
]
|
@@ -0,0 +1,162 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"_id": "57ade50924fb4800013042de",
|
4
|
+
"account_id": 16412510,
|
5
|
+
"institution_name": "Dag Site (US)",
|
6
|
+
"status": 5,
|
7
|
+
"status_message": "processing",
|
8
|
+
"last_refreshed": "2016-08-12T15:02:33.416Z",
|
9
|
+
"accounts": [
|
10
|
+
{
|
11
|
+
"_id": "57ade52c6e3b09000af9d91b",
|
12
|
+
"user_institution_id": "57ade50924fb4800013042de",
|
13
|
+
"user_institution_name": "Dag Site (US)",
|
14
|
+
"account_type": "bank",
|
15
|
+
"account_name": "Wells Fargo Checking",
|
16
|
+
"account_holder": "FinancialApps",
|
17
|
+
"account_display_name": "Dag Site - Bank - Wells Fargo Checking",
|
18
|
+
"details": {
|
19
|
+
"available_balance": 11673.83,
|
20
|
+
"current_balance": 11673.83,
|
21
|
+
"routing_number": ""
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"_id": "57ae12f1b0ac9800012b2a00",
|
28
|
+
"account_id": 16414778,
|
29
|
+
"institution_name": "Dag Site (US)",
|
30
|
+
"status": 1,
|
31
|
+
"status_message": "ok",
|
32
|
+
"last_refreshed": "2016-08-12T18:18:34.518Z"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"_id": "57ae12f9b0ac9800012b2a04",
|
36
|
+
"account_id": 16412510,
|
37
|
+
"institution_name": "Dag Site (US)",
|
38
|
+
"status": 5,
|
39
|
+
"status_message": "processing",
|
40
|
+
"last_refreshed": "2016-08-12T18:18:33.952Z",
|
41
|
+
"accounts": [
|
42
|
+
{
|
43
|
+
"_id": "57ae13086e3b09000a115643",
|
44
|
+
"user_institution_id": "57ae12f9b0ac9800012b2a04",
|
45
|
+
"user_institution_name": "Dag Site (US)",
|
46
|
+
"account_type": "bank",
|
47
|
+
"account_name": "Wells Fargo Checking",
|
48
|
+
"account_holder": "FinancialApps",
|
49
|
+
"account_display_name": "Dag Site - Bank - Wells Fargo Checking",
|
50
|
+
"details": {
|
51
|
+
"available_balance": 11673.83,
|
52
|
+
"current_balance": 11673.83,
|
53
|
+
"routing_number": ""
|
54
|
+
}
|
55
|
+
}
|
56
|
+
]
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"_id": "57ae1304b0ac9800012b2a08",
|
60
|
+
"account_id": 16414779,
|
61
|
+
"institution_name": "Dag Site (US)",
|
62
|
+
"status": 6,
|
63
|
+
"status_message": "login failure",
|
64
|
+
"last_refreshed": "2016-08-12T18:18:48.043Z"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"_id": "57ae13a7b0ac9800012b2a0d",
|
68
|
+
"account_id": 16414781,
|
69
|
+
"institution_name": "Dag Site (US)",
|
70
|
+
"status": 6,
|
71
|
+
"status_message": "login failure",
|
72
|
+
"last_refreshed": "2016-08-12T18:21:35.988Z"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"_id": "57b1c04624fb48000130432f",
|
76
|
+
"account_id": 16412510,
|
77
|
+
"institution_name": "Dag Site (US)",
|
78
|
+
"status": 5,
|
79
|
+
"status_message": "processing",
|
80
|
+
"last_refreshed": "2016-08-15T13:14:46.019Z",
|
81
|
+
"accounts": [
|
82
|
+
{
|
83
|
+
"_id": "57b1c05512958000094763bb",
|
84
|
+
"user_institution_id": "57b1c04624fb48000130432f",
|
85
|
+
"user_institution_name": "Dag Site (US)",
|
86
|
+
"account_type": "bank",
|
87
|
+
"account_name": "Wells Fargo Checking",
|
88
|
+
"account_holder": "FinancialApps",
|
89
|
+
"account_display_name": "Dag Site - Bank - Wells Fargo Checking",
|
90
|
+
"details": {
|
91
|
+
"available_balance": 11673.83,
|
92
|
+
"current_balance": 11673.83,
|
93
|
+
"routing_number": ""
|
94
|
+
}
|
95
|
+
}
|
96
|
+
]
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"_id": "57b1c06524fb480001304333",
|
100
|
+
"account_id": 16443655,
|
101
|
+
"institution_name": "Dag Site (US)",
|
102
|
+
"status": 6,
|
103
|
+
"status_message": "login failure",
|
104
|
+
"last_refreshed": "2016-08-15T13:15:21.701Z"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"_id": "57b1d13324fb48000130437c",
|
108
|
+
"account_id": 16412510,
|
109
|
+
"institution_name": "Dag Site (US)",
|
110
|
+
"status": 5,
|
111
|
+
"status_message": "processing",
|
112
|
+
"last_refreshed": "2016-08-15T14:26:59.886Z",
|
113
|
+
"accounts": [
|
114
|
+
{
|
115
|
+
"_id": "57b1d1476e3b09000a73d715",
|
116
|
+
"user_institution_id": "57b1d13324fb48000130437c",
|
117
|
+
"user_institution_name": "Dag Site (US)",
|
118
|
+
"account_type": "bank",
|
119
|
+
"account_name": "Wells Fargo Checking",
|
120
|
+
"account_holder": "FinancialApps",
|
121
|
+
"account_display_name": "Dag Site - Bank - Wells Fargo Checking",
|
122
|
+
"details": {
|
123
|
+
"available_balance": 11673.83,
|
124
|
+
"current_balance": 11673.83,
|
125
|
+
"routing_number": ""
|
126
|
+
}
|
127
|
+
}
|
128
|
+
]
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"_id": "57ae161924fb480001304327",
|
132
|
+
"account_id": 16415373,
|
133
|
+
"institution_name": "Genesis Credit (US)",
|
134
|
+
"status": 11,
|
135
|
+
"status_message": "institution site error",
|
136
|
+
"last_refreshed": "2016-08-12T18:32:58.586Z"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"_id": "57b1c0c6b0ac9800012b2a22",
|
140
|
+
"account_id": 16415373,
|
141
|
+
"institution_name": "Genesis Credit (US)",
|
142
|
+
"status": 4,
|
143
|
+
"status_message": "refreshing",
|
144
|
+
"last_refreshed": "2016-08-15T13:16:54.964Z"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"_id": "57ae154224fb48000130431e",
|
148
|
+
"account_id": 16414784,
|
149
|
+
"institution_name": "Pincher Creek CU Limited (Canada)",
|
150
|
+
"status": 11,
|
151
|
+
"status_message": "institution site error",
|
152
|
+
"last_refreshed": "2016-08-12T18:28:43.752Z"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"_id": "57ae15b824fb480001304322",
|
156
|
+
"account_id": 16415370,
|
157
|
+
"institution_name": "United Auto Credit (US)",
|
158
|
+
"status": 11,
|
159
|
+
"status_message": "institution site error",
|
160
|
+
"last_refreshed": "2016-08-12T18:30:26.659Z"
|
161
|
+
}
|
162
|
+
]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"_id": "57ade50924fb4800013042de",
|
3
|
+
"account_id": 16412510,
|
4
|
+
"institution_name": "Dag Site (US)",
|
5
|
+
"status": 5,
|
6
|
+
"status_message": "processing",
|
7
|
+
"last_refreshed": "2016-08-12T15:02:33.416Z",
|
8
|
+
"accounts": [
|
9
|
+
{
|
10
|
+
"_id": "57ade52c6e3b09000af9d91b",
|
11
|
+
"user_institution_id": "57ade50924fb4800013042de",
|
12
|
+
"user_institution_name": "Dag Site (US)",
|
13
|
+
"account_type": "bank",
|
14
|
+
"account_name": "Wells Fargo Checking",
|
15
|
+
"account_holder": "FinancialApps",
|
16
|
+
"account_display_name": "Dag Site - Bank - Wells Fargo Checking",
|
17
|
+
"details": {
|
18
|
+
"available_balance": 11673.83,
|
19
|
+
"current_balance": 11673.83,
|
20
|
+
"routing_number": ""
|
21
|
+
}
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
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: 2.0.
|
4
|
+
version: 2.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -267,6 +267,9 @@ files:
|
|
267
267
|
- lib/finapps/rest/orders.rb
|
268
268
|
- lib/finapps/rest/resources.rb
|
269
269
|
- lib/finapps/rest/sessions.rb
|
270
|
+
- lib/finapps/rest/user_institutions.rb
|
271
|
+
- lib/finapps/rest/user_institutions_forms.rb
|
272
|
+
- lib/finapps/rest/user_institutions_statuses.rb
|
270
273
|
- lib/finapps/rest/users.rb
|
271
274
|
- lib/finapps/utils/loggeable.rb
|
272
275
|
- lib/finapps/version.rb
|
@@ -287,6 +290,9 @@ files:
|
|
287
290
|
- spec/rest/orders_spec.rb
|
288
291
|
- spec/rest/resources_spec.rb
|
289
292
|
- spec/rest/sessions_spec.rb
|
293
|
+
- spec/rest/user_institutions_forms_spec.rb
|
294
|
+
- spec/rest/user_institutions_spec.rb
|
295
|
+
- spec/rest/user_institutions_statuses_spec.rb
|
290
296
|
- spec/rest/users_spec.rb
|
291
297
|
- spec/spec_helper.rb
|
292
298
|
- spec/spec_helpers/client.rb
|
@@ -296,6 +302,8 @@ files:
|
|
296
302
|
- spec/support/fixtures/institution_login_form.json
|
297
303
|
- spec/support/fixtures/institutions_search_list.json
|
298
304
|
- spec/support/fixtures/invalid_institution_id.json
|
305
|
+
- spec/support/fixtures/invalid_request_body.json
|
306
|
+
- spec/support/fixtures/invalid_user_institution_id.json
|
299
307
|
- spec/support/fixtures/order_token.json
|
300
308
|
- spec/support/fixtures/orders.json
|
301
309
|
- spec/support/fixtures/relevance_ruleset_names.json
|
@@ -304,6 +312,10 @@ files:
|
|
304
312
|
- spec/support/fixtures/resources.json
|
305
313
|
- spec/support/fixtures/unauthorized.json
|
306
314
|
- spec/support/fixtures/user.json
|
315
|
+
- spec/support/fixtures/user_institution_refresh_all.json
|
316
|
+
- spec/support/fixtures/user_institution_status.json
|
317
|
+
- spec/support/fixtures/user_institutions_list.json
|
318
|
+
- spec/support/fixtures/user_institutions_show.json
|
307
319
|
homepage: https://github.com/finapps/ruby-client
|
308
320
|
licenses:
|
309
321
|
- MIT
|
@@ -330,28 +342,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
342
|
version: '0'
|
331
343
|
requirements: []
|
332
344
|
rubyforge_project:
|
333
|
-
rubygems_version: 2.
|
345
|
+
rubygems_version: 2.5.1
|
334
346
|
signing_key:
|
335
347
|
specification_version: 4
|
336
348
|
summary: FinApps REST API ruby client.
|
337
349
|
test_files:
|
338
|
-
- spec/
|
339
|
-
- spec/
|
340
|
-
- spec/core_extensions/hash/compact_spec.rb
|
350
|
+
- spec/support/fake_api.rb
|
351
|
+
- spec/middleware/request/user_agent_spec.rb
|
341
352
|
- spec/middleware/request/tenant_authentication_spec.rb
|
342
353
|
- spec/middleware/request/accept_json_spec.rb
|
343
|
-
- spec/middleware/request/user_agent_spec.rb
|
344
354
|
- spec/middleware/response/raise_error_spec.rb
|
345
|
-
- spec/
|
355
|
+
- spec/core_extensions/hash/compact_spec.rb
|
356
|
+
- spec/core_extensions/object/is_integer_spec.rb
|
357
|
+
- spec/spec_helpers/client.rb
|
346
358
|
- spec/spec_helper.rb
|
347
|
-
- spec/rest/configuration_spec.rb
|
348
|
-
- spec/rest/institutions_forms_spec.rb
|
349
|
-
- spec/rest/users_spec.rb
|
350
|
-
- spec/rest/sessions_spec.rb
|
351
|
-
- spec/rest/resources_spec.rb
|
352
359
|
- spec/rest/credentials_spec.rb
|
353
|
-
- spec/rest/orders_spec.rb
|
354
|
-
- spec/rest/client_spec.rb
|
355
|
-
- spec/rest/base_client_spec.rb
|
356
360
|
- spec/rest/order_tokens_spec.rb
|
357
361
|
- spec/rest/institutions_spec.rb
|
362
|
+
- spec/rest/users_spec.rb
|
363
|
+
- spec/rest/base_client_spec.rb
|
364
|
+
- spec/rest/user_institutions_forms_spec.rb
|
365
|
+
- spec/rest/user_institutions_statuses_spec.rb
|
366
|
+
- spec/rest/user_institutions_spec.rb
|
367
|
+
- spec/rest/client_spec.rb
|
368
|
+
- spec/rest/orders_spec.rb
|
369
|
+
- spec/rest/configuration_spec.rb
|
370
|
+
- spec/rest/resources_spec.rb
|
371
|
+
- spec/rest/institutions_forms_spec.rb
|
372
|
+
- spec/rest/sessions_spec.rb
|