finapps 5.0.3 → 5.0.4
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/.gitignore +3 -0
- data/.rubocop.yml +1 -7
- data/.tmuxinator.yml +19 -0
- data/Guardfile +42 -0
- data/finapps.gemspec +3 -1
- data/lib/finapps.rb +1 -7
- data/lib/finapps/rest/client.rb +5 -10
- data/lib/finapps/rest/consumers.rb +2 -1
- data/lib/finapps/rest/operators.rb +8 -2
- data/lib/finapps/rest/order_reports.rb +2 -1
- data/lib/finapps/rest/orders.rb +11 -9
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +15 -0
- data/lib/finapps/rest/portfolios_alerts.rb +2 -1
- data/lib/finapps/rest/portfolios_available_consumers.rb +2 -1
- data/lib/finapps/rest/portfolios_consumers.rb +6 -1
- data/lib/finapps/rest/products.rb +1 -2
- data/lib/finapps/rest/sessions.rb +8 -2
- data/lib/finapps/rest/statements.rb +2 -1
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +12 -7
- data/spec/rest/alert_occurrences_spec.rb +17 -5
- data/spec/rest/client_spec.rb +115 -57
- data/spec/rest/consumers_portfolios_spec.rb +9 -4
- data/spec/rest/consumers_spec.rb +76 -20
- data/spec/rest/operators_password_resets_spec.rb +19 -10
- data/spec/rest/operators_spec.rb +60 -22
- data/spec/rest/order_assignments_spec.rb +11 -5
- data/spec/rest/order_notifications_spec.rb +6 -2
- data/spec/rest/order_refreshes_spec.rb +11 -5
- data/spec/rest/order_reports_spec.rb +15 -5
- data/spec/rest/order_statuses_spec.rb +12 -4
- data/spec/rest/order_tokens_spec.rb +17 -5
- data/spec/rest/orders_spec.rb +80 -34
- data/spec/rest/password_resets_spec.rb +51 -14
- data/spec/rest/plaid/plaid_webhooks_spec.rb +7 -3
- data/spec/rest/portfolio_reports_spec.rb +9 -4
- data/spec/rest/portfolios_alerts_spec.rb +18 -10
- data/spec/rest/portfolios_available_consumers_spec.rb +9 -4
- data/spec/rest/portfolios_consumers_spec.rb +29 -11
- data/spec/rest/portfolios_spec.rb +51 -22
- data/spec/rest/products_spec.rb +5 -2
- data/spec/rest/sessions_spec.rb +36 -14
- data/spec/rest/statements_spec.rb +6 -2
- data/spec/rest/tenant_app_settings_spec.rb +13 -5
- data/spec/rest/tenant_settings_spec.rb +13 -5
- data/spec/rest/version_spec.rb +3 -1
- data/spec/spec_helper.rb +6 -4
- data/spec/spec_helpers/client.rb +2 -1
- data/spec/support/fake_api.rb +253 -119
- data/spec/utils/query_builder_spec.rb +8 -3
- data/tags +6 -0
- metadata +48 -25
- data/lib/finapps/rest/consumer_institution_refresh.rb +0 -14
- data/lib/finapps/rest/consumer_institution_refreshes.rb +0 -12
- data/lib/finapps/rest/institutions.rb +0 -34
- data/lib/finapps/rest/institutions_forms.rb +0 -14
- data/lib/finapps/rest/user_institutions.rb +0 -54
- data/lib/finapps/rest/user_institutions_forms.rb +0 -14
- data/lib/finapps/rest/user_institutions_statuses.rb +0 -19
- data/spec/rest/consumer_institution_refresh_spec.rb +0 -44
- data/spec/rest/consumer_institution_refreshes_spec.rb +0 -20
- data/spec/rest/institutions_forms_spec.rb +0 -29
- data/spec/rest/institutions_spec.rb +0 -55
- data/spec/rest/user_institutions_forms_spec.rb +0 -30
- data/spec/rest/user_institutions_spec.rb +0 -144
- data/spec/rest/user_institutions_statuses_spec.rb +0 -43
data/spec/rest/client_spec.rb
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
RSpec.describe FinApps::REST::Client do
|
4
4
|
describe '#new' do
|
5
5
|
it 'raises for missing company_token' do
|
6
|
-
expect { FinApps::REST::Client.new nil }.to raise_error(
|
6
|
+
expect { FinApps::REST::Client.new nil }.to raise_error(
|
7
|
+
FinAppsCore::MissingArgumentsError
|
8
|
+
)
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
@@ -21,141 +23,197 @@ RSpec.describe FinApps::REST::Client do
|
|
21
23
|
end
|
22
24
|
|
23
25
|
describe '#alert_definitions' do
|
24
|
-
it
|
26
|
+
it do
|
27
|
+
expect(subject.alert_definitions).to be_an_instance_of(
|
28
|
+
FinApps::REST::AlertDefinitions
|
29
|
+
)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
33
|
describe '#alert_occurrences' do
|
28
|
-
it
|
34
|
+
it do
|
35
|
+
expect(subject.alert_occurrences).to be_an_instance_of(
|
36
|
+
FinApps::REST::AlertOccurrences
|
37
|
+
)
|
38
|
+
end
|
29
39
|
end
|
30
40
|
|
31
41
|
describe '#version' do
|
32
|
-
it
|
42
|
+
it do
|
43
|
+
expect(subject.version).to be_an_instance_of(FinApps::REST::Version)
|
44
|
+
end
|
33
45
|
end
|
34
46
|
|
35
47
|
describe '#consumers' do
|
36
|
-
it { expect(subject.consumers).to be_an_instance_of(FinApps::REST::Consumers) }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#consumer_institution_refreshes' do
|
40
48
|
it do
|
41
|
-
expect(subject.
|
49
|
+
expect(subject.consumers).to be_an_instance_of(FinApps::REST::Consumers)
|
42
50
|
end
|
43
51
|
end
|
44
52
|
|
45
|
-
describe '#
|
53
|
+
describe '#plaid_webhooks' do
|
46
54
|
it do
|
47
|
-
expect(
|
55
|
+
expect(
|
56
|
+
subject.plaid_webhooks
|
57
|
+
).to be_an_instance_of FinApps::REST::PlaidWebhooks
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
51
61
|
describe '#sessions' do
|
52
|
-
it
|
62
|
+
it do
|
63
|
+
expect(subject.sessions).to be_an_instance_of(FinApps::REST::Sessions)
|
64
|
+
end
|
53
65
|
end
|
54
66
|
|
55
67
|
describe '#order_assignments' do
|
56
|
-
it
|
68
|
+
it do
|
69
|
+
expect(subject.order_assignments).to be_an_instance_of(
|
70
|
+
FinApps::REST::OrderAssignments
|
71
|
+
)
|
72
|
+
end
|
57
73
|
end
|
58
74
|
|
59
75
|
describe '#order_statuses' do
|
60
|
-
it
|
76
|
+
it do
|
77
|
+
expect(subject.order_notifications).to be_an_instance_of(
|
78
|
+
FinApps::REST::OrderNotifications
|
79
|
+
)
|
80
|
+
end
|
61
81
|
end
|
62
82
|
|
63
83
|
describe '#order_statuses' do
|
64
|
-
it
|
84
|
+
it do
|
85
|
+
expect(subject.order_statuses).to be_an_instance_of(
|
86
|
+
FinApps::REST::OrderStatuses
|
87
|
+
)
|
88
|
+
end
|
65
89
|
end
|
66
90
|
|
67
91
|
describe '#order_refreshes' do
|
68
|
-
it
|
92
|
+
it do
|
93
|
+
expect(subject.order_refreshes).to be_an_instance_of(
|
94
|
+
FinApps::REST::OrderRefreshes
|
95
|
+
)
|
96
|
+
end
|
69
97
|
end
|
70
98
|
|
71
99
|
describe '#order_reports' do
|
72
|
-
it
|
100
|
+
it do
|
101
|
+
expect(subject.order_reports).to be_an_instance_of(
|
102
|
+
FinApps::REST::OrderReports
|
103
|
+
)
|
104
|
+
end
|
73
105
|
end
|
74
106
|
|
75
107
|
describe '#order_tokens' do
|
76
|
-
it
|
108
|
+
it do
|
109
|
+
expect(subject.order_tokens).to be_an_instance_of(
|
110
|
+
FinApps::REST::OrderTokens
|
111
|
+
)
|
112
|
+
end
|
77
113
|
end
|
78
114
|
|
79
115
|
describe '#orders' do
|
80
116
|
it { expect(subject.orders).to be_an_instance_of(FinApps::REST::Orders) }
|
81
117
|
end
|
82
118
|
|
83
|
-
describe '#institutions' do
|
84
|
-
it { expect(subject.institutions).to be_an_instance_of(FinApps::REST::Institutions) }
|
85
|
-
end
|
86
|
-
|
87
|
-
describe '#institutions_forms' do
|
88
|
-
it { expect(subject.institutions_forms).to be_an_instance_of(FinApps::REST::InstitutionsForms) }
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#user_institutions_statuses' do
|
92
|
-
it { expect(subject.user_institutions_statuses).to be_an_instance_of(FinApps::REST::UserInstitutionsStatuses) }
|
93
|
-
end
|
94
|
-
|
95
|
-
describe '#user_institutions' do
|
96
|
-
it { expect(subject.user_institutions).to be_an_instance_of(FinApps::REST::UserInstitutions) }
|
97
|
-
end
|
98
|
-
|
99
|
-
describe '#user_institutions_forms' do
|
100
|
-
it { expect(subject.user_institutions_forms).to be_an_instance_of(FinApps::REST::UserInstitutionsForms) }
|
101
|
-
end
|
102
|
-
|
103
119
|
describe '#password_resets' do
|
104
|
-
it
|
120
|
+
it do
|
121
|
+
expect(subject.password_resets).to be_an_instance_of(
|
122
|
+
FinApps::REST::PasswordResets
|
123
|
+
)
|
124
|
+
end
|
105
125
|
end
|
106
126
|
|
107
127
|
describe '#operators_password_resets' do
|
108
|
-
it
|
128
|
+
it do
|
129
|
+
expect(subject.operators_password_resets).to be_an_instance_of(
|
130
|
+
FinApps::REST::OperatorsPasswordResets
|
131
|
+
)
|
132
|
+
end
|
109
133
|
end
|
110
134
|
|
111
135
|
describe '#operators' do
|
112
|
-
it
|
136
|
+
it do
|
137
|
+
expect(subject.operators).to be_an_instance_of(FinApps::REST::Operators)
|
138
|
+
end
|
113
139
|
end
|
114
140
|
|
115
141
|
describe '#products' do
|
116
|
-
it
|
142
|
+
it do
|
143
|
+
expect(subject.products).to be_an_instance_of(FinApps::REST::Products)
|
144
|
+
end
|
117
145
|
end
|
118
146
|
|
119
147
|
describe '#portfolios' do
|
120
|
-
it
|
148
|
+
it do
|
149
|
+
expect(subject.portfolios).to be_an_instance_of(
|
150
|
+
FinApps::REST::Portfolios
|
151
|
+
)
|
152
|
+
end
|
121
153
|
end
|
122
154
|
|
123
155
|
describe '#portfolios_alerts' do
|
124
|
-
it
|
156
|
+
it do
|
157
|
+
expect(subject.portfolios_alerts).to be_an_instance_of(
|
158
|
+
FinApps::REST::PortfoliosAlerts
|
159
|
+
)
|
160
|
+
end
|
125
161
|
end
|
126
162
|
|
127
163
|
describe '#portfolios_available_consumers' do
|
128
|
-
it
|
129
|
-
expect(subject.portfolios_available_consumers).to be_an_instance_of(
|
130
|
-
|
164
|
+
it do
|
165
|
+
expect(subject.portfolios_available_consumers).to be_an_instance_of(
|
166
|
+
FinApps::REST::PortfoliosAvailableConsumers
|
167
|
+
)
|
168
|
+
end
|
131
169
|
end
|
132
170
|
|
133
171
|
describe '#portfolios_consumers' do
|
134
|
-
it
|
172
|
+
it do
|
173
|
+
expect(subject.portfolios_consumers).to be_an_instance_of(
|
174
|
+
FinApps::REST::PortfoliosConsumers
|
175
|
+
)
|
176
|
+
end
|
135
177
|
end
|
136
178
|
|
137
179
|
describe '#consumers_portfolios' do
|
138
|
-
it
|
180
|
+
it do
|
181
|
+
expect(subject.consumers_portfolios).to be_an_instance_of(
|
182
|
+
FinApps::REST::ConsumersPortfolios
|
183
|
+
)
|
184
|
+
end
|
139
185
|
end
|
140
186
|
|
141
187
|
describe '#portfolio_reports' do
|
142
|
-
it
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
188
|
+
it do
|
189
|
+
expect(subject.portfolio_reports).to be_an_instance_of(
|
190
|
+
FinApps::REST::PortfolioReports
|
191
|
+
)
|
192
|
+
end
|
147
193
|
end
|
148
194
|
|
149
195
|
describe '#tenant_settings' do
|
150
|
-
it
|
196
|
+
it do
|
197
|
+
expect(subject.tenant_settings).to be_an_instance_of(
|
198
|
+
FinApps::REST::TenantSettings
|
199
|
+
)
|
200
|
+
end
|
151
201
|
end
|
152
202
|
|
153
203
|
describe '#tenant_app_settings' do
|
154
|
-
it
|
204
|
+
it do
|
205
|
+
expect(subject.tenant_app_settings).to be_an_instance_of(
|
206
|
+
FinApps::REST::TenantAppSettings
|
207
|
+
)
|
208
|
+
end
|
155
209
|
end
|
156
210
|
|
157
211
|
describe '#plaid_webhooks' do
|
158
|
-
it
|
212
|
+
it do
|
213
|
+
expect(subject.plaid_webhooks).to be_an_instance_of(
|
214
|
+
FinApps::REST::PlaidWebhooks
|
215
|
+
)
|
216
|
+
end
|
159
217
|
end
|
160
218
|
end
|
161
219
|
end
|
@@ -24,7 +24,9 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
24
24
|
|
25
25
|
it { expect { list }.not_to raise_error }
|
26
26
|
it('returns an array') { expect(list).to be_a(Array) }
|
27
|
-
it('performs a get and returns the response')
|
27
|
+
it('performs a get and returns the response') do
|
28
|
+
expect(results).to have_key(:records)
|
29
|
+
end
|
28
30
|
it('returns no error messages') { expect(errors).to be_empty }
|
29
31
|
end
|
30
32
|
|
@@ -41,12 +43,15 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
41
43
|
|
42
44
|
it { expect { list }.not_to raise_error }
|
43
45
|
it('returns an array') { expect(list).to be_a(Array) }
|
44
|
-
it('performs a get and returns the response')
|
46
|
+
it('performs a get and returns the response') do
|
47
|
+
expect(results).to have_key(:records)
|
48
|
+
end
|
45
49
|
it('returns no error messages') { expect(errors).to be_empty }
|
46
50
|
it 'builds query and sends proper request' do
|
47
51
|
list
|
48
|
-
url =
|
49
|
-
|
52
|
+
url =
|
53
|
+
"#{versioned_api_path}/consumers/#{id}/portfolios?page=2&" \
|
54
|
+
'requested=25&sort=-created_date'
|
50
55
|
expect(WebMock).to have_requested(:get, url)
|
51
56
|
end
|
52
57
|
end
|
data/spec/rest/consumers_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
-
RSpec.describe FinApps::REST::Consumers,
|
4
|
+
RSpec.describe FinApps::REST::Consumers,
|
5
|
+
'initialized with valid FinApps::Client object' do
|
5
6
|
include SpecHelpers::Client
|
6
7
|
subject(:users) { FinApps::REST::Consumers.new(client) }
|
7
8
|
missing_public_id = ': public_id'
|
@@ -11,15 +12,23 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
11
12
|
let(:error_messages) { create[1] }
|
12
13
|
|
13
14
|
context 'when missing params' do
|
14
|
-
it
|
15
|
+
it do
|
16
|
+
expect { subject.create(nil) }.to raise_error(
|
17
|
+
FinAppsCore::MissingArgumentsError
|
18
|
+
)
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
context 'for valid params' do
|
18
23
|
let(:create) { subject.create(email: 'email', password: 'password') }
|
19
24
|
|
20
25
|
it { expect { create }.not_to raise_error }
|
21
|
-
it('results is a
|
22
|
-
|
26
|
+
it('results is a Hash') do
|
27
|
+
expect(results).to be_a(Hash)
|
28
|
+
end
|
29
|
+
it('performs a post and returns the response') do
|
30
|
+
expect(results).to have_key(:public_id)
|
31
|
+
end
|
23
32
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
24
33
|
end
|
25
34
|
|
@@ -28,13 +37,20 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
28
37
|
|
29
38
|
it { expect { create }.not_to raise_error }
|
30
39
|
it('results is nil') { expect(results).to be_nil }
|
31
|
-
it('error messages array is populated')
|
40
|
+
it('error messages array is populated') do
|
41
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
42
|
+
end
|
32
43
|
end
|
33
44
|
end
|
34
45
|
|
35
46
|
describe '#show' do
|
36
47
|
context 'when missing public_id' do
|
37
|
-
it
|
48
|
+
it do
|
49
|
+
expect { subject.show(nil) }.to raise_error(
|
50
|
+
FinAppsCore::MissingArgumentsError,
|
51
|
+
missing_public_id
|
52
|
+
)
|
53
|
+
end
|
38
54
|
end
|
39
55
|
|
40
56
|
context 'for valid public_id' do
|
@@ -43,8 +59,12 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
43
59
|
let(:error_messages) { show[1] }
|
44
60
|
|
45
61
|
it { expect { show }.not_to raise_error }
|
46
|
-
it('results is a
|
47
|
-
|
62
|
+
it('results is a Hash') do
|
63
|
+
expect(results).to be_a(Hash)
|
64
|
+
end
|
65
|
+
it('performs a get and returns the response') do
|
66
|
+
expect(results).to have_key(:public_id)
|
67
|
+
end
|
48
68
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
49
69
|
end
|
50
70
|
|
@@ -55,13 +75,20 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
55
75
|
|
56
76
|
it { expect { show }.not_to raise_error }
|
57
77
|
it('results is nil') { expect(results).to be_nil }
|
58
|
-
it('error messages array is populated')
|
78
|
+
it('error messages array is populated') do
|
79
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
80
|
+
end
|
59
81
|
end
|
60
82
|
end
|
61
83
|
|
62
84
|
describe '#update' do
|
63
85
|
context 'when missing public_id' do
|
64
|
-
it
|
86
|
+
it do
|
87
|
+
expect { subject.update(nil, {}) }.to raise_error(
|
88
|
+
FinAppsCore::MissingArgumentsError,
|
89
|
+
missing_public_id
|
90
|
+
)
|
91
|
+
end
|
65
92
|
end
|
66
93
|
|
67
94
|
context 'when updating user details' do
|
@@ -76,45 +103,72 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
76
103
|
end
|
77
104
|
|
78
105
|
context 'for invalid public_id' do
|
79
|
-
let(:update)
|
106
|
+
let(:update) do
|
107
|
+
subject.update(:invalid_public_id, postal_code: '33021')
|
108
|
+
end
|
80
109
|
let(:results) { update[0] }
|
81
110
|
let(:error_messages) { update[1] }
|
82
111
|
|
83
112
|
it { expect { update }.not_to raise_error }
|
84
113
|
it('results is nil') { expect(results).to be_nil }
|
85
114
|
it('error messages array is populated') do
|
86
|
-
expect(error_messages.first.downcase).to eq(
|
115
|
+
expect(error_messages.first.downcase).to eq(
|
116
|
+
'invalid user id specified.'
|
117
|
+
)
|
87
118
|
end
|
88
119
|
end
|
89
120
|
end
|
90
121
|
|
91
122
|
context 'when updating password' do
|
92
123
|
context 'for valid public_id' do
|
93
|
-
let(:update)
|
124
|
+
let(:update) do
|
125
|
+
subject.update(
|
126
|
+
:valid_public_id,
|
127
|
+
password: 'Aa123456!', password_confirm: 'Aa123456!'
|
128
|
+
)
|
129
|
+
end
|
94
130
|
let(:results) { update[0] }
|
95
131
|
let(:error_messages) { update[1] }
|
96
132
|
|
97
133
|
it { expect { update }.not_to raise_error }
|
98
|
-
it('results is a
|
99
|
-
|
100
|
-
|
134
|
+
it('results is a Hash') do
|
135
|
+
expect(results).to be_a(Hash)
|
136
|
+
end
|
137
|
+
it('the public_id is on the results') do
|
138
|
+
expect(results).to have_key(:public_id)
|
139
|
+
end
|
140
|
+
it('the new token is on the results') do
|
141
|
+
expect(results).to have_key(:token)
|
142
|
+
end
|
101
143
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
102
144
|
end
|
103
145
|
|
104
146
|
context 'for invalid public_id' do
|
105
|
-
let(:update)
|
147
|
+
let(:update) do
|
148
|
+
subject.update(
|
149
|
+
:invalid_public_id,
|
150
|
+
password: 'Aa123456!', password_confirm: 'Aa123456!'
|
151
|
+
)
|
152
|
+
end
|
106
153
|
let(:results) { update[0] }
|
107
154
|
let(:error_messages) { update[1] }
|
108
155
|
|
109
156
|
it { expect { update }.not_to raise_error }
|
110
157
|
it('results is nil') { expect(results).to be_nil }
|
111
|
-
it('error messages array is populated')
|
158
|
+
it('error messages array is populated') do
|
159
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
160
|
+
end
|
112
161
|
end
|
113
162
|
end
|
114
163
|
|
115
164
|
describe '#destroy' do
|
116
165
|
context 'when missing public_id' do
|
117
|
-
it
|
166
|
+
it do
|
167
|
+
expect { subject.destroy(nil) }.to raise_error(
|
168
|
+
FinAppsCore::MissingArgumentsError,
|
169
|
+
missing_public_id
|
170
|
+
)
|
171
|
+
end
|
118
172
|
end
|
119
173
|
|
120
174
|
context 'for valid public_id' do
|
@@ -134,7 +188,9 @@ RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client
|
|
134
188
|
|
135
189
|
it { expect { destroy }.not_to raise_error }
|
136
190
|
it('results is nil') { expect(results).to be_nil }
|
137
|
-
it('error messages array is populated')
|
191
|
+
it('error messages array is populated') do
|
192
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
193
|
+
end
|
138
194
|
end
|
139
195
|
end
|
140
196
|
end
|