finapps 6.4.0 → 6.5.0
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/.github/release-drafter.yml +1 -1
- data/lib/finapps/rest/operators.rb +23 -12
- data/lib/finapps/rest/screenings.rb +3 -8
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/documents_orders_spec.rb +2 -2
- data/spec/rest/documents_upload_types_spec.rb +1 -1
- data/spec/rest/documents_uploads_spec.rb +1 -1
- data/spec/rest/esign_templates_spec.rb +1 -1
- data/spec/rest/operators_spec.rb +164 -170
- data/spec/rest/plaid/plaid_account_permissions_spec.rb +1 -1
- data/spec/rest/plaid/plaid_accounts_spec.rb +1 -1
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +1 -1
- data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
- data/spec/rest/plaid/plaid_webhooks_spec.rb +1 -1
- data/spec/rest/screenings_spec.rb +59 -52
- data/spec/rest/signed_documents_downloads_spec.rb +1 -1
- data/spec/rest/verix/verix_documents_spec.rb +1 -1
- data/spec/rest/verix/verix_metadata_spec.rb +1 -1
- data/spec/rest/verix/verix_pdf_documents_spec.rb +1 -1
- data/spec/rest/verix/verix_records_spec.rb +1 -1
- data/spec/{rest → spec_helpers}/api_request.rb +11 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e80a928ff71e2322588992ecaaccb749ef54da3885b691b7397fc0e78be6061
|
4
|
+
data.tar.gz: c37736f652f09f2c7066e9a45df9c4718b9c933d914716251d5e3105d9bb465f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a0e0ca416920b490133e964d36b4a6a86a0c5c759cbf01a30e1b3158ef66abe1c67ecf3fe2d90fb20355824a69839585090bb16fe21448468c28704bab32aa
|
7
|
+
data.tar.gz: 33788efee5a351ff06001daa933578a54965de86e9b949cc8b1631e93a3c890f888d890a5e5e9af8939679d0bf2ba83702034621ae10503d27885aced872e8a3
|
data/.github/release-drafter.yml
CHANGED
@@ -39,7 +39,7 @@ exclude-labels:
|
|
39
39
|
- invalid
|
40
40
|
|
41
41
|
template: |
|
42
|
-
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client/compare/$PREVIOUS_TAG
|
42
|
+
## [$RESOLVED_VERSION](https://github.com/finapps/ruby-client/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION)
|
43
43
|
$CHANGES
|
44
44
|
|
45
45
|
replacers:
|
@@ -57,22 +57,33 @@ module FinApps
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def build_filter(params)
|
60
|
-
|
61
|
-
filter.merge!(search_query(params[:searchTerm])) if params[:searchTerm]
|
62
|
-
filter.merge!(role_query(params[:role])) if params[:role]
|
63
|
-
filter
|
60
|
+
term_filter(params[:searchTerm]).merge(role_filter(params[:role]))
|
64
61
|
end
|
65
62
|
|
66
|
-
def
|
67
|
-
{
|
63
|
+
def term_filter(term)
|
64
|
+
return {} unless term
|
65
|
+
|
66
|
+
{'$or': term_array(term)}
|
67
|
+
end
|
68
|
+
|
69
|
+
def term_array(term)
|
70
|
+
[
|
71
|
+
{email: term},
|
72
|
+
{last_name: term}
|
73
|
+
]
|
74
|
+
end
|
75
|
+
|
76
|
+
def role_filter(role)
|
77
|
+
return {} unless role
|
78
|
+
|
79
|
+
roles = to_integers_array(role)
|
80
|
+
return {} if roles.empty?
|
81
|
+
|
82
|
+
{role: {'$in': roles}}
|
68
83
|
end
|
69
84
|
|
70
|
-
def
|
71
|
-
|
72
|
-
{role: {'$in': role.map(&:to_i)}}
|
73
|
-
else
|
74
|
-
{role: role.to_i}
|
75
|
-
end
|
85
|
+
def to_integers_array(role)
|
86
|
+
(role.respond_to?(:map) ? role : [role]).map {|i| Integer(i) }.compact
|
76
87
|
end
|
77
88
|
end
|
78
89
|
end
|
@@ -98,24 +98,19 @@ module FinApps
|
|
98
98
|
def from_filter(from_date)
|
99
99
|
return {} unless from_date
|
100
100
|
|
101
|
-
{'$gte':
|
101
|
+
{'$gte': from_date}
|
102
102
|
end
|
103
103
|
|
104
104
|
def to_filter(to_date)
|
105
105
|
return {} unless to_date
|
106
106
|
|
107
|
-
{'$lt':
|
108
|
-
end
|
109
|
-
|
110
|
-
def to_rfc_date(str)
|
111
|
-
date = DateTime.parse(str)
|
112
|
-
date.rfc3339
|
107
|
+
{'$lt': to_date}
|
113
108
|
end
|
114
109
|
|
115
110
|
def progress_filter(progress)
|
116
111
|
return {} unless progress
|
117
112
|
|
118
|
-
{progress: progress}
|
113
|
+
{progress: Integer(progress)}
|
119
114
|
end
|
120
115
|
|
121
116
|
def space?(string)
|
data/lib/finapps/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
-
require '
|
4
|
+
require 'spec_helpers/api_request'
|
5
5
|
|
6
6
|
RSpec.describe FinApps::REST::DocumentsOrders do
|
7
7
|
include SpecHelpers::Client
|
@@ -215,7 +215,7 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
context 'with missing
|
218
|
+
context 'with missing params' do
|
219
219
|
let(:params) { nil }
|
220
220
|
|
221
221
|
it_behaves_like 'a request that raises an error'
|
data/spec/rest/operators_spec.rb
CHANGED
@@ -1,251 +1,245 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
+
require 'spec_helpers/api_request'
|
4
5
|
|
5
6
|
RSpec.describe FinApps::REST::Operators do
|
6
|
-
|
7
|
-
include SpecHelpers::Client
|
8
|
-
subject(:operators) { described_class.new(client) }
|
7
|
+
include SpecHelpers::Client
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
let(:results) { list[0] }
|
13
|
-
let(:error_messages) { list[1] }
|
9
|
+
let(:results) { subject[RESULTS] }
|
10
|
+
let(:error_messages) { subject[ERROR_MESSAGES] }
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
it { expect { list }.not_to raise_error }
|
12
|
+
describe '#list' do
|
13
|
+
subject(:list) { described_class.new(client).list(params) }
|
19
14
|
|
20
|
-
|
21
|
-
|
15
|
+
context 'with valid params' do
|
16
|
+
RSpec.shared_examples 'a filtereable GET index request' do |filter|
|
17
|
+
it_behaves_like 'an API request'
|
18
|
+
it_behaves_like 'a successful request'
|
19
|
+
it_behaves_like 'a GET index request'
|
20
|
+
it 'builds query and sends proper request' do
|
21
|
+
query_string = ("?filter=#{ERB::Util.url_encode filter.to_json}" if filter)
|
22
|
+
url = "#{versioned_api_path}/operators#{query_string}"
|
23
|
+
list
|
24
|
+
expect(WebMock).to have_requested(:get, url)
|
22
25
|
end
|
26
|
+
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
context 'with searchTerm' do
|
29
|
+
let(:params) { {searchTerm: 'le term'} }
|
30
|
+
|
31
|
+
it_behaves_like 'a filtereable GET index request', {
|
32
|
+
'$or': [
|
33
|
+
{email: 'le term'},
|
34
|
+
{last_name: 'le term'}
|
35
|
+
]
|
36
|
+
}
|
37
|
+
end
|
27
38
|
|
28
|
-
|
39
|
+
context 'with valid role' do
|
40
|
+
let(:params) { {role: 1} }
|
41
|
+
|
42
|
+
it_behaves_like 'a filtereable GET index request', {role: {'$in': [1]}}
|
29
43
|
end
|
30
44
|
|
31
|
-
context '
|
32
|
-
let(:params) {
|
45
|
+
context 'with empty params' do
|
46
|
+
let(:params) { nil }
|
33
47
|
|
34
|
-
|
48
|
+
it_behaves_like 'a filtereable GET index request', nil
|
35
49
|
end
|
36
50
|
|
37
|
-
context '
|
51
|
+
context 'with searchTerm, page, sort, requested and role' do
|
38
52
|
let(:params) do
|
39
53
|
{
|
54
|
+
searchTerm: 't',
|
40
55
|
page: 2,
|
41
56
|
sort: 'date_created',
|
42
57
|
requested: 25,
|
43
|
-
searchTerm: 'term',
|
44
58
|
role: 2
|
45
59
|
}
|
46
60
|
end
|
47
61
|
|
48
|
-
|
62
|
+
it_behaves_like 'an API request'
|
63
|
+
it_behaves_like 'a successful request'
|
64
|
+
it_behaves_like 'a GET index request'
|
65
|
+
it 'builds a full filter and query and sends the request' do
|
66
|
+
list
|
49
67
|
|
50
|
-
|
51
|
-
expect(
|
68
|
+
filter = {'$or': [{email: 't'}, {last_name: 't'}], role: {'$in': [2]}}
|
69
|
+
expect(WebMock).to have_requested(:get, "#{versioned_api_path}/operators"\
|
70
|
+
"?filter=#{ERB::Util.url_encode filter.to_json}"\
|
71
|
+
'&page=2&requested=25&sort=date_created')
|
52
72
|
end
|
73
|
+
end
|
74
|
+
end
|
53
75
|
|
54
|
-
|
55
|
-
|
56
|
-
end
|
76
|
+
context 'with invalid role' do
|
77
|
+
let(:params) { {role: 'ADMIN'} }
|
57
78
|
|
58
|
-
|
79
|
+
it { expect { list }.to raise_error(ArgumentError) }
|
80
|
+
end
|
59
81
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
'%22role%22:2%7D&page=2&requested=25&sort=date_created'
|
65
|
-
expect(WebMock).to have_requested(:get, url)
|
66
|
-
end
|
67
|
-
end
|
82
|
+
context 'with invalid params' do
|
83
|
+
let(:params) { :anything_but_a_hash }
|
84
|
+
|
85
|
+
it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
68
86
|
end
|
87
|
+
end
|
69
88
|
|
70
|
-
|
71
|
-
|
72
|
-
|
89
|
+
RSpec.shared_examples 'a missing id' do
|
90
|
+
it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
91
|
+
end
|
73
92
|
|
74
|
-
|
75
|
-
|
93
|
+
RSpec.shared_examples 'an invalid id' do
|
94
|
+
it { expect { subject }.not_to raise_error }
|
95
|
+
it('results is nil') { expect(results).to be_nil }
|
76
96
|
|
77
|
-
|
78
|
-
|
97
|
+
it('error messages array is populated') do
|
98
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
99
|
+
end
|
100
|
+
end
|
79
101
|
|
80
|
-
|
81
|
-
|
102
|
+
RSpec.shared_examples 'a missing params' do
|
103
|
+
it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
104
|
+
end
|
82
105
|
|
83
|
-
|
84
|
-
|
106
|
+
describe '#show' do
|
107
|
+
subject(:show) { described_class.new(client).show(id) }
|
85
108
|
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
109
|
+
context 'when missing id' do
|
110
|
+
let(:id) { nil }
|
90
111
|
|
91
|
-
|
92
|
-
|
112
|
+
it_behaves_like 'a missing id'
|
113
|
+
end
|
93
114
|
|
94
|
-
|
95
|
-
|
115
|
+
context 'with invalid id' do
|
116
|
+
let(:id) { :invalid_id }
|
96
117
|
|
97
|
-
|
98
|
-
|
99
|
-
|
118
|
+
it_behaves_like 'an invalid id'
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'with valid id' do
|
122
|
+
let(:id) { :valid_id }
|
100
123
|
|
101
|
-
|
124
|
+
it_behaves_like 'an API request'
|
125
|
+
it_behaves_like 'a successful request'
|
126
|
+
it('performs a get and returns the response') do
|
127
|
+
expect(results).to have_key(:public_id)
|
102
128
|
end
|
103
129
|
end
|
130
|
+
end
|
104
131
|
|
105
|
-
|
106
|
-
|
107
|
-
let(:error_messages) { create[1] }
|
132
|
+
describe '#create' do
|
133
|
+
subject(:create) { described_class.new(client).create(params) }
|
108
134
|
|
109
|
-
|
110
|
-
|
135
|
+
context 'when missing params' do
|
136
|
+
let(:params) { nil }
|
111
137
|
|
112
|
-
|
113
|
-
|
114
|
-
end
|
115
|
-
end
|
138
|
+
it_behaves_like 'a missing params'
|
139
|
+
end
|
116
140
|
|
117
|
-
|
118
|
-
|
141
|
+
context 'when invalid params are provided' do
|
142
|
+
let(:params) { :invalid }
|
119
143
|
|
120
|
-
|
121
|
-
|
144
|
+
it_behaves_like 'an API request'
|
145
|
+
it('results is nil') { expect(results).to be_nil }
|
122
146
|
|
123
|
-
|
124
|
-
|
125
|
-
end
|
147
|
+
it('error messages array is populated') do
|
148
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
126
149
|
end
|
150
|
+
end
|
127
151
|
|
128
|
-
|
129
|
-
|
152
|
+
context 'when valid params are provided' do
|
153
|
+
let(:params) { {params: :valid} }
|
130
154
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
136
|
-
end
|
155
|
+
it_behaves_like 'an API request'
|
156
|
+
it_behaves_like 'a successful request'
|
157
|
+
it { expect(results).to have_key(:public_id) }
|
158
|
+
it { expect(results).to have_key(:role) }
|
137
159
|
end
|
160
|
+
end
|
138
161
|
|
139
|
-
|
140
|
-
|
141
|
-
let(:error_messages) { update[1] }
|
142
|
-
|
143
|
-
context 'when missing id' do
|
144
|
-
let(:update) { subject.update(nil, params: 'params') }
|
162
|
+
describe '#update' do
|
163
|
+
subject(:update) { described_class.new(client).update(id, params) }
|
145
164
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
end
|
165
|
+
context 'when missing id' do
|
166
|
+
let(:id) { nil }
|
167
|
+
let(:params) { {params: :valid} }
|
150
168
|
|
151
|
-
|
152
|
-
|
169
|
+
it_behaves_like 'a missing id'
|
170
|
+
end
|
153
171
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
end
|
172
|
+
context 'when missing params' do
|
173
|
+
let(:id) { :id }
|
174
|
+
let(:params) { nil }
|
158
175
|
|
159
|
-
|
160
|
-
|
176
|
+
it_behaves_like 'a missing params'
|
177
|
+
end
|
161
178
|
|
162
|
-
|
163
|
-
|
179
|
+
context 'with invalid id' do
|
180
|
+
let(:id) { :invalid_id }
|
181
|
+
let(:params) { {params: :valid} }
|
164
182
|
|
165
|
-
|
166
|
-
|
167
|
-
end
|
168
|
-
end
|
183
|
+
it_behaves_like 'an invalid id'
|
184
|
+
end
|
169
185
|
|
170
|
-
|
171
|
-
|
186
|
+
context 'with valid params' do
|
187
|
+
let(:id) { :valid_id }
|
188
|
+
let(:params) { {params: :valid} }
|
172
189
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
178
|
-
end
|
190
|
+
it_behaves_like 'an API request'
|
191
|
+
it_behaves_like 'a successful request'
|
192
|
+
it { expect(results).to have_key(:email) }
|
193
|
+
it { expect(results).to have_key(:role) }
|
179
194
|
end
|
195
|
+
end
|
180
196
|
|
181
|
-
|
182
|
-
|
183
|
-
let(:error_messages) { update_password[1] }
|
197
|
+
describe '#update_password' do
|
198
|
+
subject(:update_password) { described_class.new(client).update_password(params) }
|
184
199
|
|
185
|
-
|
186
|
-
|
200
|
+
context 'when missing params' do
|
201
|
+
let(:params) { nil }
|
187
202
|
|
188
|
-
|
189
|
-
|
190
|
-
FinAppsCore::MissingArgumentsError
|
191
|
-
)
|
192
|
-
end
|
193
|
-
end
|
203
|
+
it_behaves_like 'a missing params'
|
204
|
+
end
|
194
205
|
|
195
|
-
|
196
|
-
|
206
|
+
context 'with invalid params' do
|
207
|
+
let(:params) { {foo: :bar} }
|
197
208
|
|
198
|
-
|
199
|
-
|
200
|
-
FinAppsCore::InvalidArgumentsError
|
201
|
-
)
|
202
|
-
end
|
203
|
-
end
|
209
|
+
it { expect { update_password }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
210
|
+
end
|
204
211
|
|
205
|
-
|
206
|
-
|
207
|
-
{password: 'valid password', password_confirm: 'valid_password'}
|
208
|
-
end
|
209
|
-
let(:update_password) { subject.update_password(valid_params) }
|
212
|
+
context 'with valid params' do
|
213
|
+
let(:params) { {password: 'valid', password_confirm: 'valid'} }
|
210
214
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
it('returns no error messages') { expect(error_messages).to be_empty }
|
216
|
-
end
|
215
|
+
it_behaves_like 'an API request'
|
216
|
+
it_behaves_like 'a successful request'
|
217
|
+
it { expect(results).to have_key(:email) }
|
218
|
+
it { expect(results).to have_key(:role) }
|
217
219
|
end
|
220
|
+
end
|
218
221
|
|
219
|
-
|
220
|
-
|
221
|
-
let(:error_messages) { destroy[1] }
|
222
|
-
|
223
|
-
context 'when missing id' do
|
224
|
-
let(:destroy) { subject.destroy(nil) }
|
222
|
+
describe '#destroy' do
|
223
|
+
subject(:destroy) { described_class.new(client).destroy(id) }
|
225
224
|
|
226
|
-
|
227
|
-
|
228
|
-
end
|
229
|
-
end
|
225
|
+
context 'when missing id' do
|
226
|
+
let(:id) { nil }
|
230
227
|
|
231
|
-
|
232
|
-
|
228
|
+
it_behaves_like 'a missing id'
|
229
|
+
end
|
233
230
|
|
234
|
-
|
235
|
-
|
231
|
+
context 'with invalid id' do
|
232
|
+
let(:id) { :invalid_id }
|
236
233
|
|
237
|
-
|
238
|
-
|
239
|
-
end
|
240
|
-
end
|
234
|
+
it_behaves_like 'an invalid id'
|
235
|
+
end
|
241
236
|
|
242
|
-
|
243
|
-
|
237
|
+
context 'with valid id' do
|
238
|
+
let(:id) { :valid_id }
|
244
239
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
end
|
240
|
+
it_behaves_like 'an API request'
|
241
|
+
it_behaves_like 'a successful request'
|
242
|
+
it('results is nil') { expect(results).to be_nil }
|
249
243
|
end
|
250
244
|
end
|
251
245
|
end
|
@@ -1,86 +1,95 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
-
require '
|
4
|
+
require 'spec_helpers/api_request'
|
5
5
|
|
6
6
|
RSpec.describe FinApps::REST::Screenings do
|
7
7
|
include SpecHelpers::Client
|
8
8
|
|
9
|
-
let(:results) { subject[
|
10
|
-
let(:error_messages) { subject[
|
9
|
+
let(:results) { subject[RESULTS] }
|
10
|
+
let(:error_messages) { subject[ERROR_MESSAGES] }
|
11
11
|
|
12
12
|
describe '#list' do
|
13
13
|
subject(:list) { described_class.new(client).list(params) }
|
14
14
|
|
15
15
|
context 'with valid params' do
|
16
|
-
|
17
|
-
let(:params) { {searchTerm: nil, page: 2} }
|
16
|
+
let(:params) { {} }
|
18
17
|
|
18
|
+
RSpec.shared_examples 'a correct query builder' do |filter|
|
19
19
|
it_behaves_like 'an API request'
|
20
20
|
it_behaves_like 'a successful request'
|
21
|
-
|
22
|
-
|
21
|
+
it_behaves_like 'a GET index request'
|
22
|
+
it 'builds query and sends proper request' do
|
23
|
+
list
|
24
|
+
encoded_filter = ERB::Util.url_encode filter.to_json
|
25
|
+
url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
|
26
|
+
|
27
|
+
expect(WebMock).to have_requested(:get, url)
|
23
28
|
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'without searchTerm' do
|
32
|
+
let(:params) { {searchTerm: nil, page: 2} }
|
24
33
|
|
25
34
|
it 'builds query and sends proper request' do
|
26
35
|
list
|
27
36
|
url = "#{versioned_api_path}/screenings?page=2"
|
37
|
+
|
28
38
|
expect(WebMock).to have_requested(:get, url)
|
29
39
|
end
|
30
40
|
end
|
31
41
|
|
32
|
-
|
42
|
+
context 'with from date' do
|
43
|
+
let(:params) { {fromDate: 'from'} }
|
44
|
+
|
45
|
+
it_behaves_like 'a correct query builder', {
|
46
|
+
'*date_created': {'$gte': 'from'}
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'with to date' do
|
51
|
+
let(:params) { {toDate: 'to'} }
|
52
|
+
|
53
|
+
it_behaves_like 'a correct query builder', {
|
54
|
+
'*date_created': {'$lt': 'to'}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
33
58
|
context 'with date range' do
|
34
|
-
let(:params) { {fromDate: '
|
59
|
+
let(:params) { {fromDate: 'from', toDate: 'to'} }
|
35
60
|
|
36
|
-
it_behaves_like '
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
61
|
+
it_behaves_like 'a correct query builder', {
|
62
|
+
'*date_created': {'$gte': 'from', '$lt': 'to'}
|
63
|
+
}
|
64
|
+
end
|
41
65
|
|
42
|
-
|
43
|
-
|
44
|
-
json_filter = {
|
45
|
-
'*date_created': {'$gte': '2021-01-08T00:00:00%2B00:00',
|
46
|
-
'$lt': '2021-01-09T00:00:00%2B00:00'}
|
47
|
-
}.to_json
|
48
|
-
encoded_filter = ERB::Util.url_encode json_filter
|
49
|
-
url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
|
66
|
+
context 'with invalid progress' do
|
67
|
+
let(:params) { {progress: 'not-an-integer'} }
|
50
68
|
|
51
|
-
|
52
|
-
end
|
69
|
+
it { expect { list }.to raise_error(ArgumentError) }
|
53
70
|
end
|
54
|
-
# rubocop:enable RSpec/ExampleLength
|
55
71
|
|
56
|
-
|
57
|
-
|
58
|
-
let(:params) { {searchTerm: 'le term'} }
|
72
|
+
context 'with valid progress' do
|
73
|
+
let(:params) { {progress: '10'} }
|
59
74
|
|
60
|
-
it_behaves_like '
|
61
|
-
|
62
|
-
it 'performs a get and returns the response' do
|
63
|
-
expect(results).to have_key(:records)
|
64
|
-
end
|
75
|
+
it_behaves_like 'a correct query builder', {progress: 10}
|
76
|
+
end
|
65
77
|
|
66
|
-
|
67
|
-
|
68
|
-
json_filter = {'$or': [{'consumer.public_id': 'le term'},
|
69
|
-
{'consumer.email': 'le term'},
|
70
|
-
{'consumer.first_name': 'le term'},
|
71
|
-
{'consumer.last_name': 'le term'},
|
72
|
-
{'consumer.external_id': 'le term'},
|
73
|
-
{'consumer.first_name': 'le'},
|
74
|
-
{'consumer.last_name': 'le'},
|
75
|
-
{'consumer.first_name': 'term'},
|
76
|
-
{'consumer.last_name': 'term'}]}.to_json
|
77
|
-
encoded_filter = ERB::Util.url_encode json_filter
|
78
|
-
url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
|
78
|
+
context 'with searchTerm' do
|
79
|
+
let(:params) { {searchTerm: 'le term'} }
|
79
80
|
|
80
|
-
|
81
|
-
|
81
|
+
it_behaves_like 'a correct query builder', {
|
82
|
+
'$or': [{'consumer.public_id': 'le term'},
|
83
|
+
{'consumer.email': 'le term'},
|
84
|
+
{'consumer.first_name': 'le term'},
|
85
|
+
{'consumer.last_name': 'le term'},
|
86
|
+
{'consumer.external_id': 'le term'},
|
87
|
+
{'consumer.first_name': 'le'},
|
88
|
+
{'consumer.last_name': 'le'},
|
89
|
+
{'consumer.first_name': 'term'},
|
90
|
+
{'consumer.last_name': 'term'}]
|
91
|
+
}
|
82
92
|
end
|
83
|
-
# rubocop:enable RSpec/ExampleLength
|
84
93
|
end
|
85
94
|
|
86
95
|
context 'with invalid params' do
|
@@ -94,9 +103,7 @@ RSpec.describe FinApps::REST::Screenings do
|
|
94
103
|
|
95
104
|
it_behaves_like 'an API request'
|
96
105
|
it_behaves_like 'a successful request'
|
97
|
-
|
98
|
-
expect(results).to have_key(:records)
|
99
|
-
end
|
106
|
+
it_behaves_like 'a GET index request'
|
100
107
|
end
|
101
108
|
end
|
102
109
|
|
@@ -1,12 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.shared_examples 'an API request' do |_parameter|
|
4
|
-
it
|
5
|
-
expect do
|
6
|
-
# noinspection RubyBlockToMethodReference
|
7
|
-
subject
|
8
|
-
end.not_to raise_error
|
9
|
-
end
|
4
|
+
it { expect { subject }.not_to raise_error }
|
10
5
|
|
11
6
|
it('returns an array') { expect(subject).to be_a(Array) }
|
12
7
|
end
|
@@ -17,10 +12,18 @@ RSpec.shared_examples 'a successful request' do |_parameter|
|
|
17
12
|
end
|
18
13
|
end
|
19
14
|
|
20
|
-
RSpec.shared_examples 'a request that raises an error' do |
|
15
|
+
RSpec.shared_examples 'a request that raises an error' do |parameter|
|
21
16
|
it do
|
22
17
|
expect { subject }.to raise_error(
|
23
|
-
FinAppsCore::MissingArgumentsError
|
18
|
+
parameter || FinAppsCore::MissingArgumentsError
|
24
19
|
)
|
25
20
|
end
|
26
21
|
end
|
22
|
+
|
23
|
+
RSpec.shared_examples 'a GET index request' do
|
24
|
+
it { expect(results).to have_key(:records) }
|
25
|
+
|
26
|
+
it('returns an array of records') do
|
27
|
+
expect(results[:records]).to be_a(Array)
|
28
|
+
end
|
29
|
+
end
|
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: 6.
|
4
|
+
version: 6.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -307,7 +307,6 @@ files:
|
|
307
307
|
- lib/finapps/version.rb
|
308
308
|
- spec/rest/alert_definitions_spec.rb
|
309
309
|
- spec/rest/alert_occurrences_spec.rb
|
310
|
-
- spec/rest/api_request.rb
|
311
310
|
- spec/rest/client_spec.rb
|
312
311
|
- spec/rest/consumer_login_tokens_spec.rb
|
313
312
|
- spec/rest/consumers_portfolios_spec.rb
|
@@ -351,6 +350,7 @@ files:
|
|
351
350
|
- spec/rest/verix/verix_records_spec.rb
|
352
351
|
- spec/rest/version_spec.rb
|
353
352
|
- spec/spec_helper.rb
|
353
|
+
- spec/spec_helpers/api_request.rb
|
354
354
|
- spec/spec_helpers/client.rb
|
355
355
|
- spec/support/documents_uploads_routes.rb
|
356
356
|
- spec/support/fake_api.rb
|
@@ -463,6 +463,7 @@ test_files:
|
|
463
463
|
- spec/support/fake_api.rb
|
464
464
|
- spec/support/documents_uploads_routes.rb
|
465
465
|
- spec/spec_helper.rb
|
466
|
+
- spec/spec_helpers/api_request.rb
|
466
467
|
- spec/spec_helpers/client.rb
|
467
468
|
- spec/rest/portfolios_alerts_spec.rb
|
468
469
|
- spec/rest/products_spec.rb
|
@@ -481,7 +482,6 @@ test_files:
|
|
481
482
|
- spec/rest/verix/verix_documents_spec.rb
|
482
483
|
- spec/rest/verix/verix_records_spec.rb
|
483
484
|
- spec/rest/verix/verix_pdf_documents_spec.rb
|
484
|
-
- spec/rest/api_request.rb
|
485
485
|
- spec/rest/tenant_settings_spec.rb
|
486
486
|
- spec/rest/consumers_spec.rb
|
487
487
|
- spec/rest/client_spec.rb
|