finapps 5.0.30 → 5.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yaml +37 -0
- data/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +29 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/README.md +1 -0
- data/RELEASES.md +29 -0
- data/finapps.gemspec +4 -4
- data/lib/finapps/rest/alert_definitions.rb +1 -1
- data/lib/finapps/rest/alert_occurrences.rb +1 -1
- data/lib/finapps/rest/client.rb +6 -5
- data/lib/finapps/rest/consumers.rb +22 -6
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +43 -26
- data/lib/finapps/rest/operators.rb +5 -5
- data/lib/finapps/rest/operators_password_resets.rb +1 -1
- data/lib/finapps/rest/order_assignments.rb +1 -1
- data/lib/finapps/rest/order_reports.rb +1 -1
- data/lib/finapps/rest/orders.rb +33 -22
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
- data/lib/finapps/rest/portfolio_reports.rb +1 -1
- data/lib/finapps/rest/portfolios.rb +1 -1
- data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
- data/lib/finapps/rest/portfolios_consumers.rb +1 -1
- data/lib/finapps/rest/sessions.rb +11 -9
- data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
- data/lib/finapps/utils/query_builder.rb +13 -4
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +10 -6
- data/spec/rest/alert_occurrences_spec.rb +6 -1
- data/spec/rest/api_request.rb +1 -0
- data/spec/rest/client_spec.rb +33 -41
- data/spec/rest/consumers_portfolios_spec.rb +7 -2
- data/spec/rest/consumers_spec.rb +240 -192
- data/spec/rest/documents_orders_notifications_spec.rb +4 -2
- data/spec/rest/documents_orders_spec.rb +94 -17
- data/spec/rest/esign_templates_spec.rb +2 -1
- data/spec/rest/operators_password_resets_spec.rb +50 -52
- data/spec/rest/operators_spec.rb +181 -172
- data/spec/rest/order_assignments_spec.rb +6 -1
- data/spec/rest/order_notifications_spec.rb +4 -2
- data/spec/rest/order_refreshes_spec.rb +8 -5
- data/spec/rest/order_reports_spec.rb +21 -15
- data/spec/rest/order_statuses_spec.rb +14 -10
- data/spec/rest/order_tokens_spec.rb +37 -30
- data/spec/rest/orders_spec.rb +121 -73
- data/spec/rest/password_resets_spec.rb +46 -36
- data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
- data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +11 -11
- data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
- data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
- data/spec/rest/portfolio_reports_spec.rb +7 -2
- data/spec/rest/portfolios_alerts_spec.rb +9 -4
- data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
- data/spec/rest/portfolios_consumers_spec.rb +15 -4
- data/spec/rest/portfolios_spec.rb +20 -17
- data/spec/rest/products_spec.rb +17 -14
- data/spec/rest/sessions_spec.rb +63 -58
- data/spec/rest/signed_documents_downloads_spec.rb +10 -6
- data/spec/rest/tenant_app_settings_spec.rb +9 -3
- data/spec/rest/tenant_settings_spec.rb +9 -3
- data/spec/rest/verix/verix_documents_spec.rb +15 -22
- data/spec/rest/verix/verix_metadata_spec.rb +1 -1
- data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
- data/spec/rest/verix/verix_records_spec.rb +31 -10
- data/spec/rest/version_spec.rb +6 -4
- data/spec/spec_helper.rb +2 -2
- data/spec/support/fake_api.rb +9 -3
- data/spec/support/fixtures/documents_orders_none.json +6 -0
- data/spec/utils/query_builder_spec.rb +40 -14
- metadata +20 -17
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::AlertOccurrences do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject {
|
7
|
+
subject { described_class.new(client) }
|
8
8
|
|
9
9
|
describe '#list' do
|
10
10
|
let(:list) { subject.list(params) }
|
@@ -16,9 +16,11 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
16
16
|
|
17
17
|
it { expect { list }.not_to raise_error }
|
18
18
|
it('returns an array') { expect(list).to be_a(Array) }
|
19
|
+
|
19
20
|
it('performs a get and returns the response') do
|
20
21
|
expect(results).to have_key(:records)
|
21
22
|
end
|
23
|
+
|
22
24
|
it('returns no error messages') { expect(errors).to be_empty }
|
23
25
|
end
|
24
26
|
|
@@ -40,10 +42,13 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
40
42
|
|
41
43
|
it { expect { list }.not_to raise_error }
|
42
44
|
it('returns an array') { expect(list).to be_a(Array) }
|
45
|
+
|
43
46
|
it('performs a get and returns the response') do
|
44
47
|
expect(results).to have_key(:records)
|
45
48
|
end
|
49
|
+
|
46
50
|
it('returns no error messages') { expect(errors).to be_empty }
|
51
|
+
|
47
52
|
it 'builds query and sends proper request' do
|
48
53
|
list
|
49
54
|
url =
|
data/spec/rest/api_request.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -3,28 +3,28 @@
|
|
3
3
|
RSpec.describe FinApps::REST::Client do
|
4
4
|
describe '#new' do
|
5
5
|
it 'raises for missing company_token' do
|
6
|
-
expect {
|
6
|
+
expect { described_class.new nil }.to raise_error(
|
7
7
|
FinAppsCore::MissingArgumentsError
|
8
8
|
)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
context 'an instance of Client' do
|
13
|
-
subject {
|
12
|
+
context 'with an instance of Client' do
|
13
|
+
subject(:client) { described_class.new(:company_token) }
|
14
14
|
|
15
15
|
FinApps::REST::Client::RESOURCES.each do |method|
|
16
|
-
it("responds to #{method}") { expect(
|
16
|
+
it("responds to #{method}") { expect(client).to respond_to(method) }
|
17
17
|
|
18
18
|
it "memoizes the result of #{method}" do
|
19
|
-
first =
|
20
|
-
second =
|
19
|
+
first = client.send(method)
|
20
|
+
second = client.send(method)
|
21
21
|
expect(first.object_id).to eq(second.object_id)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#alert_definitions' do
|
26
26
|
it do
|
27
|
-
expect(
|
27
|
+
expect(client.alert_definitions).to be_an_instance_of(
|
28
28
|
FinApps::REST::AlertDefinitions
|
29
29
|
)
|
30
30
|
end
|
@@ -32,7 +32,7 @@ RSpec.describe FinApps::REST::Client do
|
|
32
32
|
|
33
33
|
describe '#alert_occurrences' do
|
34
34
|
it do
|
35
|
-
expect(
|
35
|
+
expect(client.alert_occurrences).to be_an_instance_of(
|
36
36
|
FinApps::REST::AlertOccurrences
|
37
37
|
)
|
38
38
|
end
|
@@ -40,41 +40,41 @@ RSpec.describe FinApps::REST::Client do
|
|
40
40
|
|
41
41
|
describe '#version' do
|
42
42
|
it do
|
43
|
-
expect(
|
43
|
+
expect(client.version).to be_an_instance_of(FinApps::REST::Version)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe '#consumers' do
|
48
48
|
it do
|
49
|
-
expect(
|
49
|
+
expect(client.consumers).to be_an_instance_of(FinApps::REST::Consumers)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe '#plaid_webhooks' do
|
54
54
|
it do
|
55
55
|
expect(
|
56
|
-
|
56
|
+
client.plaid_webhooks
|
57
57
|
).to be_an_instance_of FinApps::REST::PlaidWebhooks
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe '#sessions' do
|
62
62
|
it do
|
63
|
-
expect(
|
63
|
+
expect(client.sessions).to be_an_instance_of(FinApps::REST::Sessions)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe '#order_assignments' do
|
68
68
|
it do
|
69
|
-
expect(
|
69
|
+
expect(client.order_assignments).to be_an_instance_of(
|
70
70
|
FinApps::REST::OrderAssignments
|
71
71
|
)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe '#
|
75
|
+
describe '#order_notifications' do
|
76
76
|
it do
|
77
|
-
expect(
|
77
|
+
expect(client.order_notifications).to be_an_instance_of(
|
78
78
|
FinApps::REST::OrderNotifications
|
79
79
|
)
|
80
80
|
end
|
@@ -82,7 +82,7 @@ RSpec.describe FinApps::REST::Client do
|
|
82
82
|
|
83
83
|
describe '#order_statuses' do
|
84
84
|
it do
|
85
|
-
expect(
|
85
|
+
expect(client.order_statuses).to be_an_instance_of(
|
86
86
|
FinApps::REST::OrderStatuses
|
87
87
|
)
|
88
88
|
end
|
@@ -90,7 +90,7 @@ RSpec.describe FinApps::REST::Client do
|
|
90
90
|
|
91
91
|
describe '#order_refreshes' do
|
92
92
|
it do
|
93
|
-
expect(
|
93
|
+
expect(client.order_refreshes).to be_an_instance_of(
|
94
94
|
FinApps::REST::OrderRefreshes
|
95
95
|
)
|
96
96
|
end
|
@@ -98,7 +98,7 @@ RSpec.describe FinApps::REST::Client do
|
|
98
98
|
|
99
99
|
describe '#order_reports' do
|
100
100
|
it do
|
101
|
-
expect(
|
101
|
+
expect(client.order_reports).to be_an_instance_of(
|
102
102
|
FinApps::REST::OrderReports
|
103
103
|
)
|
104
104
|
end
|
@@ -106,19 +106,19 @@ RSpec.describe FinApps::REST::Client do
|
|
106
106
|
|
107
107
|
describe '#order_tokens' do
|
108
108
|
it do
|
109
|
-
expect(
|
109
|
+
expect(client.order_tokens).to be_an_instance_of(
|
110
110
|
FinApps::REST::OrderTokens
|
111
111
|
)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
describe '#orders' do
|
116
|
-
it { expect(
|
116
|
+
it { expect(client.orders).to be_an_instance_of(FinApps::REST::Orders) }
|
117
117
|
end
|
118
118
|
|
119
119
|
describe '#password_resets' do
|
120
120
|
it do
|
121
|
-
expect(
|
121
|
+
expect(client.password_resets).to be_an_instance_of(
|
122
122
|
FinApps::REST::PasswordResets
|
123
123
|
)
|
124
124
|
end
|
@@ -126,7 +126,7 @@ RSpec.describe FinApps::REST::Client do
|
|
126
126
|
|
127
127
|
describe '#operators_password_resets' do
|
128
128
|
it do
|
129
|
-
expect(
|
129
|
+
expect(client.operators_password_resets).to be_an_instance_of(
|
130
130
|
FinApps::REST::OperatorsPasswordResets
|
131
131
|
)
|
132
132
|
end
|
@@ -134,19 +134,19 @@ RSpec.describe FinApps::REST::Client do
|
|
134
134
|
|
135
135
|
describe '#operators' do
|
136
136
|
it do
|
137
|
-
expect(
|
137
|
+
expect(client.operators).to be_an_instance_of(FinApps::REST::Operators)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
describe '#products' do
|
142
142
|
it do
|
143
|
-
expect(
|
143
|
+
expect(client.products).to be_an_instance_of(FinApps::REST::Products)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
describe '#portfolios' do
|
148
148
|
it do
|
149
|
-
expect(
|
149
|
+
expect(client.portfolios).to be_an_instance_of(
|
150
150
|
FinApps::REST::Portfolios
|
151
151
|
)
|
152
152
|
end
|
@@ -154,7 +154,7 @@ RSpec.describe FinApps::REST::Client do
|
|
154
154
|
|
155
155
|
describe '#portfolios_alerts' do
|
156
156
|
it do
|
157
|
-
expect(
|
157
|
+
expect(client.portfolios_alerts).to be_an_instance_of(
|
158
158
|
FinApps::REST::PortfoliosAlerts
|
159
159
|
)
|
160
160
|
end
|
@@ -162,7 +162,7 @@ RSpec.describe FinApps::REST::Client do
|
|
162
162
|
|
163
163
|
describe '#portfolios_available_consumers' do
|
164
164
|
it do
|
165
|
-
expect(
|
165
|
+
expect(client.portfolios_available_consumers).to be_an_instance_of(
|
166
166
|
FinApps::REST::PortfoliosAvailableConsumers
|
167
167
|
)
|
168
168
|
end
|
@@ -170,7 +170,7 @@ RSpec.describe FinApps::REST::Client do
|
|
170
170
|
|
171
171
|
describe '#portfolios_consumers' do
|
172
172
|
it do
|
173
|
-
expect(
|
173
|
+
expect(client.portfolios_consumers).to be_an_instance_of(
|
174
174
|
FinApps::REST::PortfoliosConsumers
|
175
175
|
)
|
176
176
|
end
|
@@ -178,7 +178,7 @@ RSpec.describe FinApps::REST::Client do
|
|
178
178
|
|
179
179
|
describe '#consumers_portfolios' do
|
180
180
|
it do
|
181
|
-
expect(
|
181
|
+
expect(client.consumers_portfolios).to be_an_instance_of(
|
182
182
|
FinApps::REST::ConsumersPortfolios
|
183
183
|
)
|
184
184
|
end
|
@@ -186,7 +186,7 @@ RSpec.describe FinApps::REST::Client do
|
|
186
186
|
|
187
187
|
describe '#portfolio_reports' do
|
188
188
|
it do
|
189
|
-
expect(
|
189
|
+
expect(client.portfolio_reports).to be_an_instance_of(
|
190
190
|
FinApps::REST::PortfolioReports
|
191
191
|
)
|
192
192
|
end
|
@@ -194,7 +194,7 @@ RSpec.describe FinApps::REST::Client do
|
|
194
194
|
|
195
195
|
describe '#tenant_settings' do
|
196
196
|
it do
|
197
|
-
expect(
|
197
|
+
expect(client.tenant_settings).to be_an_instance_of(
|
198
198
|
FinApps::REST::TenantSettings
|
199
199
|
)
|
200
200
|
end
|
@@ -202,23 +202,15 @@ RSpec.describe FinApps::REST::Client do
|
|
202
202
|
|
203
203
|
describe '#tenant_app_settings' do
|
204
204
|
it do
|
205
|
-
expect(
|
205
|
+
expect(client.tenant_app_settings).to be_an_instance_of(
|
206
206
|
FinApps::REST::TenantAppSettings
|
207
207
|
)
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
describe '#plaid_webhooks' do
|
212
|
-
it do
|
213
|
-
expect(subject.plaid_webhooks).to be_an_instance_of(
|
214
|
-
FinApps::REST::PlaidWebhooks
|
215
|
-
)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
211
|
describe '#plaid_institution_logos' do
|
220
212
|
it do
|
221
|
-
expect(
|
213
|
+
expect(client.plaid_institution_logos).to be_an_instance_of(
|
222
214
|
FinApps::REST::PlaidInstitutionLogos
|
223
215
|
)
|
224
216
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::ConsumersPortfolios do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject {
|
7
|
+
subject { described_class.new(client) }
|
8
8
|
|
9
9
|
describe '#list' do
|
10
10
|
let(:list) { subject.list(id, params) }
|
@@ -24,9 +24,11 @@ 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
|
+
|
27
28
|
it('performs a get and returns the response') do
|
28
29
|
expect(results).to have_key(:records)
|
29
30
|
end
|
31
|
+
|
30
32
|
it('returns no error messages') { expect(errors).to be_empty }
|
31
33
|
end
|
32
34
|
|
@@ -39,14 +41,17 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
39
41
|
|
40
42
|
context 'when including valid params' do
|
41
43
|
let(:id) { 'valid_id' }
|
42
|
-
let(:params) { {
|
44
|
+
let(:params) { {page: 2, sort: '-created_date', requested: 25} }
|
43
45
|
|
44
46
|
it { expect { list }.not_to raise_error }
|
45
47
|
it('returns an array') { expect(list).to be_a(Array) }
|
48
|
+
|
46
49
|
it('performs a get and returns the response') do
|
47
50
|
expect(results).to have_key(:records)
|
48
51
|
end
|
52
|
+
|
49
53
|
it('returns no error messages') { expect(errors).to be_empty }
|
54
|
+
|
50
55
|
it 'builds query and sends proper request' do
|
51
56
|
list
|
52
57
|
url =
|
data/spec/rest/consumers_spec.rb
CHANGED
@@ -1,261 +1,309 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
-
RSpec.describe FinApps::REST::Consumers
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
describe '#create' do
|
11
|
-
let(:results) { create[0] }
|
12
|
-
let(:error_messages) { create[1] }
|
13
|
-
|
14
|
-
context 'when missing params' do
|
15
|
-
it do
|
16
|
-
expect { subject.create(nil) }.to raise_error(
|
17
|
-
FinAppsCore::MissingArgumentsError
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end
|
4
|
+
RSpec.describe FinApps::REST::Consumers do
|
5
|
+
context 'when initialized with valid FinApps::Client object' do
|
6
|
+
include SpecHelpers::Client
|
7
|
+
subject(:users) { described_class.new(client) }
|
8
|
+
|
9
|
+
missing_public_id = ': public_id'
|
21
10
|
|
22
|
-
|
23
|
-
let(:
|
11
|
+
describe '#create' do
|
12
|
+
let(:results) { create[0] }
|
13
|
+
let(:error_messages) { create[1] }
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
context 'when missing params' do
|
16
|
+
it do
|
17
|
+
expect { users.create(nil) }.to raise_error(
|
18
|
+
FinAppsCore::MissingArgumentsError
|
19
|
+
)
|
20
|
+
end
|
29
21
|
end
|
30
|
-
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
31
|
-
end
|
32
22
|
|
33
|
-
|
34
|
-
|
23
|
+
context 'with valid params' do
|
24
|
+
let(:create) { subject.create(email: 'email', password: 'password') }
|
25
|
+
|
26
|
+
it { expect { create }.not_to raise_error }
|
27
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
28
|
+
|
29
|
+
it('performs a post and returns the response') do
|
30
|
+
expect(results).to have_key(:public_id)
|
31
|
+
end
|
35
32
|
|
36
|
-
|
37
|
-
it('results is nil') { expect(results).to be_nil }
|
38
|
-
it('error messages array is populated') do
|
39
|
-
expect(error_messages.first.downcase).to eq('invalid request body')
|
33
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
40
34
|
end
|
41
|
-
end
|
42
|
-
end
|
43
35
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
36
|
+
context 'with invalid params' do
|
37
|
+
let(:create) { subject.create(email: 'email') }
|
38
|
+
|
39
|
+
it { expect { create }.not_to raise_error }
|
40
|
+
it('results is nil') { expect(results).to be_nil }
|
48
41
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
it('performs a get and returns the response') do
|
53
|
-
expect(results).to have_key(:records)
|
42
|
+
it('error messages array is populated') do
|
43
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
44
|
+
end
|
54
45
|
end
|
55
|
-
it('returns an array of records') { expect(results[:records]).to be_a(Array) }
|
56
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
57
46
|
end
|
58
47
|
|
59
|
-
|
60
|
-
let(:
|
48
|
+
describe '#list' do
|
49
|
+
let(:list) { subject.list(params) }
|
50
|
+
let(:results) { list[0] }
|
51
|
+
let(:error_messages) { list[1] }
|
61
52
|
|
62
|
-
|
63
|
-
|
53
|
+
context 'when missing params' do
|
54
|
+
let(:params) { nil }
|
64
55
|
|
65
|
-
|
66
|
-
let(:params) do
|
67
|
-
{
|
68
|
-
page: 3,
|
69
|
-
requested: 19
|
70
|
-
}
|
71
|
-
end
|
56
|
+
it { expect { list }.not_to raise_error }
|
72
57
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
expect(results).to have_key(:records)
|
77
|
-
end
|
78
|
-
it('returns no error messages') do
|
79
|
-
expect(error_messages).to be_empty
|
80
|
-
end
|
81
|
-
it 'builds query and sends proper request' do
|
82
|
-
list
|
83
|
-
url = "#{versioned_api_path}/consumers?page=3&requested=19"
|
84
|
-
expect(WebMock).to have_requested(:get, url)
|
85
|
-
end
|
86
|
-
end
|
58
|
+
it('performs a get and returns the response') do
|
59
|
+
expect(results).to have_key(:records)
|
60
|
+
end
|
87
61
|
|
88
|
-
|
89
|
-
|
90
|
-
{
|
91
|
-
page: 2,
|
92
|
-
sort: 'date_created',
|
93
|
-
requested: 25,
|
94
|
-
searchTerm: 'term'
|
95
|
-
}
|
62
|
+
it('returns an array of records') { expect(results[:records]).to be_a(Array) }
|
63
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
96
64
|
end
|
97
65
|
|
98
|
-
|
99
|
-
|
100
|
-
it('performs a get and returns the response') do
|
101
|
-
expect(results).to have_key(:records)
|
102
|
-
end
|
103
|
-
it('returns no error messages') do
|
104
|
-
expect(error_messages).to be_empty
|
105
|
-
end
|
106
|
-
it 'builds query and sends proper request' do
|
107
|
-
list
|
108
|
-
url = "#{versioned_api_path}/consumers?filter=%7B%22$or%22:%5B%7B%22email%22:%22term%22%7D," \
|
109
|
-
'%7B%22first_name%22:%22term%22%7D,%7B%22last_name%22:%22term%22%7D%5D%7D&page=2&requested=25' \
|
110
|
-
'&sort=date_created'
|
111
|
-
expect(WebMock).to have_requested(:get, url)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
66
|
+
context 'when invalid params are provided' do
|
67
|
+
let(:params) { ['invalid array'] }
|
115
68
|
|
116
|
-
|
117
|
-
context 'when missing public_id' do
|
118
|
-
it do
|
119
|
-
expect { subject.show(nil) }.to raise_error(
|
120
|
-
FinAppsCore::MissingArgumentsError,
|
121
|
-
missing_public_id
|
122
|
-
)
|
69
|
+
it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
123
70
|
end
|
124
|
-
end
|
125
71
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
72
|
+
context 'when including valid params without searchTerm' do
|
73
|
+
let(:params) do
|
74
|
+
{
|
75
|
+
page: 3,
|
76
|
+
requested: 19
|
77
|
+
}
|
78
|
+
end
|
130
79
|
|
131
|
-
|
132
|
-
|
133
|
-
it('performs a get and returns the response') do
|
134
|
-
expect(results).to have_key(:public_id)
|
135
|
-
end
|
136
|
-
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
137
|
-
end
|
80
|
+
it { expect { list }.not_to raise_error }
|
81
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
138
82
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
let(:error_messages) { show[1] }
|
83
|
+
it('performs a get and returns the response') do
|
84
|
+
expect(results).to have_key(:records)
|
85
|
+
end
|
143
86
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
expect(error_messages.first.downcase).to eq('resource not found')
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
87
|
+
it('returns no error messages') do
|
88
|
+
expect(error_messages).to be_empty
|
89
|
+
end
|
151
90
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
missing_public_id
|
158
|
-
)
|
91
|
+
it 'builds query and sends proper request' do
|
92
|
+
list
|
93
|
+
url = "#{versioned_api_path}/consumers?page=3&requested=19"
|
94
|
+
expect(WebMock).to have_requested(:get, url)
|
95
|
+
end
|
159
96
|
end
|
160
|
-
end
|
161
97
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
98
|
+
context 'when including valid params with searchTerm' do
|
99
|
+
let(:params) do
|
100
|
+
{
|
101
|
+
page: 2,
|
102
|
+
sort: 'date_created',
|
103
|
+
requested: 25,
|
104
|
+
searchTerm: 'term'
|
105
|
+
}
|
106
|
+
end
|
167
107
|
|
168
|
-
it { expect {
|
169
|
-
it('
|
170
|
-
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
171
|
-
end
|
108
|
+
it { expect { list }.not_to raise_error }
|
109
|
+
it('returns an array') { expect(list).to be_a(Array) }
|
172
110
|
|
173
|
-
|
174
|
-
|
175
|
-
subject.update(:invalid_public_id, postal_code: '33021')
|
111
|
+
it('performs a get and returns the response') do
|
112
|
+
expect(results).to have_key(:records)
|
176
113
|
end
|
177
|
-
let(:results) { update[0] }
|
178
|
-
let(:error_messages) { update[1] }
|
179
114
|
|
180
|
-
it
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
115
|
+
it('returns no error messages') do
|
116
|
+
expect(error_messages).to be_empty
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'builds query and sends proper request' do
|
120
|
+
list
|
121
|
+
url = "#{versioned_api_path}/consumers?"\
|
122
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22term%22%7D,' \
|
123
|
+
'%7B%22first_name%22:%22term%22%7D,'\
|
124
|
+
'%7B%22last_name%22:%22term%22%7D%5D%7D&page=2&requested=25' \
|
125
|
+
'&sort=date_created'
|
126
|
+
expect(WebMock).to have_requested(:get, url)
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'when search term contains a space' do
|
130
|
+
let(:params) do
|
131
|
+
{
|
132
|
+
page: 2,
|
133
|
+
sort: 'date_created',
|
134
|
+
requested: 25,
|
135
|
+
searchTerm: 'Two terms'
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'treats space as start of a new query for first and last name' do
|
140
|
+
list
|
141
|
+
url = "#{versioned_api_path}/consumers?"\
|
142
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22Two%20terms%22%7D,'\
|
143
|
+
'%7B%22first_name%22:%22Two%20terms%22%7D,'\
|
144
|
+
'%7B%22last_name%22:%22Two%20terms%22%7D,%7B%22first_name%22:'\
|
145
|
+
'%22Two%22%7D,%7B%22last_name%22:%22Two%22%7D,'\
|
146
|
+
'%7B%22first_name%22:%22terms%22%7D,%7B%22last_name%22:'\
|
147
|
+
'%22terms%22%7D%5D%7D&page=2&requested=25&sort=date_created'
|
148
|
+
expect(WebMock).to have_requested(:get, url)
|
149
|
+
end
|
186
150
|
end
|
187
151
|
end
|
188
152
|
end
|
189
153
|
|
190
|
-
|
191
|
-
context '
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
154
|
+
describe '#show' do
|
155
|
+
context 'when missing public_id' do
|
156
|
+
it do
|
157
|
+
expect { users.show(nil) }.to raise_error(
|
158
|
+
FinAppsCore::MissingArgumentsError,
|
159
|
+
missing_public_id
|
196
160
|
)
|
197
161
|
end
|
198
|
-
|
199
|
-
let(:error_messages) { update[1] }
|
162
|
+
end
|
200
163
|
|
201
|
-
|
164
|
+
context 'with valid public_id' do
|
165
|
+
let(:show) { users.show(:valid_public_id) }
|
166
|
+
let(:results) { show[0] }
|
167
|
+
let(:error_messages) { show[1] }
|
168
|
+
|
169
|
+
it { expect { show }.not_to raise_error }
|
202
170
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
203
|
-
|
171
|
+
|
172
|
+
it('performs a get and returns the response') do
|
204
173
|
expect(results).to have_key(:public_id)
|
205
174
|
end
|
206
|
-
|
207
|
-
expect(results).to have_key(:token)
|
208
|
-
end
|
175
|
+
|
209
176
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
210
177
|
end
|
211
178
|
|
212
|
-
context '
|
213
|
-
let(:
|
214
|
-
|
215
|
-
|
216
|
-
password: 'Aa123456!', password_confirm: 'Aa123456!'
|
217
|
-
)
|
218
|
-
end
|
219
|
-
let(:results) { update[0] }
|
220
|
-
let(:error_messages) { update[1] }
|
179
|
+
context 'with invalid token' do
|
180
|
+
let(:show) { users.show(:invalid_public_id) }
|
181
|
+
let(:results) { show[0] }
|
182
|
+
let(:error_messages) { show[1] }
|
221
183
|
|
222
|
-
it { expect {
|
184
|
+
it { expect { show }.not_to raise_error }
|
223
185
|
it('results is nil') { expect(results).to be_nil }
|
186
|
+
|
224
187
|
it('error messages array is populated') do
|
225
188
|
expect(error_messages.first.downcase).to eq('resource not found')
|
226
189
|
end
|
227
190
|
end
|
228
191
|
end
|
229
192
|
|
230
|
-
describe '#
|
193
|
+
describe '#update' do
|
231
194
|
context 'when missing public_id' do
|
232
195
|
it do
|
233
|
-
expect {
|
196
|
+
expect { users.update(nil, {}) }.to raise_error(
|
234
197
|
FinAppsCore::MissingArgumentsError,
|
235
198
|
missing_public_id
|
236
199
|
)
|
237
200
|
end
|
238
201
|
end
|
239
202
|
|
240
|
-
context '
|
241
|
-
|
242
|
-
|
243
|
-
|
203
|
+
context 'when updating user details' do
|
204
|
+
context 'with valid public_id' do
|
205
|
+
let(:update) { users.update(:valid_public_id, postal_code: '33021') }
|
206
|
+
let(:results) { update[0] }
|
207
|
+
let(:error_messages) { update[1] }
|
244
208
|
|
245
|
-
|
246
|
-
|
247
|
-
|
209
|
+
it { expect { update }.not_to raise_error }
|
210
|
+
it('results is nil') { expect(results).to be_nil }
|
211
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
212
|
+
end
|
213
|
+
|
214
|
+
context 'with invalid public_id' do
|
215
|
+
let(:update) do
|
216
|
+
subject.update(:invalid_public_id, postal_code: '33021')
|
217
|
+
end
|
218
|
+
let(:results) { update[0] }
|
219
|
+
let(:error_messages) { update[1] }
|
220
|
+
|
221
|
+
it { expect { update }.not_to raise_error }
|
222
|
+
it('results is nil') { expect(results).to be_nil }
|
223
|
+
|
224
|
+
it('error messages array is populated') do
|
225
|
+
expect(error_messages.first.downcase).to eq(
|
226
|
+
'invalid user id specified.'
|
227
|
+
)
|
228
|
+
end
|
229
|
+
end
|
248
230
|
end
|
249
231
|
|
250
|
-
context '
|
251
|
-
|
252
|
-
|
253
|
-
|
232
|
+
context 'when updating password' do
|
233
|
+
context 'with valid public_id' do
|
234
|
+
let(:update) do
|
235
|
+
subject.update(
|
236
|
+
:valid_public_id,
|
237
|
+
password: 'Aa123456!', password_confirm: 'Aa123456!'
|
238
|
+
)
|
239
|
+
end
|
240
|
+
let(:results) { update[0] }
|
241
|
+
let(:error_messages) { update[1] }
|
242
|
+
|
243
|
+
it { expect { update }.not_to raise_error }
|
244
|
+
it('results is a Hash') { expect(results).to be_a(Hash) }
|
245
|
+
|
246
|
+
it('the public_id is on the results') do
|
247
|
+
expect(results).to have_key(:public_id)
|
248
|
+
end
|
249
|
+
|
250
|
+
it('the new token is on the results') do
|
251
|
+
expect(results).to have_key(:token)
|
252
|
+
end
|
253
|
+
|
254
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
255
|
+
end
|
254
256
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
257
|
+
context 'with invalid public_id' do
|
258
|
+
let(:update) do
|
259
|
+
subject.update(
|
260
|
+
:invalid_public_id,
|
261
|
+
password: 'Aa123456!', password_confirm: 'Aa123456!'
|
262
|
+
)
|
263
|
+
end
|
264
|
+
let(:results) { update[0] }
|
265
|
+
let(:error_messages) { update[1] }
|
266
|
+
|
267
|
+
it { expect { update }.not_to raise_error }
|
268
|
+
it('results is nil') { expect(results).to be_nil }
|
269
|
+
|
270
|
+
it('error messages array is populated') do
|
271
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe '#destroy' do
|
277
|
+
context 'when missing public_id' do
|
278
|
+
it do
|
279
|
+
expect { users.destroy(nil) }.to raise_error(
|
280
|
+
FinAppsCore::MissingArgumentsError,
|
281
|
+
missing_public_id
|
282
|
+
)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context 'with valid public_id' do
|
287
|
+
let(:destroy) { users.destroy(:valid_public_id) }
|
288
|
+
let(:results) { destroy[0] }
|
289
|
+
let(:error_messages) { destroy[1] }
|
290
|
+
|
291
|
+
it { expect { destroy }.not_to raise_error }
|
292
|
+
it('results is nil') { expect(results).to be_nil }
|
293
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'with invalid token' do
|
297
|
+
let(:destroy) { subject.destroy(:invalid_public_id) }
|
298
|
+
let(:results) { destroy[0] }
|
299
|
+
let(:error_messages) { destroy[1] }
|
300
|
+
|
301
|
+
it { expect { destroy }.not_to raise_error }
|
302
|
+
it('results is nil') { expect(results).to be_nil }
|
303
|
+
|
304
|
+
it('error messages array is populated') do
|
305
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
306
|
+
end
|
259
307
|
end
|
260
308
|
end
|
261
309
|
end
|