finapps 6.4.3 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c47f3bb9f6e6702acf5a530b1e9c243a80271bc66e4eecec1fa6c1a088e99e0
4
- data.tar.gz: fe0770b6dbe32afe9997a8d631ff5dae85c1963e0b6b26ac52bfec4cf2794159
3
+ metadata.gz: 5e80a928ff71e2322588992ecaaccb749ef54da3885b691b7397fc0e78be6061
4
+ data.tar.gz: c37736f652f09f2c7066e9a45df9c4718b9c933d914716251d5e3105d9bb465f
5
5
  SHA512:
6
- metadata.gz: eb6e96b56b2e64f03eef52e9e5f4573eca2c9940421caa3d15dc42b3fd400781a40bfd44fe592b7886ebf4cd0de3f9854e080a60c85454f0228919524ed513a9
7
- data.tar.gz: 3762f06a6f148e7dd040c9005e98614f9bcdd54f497a1b6f1e7a1d148bc5e528852592e3ff4ecaec2df5a8419cc95a53f299e02c292d5d1285e5e28b61575060
6
+ metadata.gz: f7a0e0ca416920b490133e964d36b4a6a86a0c5c759cbf01a30e1b3158ef66abe1c67ecf3fe2d90fb20355824a69839585090bb16fe21448468c28704bab32aa
7
+ data.tar.gz: 33788efee5a351ff06001daa933578a54965de86e9b949cc8b1631e93a3c890f888d890a5e5e9af8939679d0bf2ba83702034621ae10503d27885aced872e8a3
@@ -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...$RESOLVED_VERSION)
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
- filter = {}
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 search_query(term)
67
- {last_name: term}
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 role_query(role)
71
- if role.is_a?(Array)
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
@@ -110,7 +110,7 @@ module FinApps
110
110
  def progress_filter(progress)
111
111
  return {} unless progress
112
112
 
113
- {progress: progress.to_i}
113
+ {progress: Integer(progress)}
114
114
  end
115
115
 
116
116
  def space?(string)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '6.4.3'
4
+ VERSION = '6.5.0'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::DocumentsOrders do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::DocumentsUploadTypes do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::DocumentsUploads do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::EsignTemplates do
7
7
  include SpecHelpers::Client
@@ -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
- context 'when initialized with valid FinApps::Client object' do
7
- include SpecHelpers::Client
8
- subject(:operators) { described_class.new(client) }
7
+ include SpecHelpers::Client
9
8
 
10
- describe '#list' do
11
- let(:list) { subject.list(params) }
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
- context 'when missing params' do
16
- let(:params) { nil }
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
- it('performs a get and returns the response') do
21
- expect(results).to have_key(:records)
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
- it('returns an array of records') do
25
- expect(results[:records]).to be_a(Array)
26
- end
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
- it('returns no error messages') { expect(error_messages).to be_empty }
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 'when invalid params are provided' do
32
- let(:params) { ['invalid array'] }
45
+ context 'with empty params' do
46
+ let(:params) { nil }
33
47
 
34
- it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
48
+ it_behaves_like 'a filtereable GET index request', nil
35
49
  end
36
50
 
37
- context 'when including valid params' do
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
- it { expect { list }.not_to raise_error }
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
- it('performs a get and returns the response') do
51
- expect(results).to have_key(:records)
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
- it('returns an array of records') do
55
- expect(results[:records]).to be_a(Array)
56
- end
76
+ context 'with invalid role' do
77
+ let(:params) { {role: 'ADMIN'} }
57
78
 
58
- it('returns no error messages') { expect(error_messages).to be_empty }
79
+ it { expect { list }.to raise_error(ArgumentError) }
80
+ end
59
81
 
60
- it 'builds query and sends proper request' do
61
- list
62
- url =
63
- "#{versioned_api_path}/operators?filter=%7B%22last_name%22:%22term%22," \
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
- describe '#show' do
71
- let(:results) { show[0] }
72
- let(:error_messages) { show[1] }
89
+ RSpec.shared_examples 'a missing id' do
90
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
91
+ end
73
92
 
74
- context 'when missing id' do
75
- let(:show) { subject.show(nil) }
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
- it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
78
- end
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
- context 'with invalid id' do
81
- let(:show) { subject.show(:invalid_id) }
102
+ RSpec.shared_examples 'a missing params' do
103
+ it { expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError) }
104
+ end
82
105
 
83
- it { expect { show }.not_to raise_error }
84
- it('results is nil') { expect(results).to be_nil }
106
+ describe '#show' do
107
+ subject(:show) { described_class.new(client).show(id) }
85
108
 
86
- it('error messages array is populated') do
87
- expect(error_messages.first.downcase).to eq('resource not found')
88
- end
89
- end
109
+ context 'when missing id' do
110
+ let(:id) { nil }
90
111
 
91
- context 'with valid id' do
92
- let(:show) { subject.show(:valid_id) }
112
+ it_behaves_like 'a missing id'
113
+ end
93
114
 
94
- it { expect { show }.not_to raise_error }
95
- it('returns an array') { expect(show).to be_a(Array) }
115
+ context 'with invalid id' do
116
+ let(:id) { :invalid_id }
96
117
 
97
- it('performs a get and returns the response') do
98
- expect(results).to have_key(:public_id)
99
- end
118
+ it_behaves_like 'an invalid id'
119
+ end
120
+
121
+ context 'with valid id' do
122
+ let(:id) { :valid_id }
100
123
 
101
- it('returns no error messages') { expect(error_messages).to be_empty }
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
- describe '#create' do
106
- let(:results) { create[0] }
107
- let(:error_messages) { create[1] }
132
+ describe '#create' do
133
+ subject(:create) { described_class.new(client).create(params) }
108
134
 
109
- context 'when missing params' do
110
- let(:create) { subject.create(nil) }
135
+ context 'when missing params' do
136
+ let(:params) { nil }
111
137
 
112
- it do
113
- expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
114
- end
115
- end
138
+ it_behaves_like 'a missing params'
139
+ end
116
140
 
117
- context 'when invalid params are provided' do
118
- let(:create) { subject.create(params: 'invalid') }
141
+ context 'when invalid params are provided' do
142
+ let(:params) { :invalid }
119
143
 
120
- it { expect { create }.not_to raise_error }
121
- it('results is nil') { expect(results).to be_nil }
144
+ it_behaves_like 'an API request'
145
+ it('results is nil') { expect(results).to be_nil }
122
146
 
123
- it('error messages array is populated') do
124
- expect(error_messages.first.downcase).to eq('invalid request body')
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
- context 'when valid params are provided' do
129
- let(:create) { subject.create(params: 'valid') }
152
+ context 'when valid params are provided' do
153
+ let(:params) { {params: :valid} }
130
154
 
131
- it { expect { create }.not_to raise_error }
132
- it('returns an array') { expect(create).to be_a(Array) }
133
- it { expect(results).to have_key(:public_id) }
134
- it { expect(results).to have_key(:role) }
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
- describe '#update' do
140
- let(:results) { update[0] }
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
- it do
147
- expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
148
- end
149
- end
165
+ context 'when missing id' do
166
+ let(:id) { nil }
167
+ let(:params) { {params: :valid} }
150
168
 
151
- context 'when missing params' do
152
- let(:update) { subject.update(:valid_id, nil) }
169
+ it_behaves_like 'a missing id'
170
+ end
153
171
 
154
- it do
155
- expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
156
- end
157
- end
172
+ context 'when missing params' do
173
+ let(:id) { :id }
174
+ let(:params) { nil }
158
175
 
159
- context 'with invalid params' do
160
- let(:update) { subject.update(:invalid_id, params: 'params') }
176
+ it_behaves_like 'a missing params'
177
+ end
161
178
 
162
- it { expect { update }.not_to raise_error }
163
- it('results is nil') { expect(results).to be_nil }
179
+ context 'with invalid id' do
180
+ let(:id) { :invalid_id }
181
+ let(:params) { {params: :valid} }
164
182
 
165
- it('error messages array is populated') do
166
- expect(error_messages.first.downcase).to eq('resource not found')
167
- end
168
- end
183
+ it_behaves_like 'an invalid id'
184
+ end
169
185
 
170
- context 'with valid params' do
171
- let(:update) { subject.update(:valid_id, params: 'valid params') }
186
+ context 'with valid params' do
187
+ let(:id) { :valid_id }
188
+ let(:params) { {params: :valid} }
172
189
 
173
- it { expect { update }.not_to raise_error }
174
- it('returns an array') { expect(update).to be_a(Array) }
175
- it { expect(results).to have_key(:email) }
176
- it { expect(results).to have_key(:role) }
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
- describe '#update_password' do
182
- let(:results) { update_password[0] }
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
- context 'when missing params' do
186
- let(:update_password) { subject.update_password(nil) }
200
+ context 'when missing params' do
201
+ let(:params) { nil }
187
202
 
188
- it do
189
- expect { update_password }.to raise_error(
190
- FinAppsCore::MissingArgumentsError
191
- )
192
- end
193
- end
203
+ it_behaves_like 'a missing params'
204
+ end
194
205
 
195
- context 'with invalid params' do
196
- let(:update_password) { subject.update_password(password: 'invalid') }
206
+ context 'with invalid params' do
207
+ let(:params) { {foo: :bar} }
197
208
 
198
- it do
199
- expect { update_password }.to raise_error(
200
- FinAppsCore::InvalidArgumentsError
201
- )
202
- end
203
- end
209
+ it { expect { update_password }.to raise_error(FinAppsCore::InvalidArgumentsError) }
210
+ end
204
211
 
205
- context 'with valid params' do
206
- let(:valid_params) do
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
- it { expect { update_password }.not_to raise_error }
212
- it('returns an array') { expect(update_password).to be_a(Array) }
213
- it { expect(results).to have_key(:public_id) }
214
- it { expect(results).to have_key(:role) }
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
- describe '#destroy' do
220
- let(:results) { destroy[0] }
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
- it do
227
- expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError)
228
- end
229
- end
225
+ context 'when missing id' do
226
+ let(:id) { nil }
230
227
 
231
- context 'with invalid id' do
232
- let(:destroy) { subject.destroy(:invalid_id) }
228
+ it_behaves_like 'a missing id'
229
+ end
233
230
 
234
- it { expect { destroy }.not_to raise_error }
235
- it('results is nil') { expect(results).to be_nil }
231
+ context 'with invalid id' do
232
+ let(:id) { :invalid_id }
236
233
 
237
- it('error messages array is populated') do
238
- expect(error_messages.first.downcase).to eq('resource not found')
239
- end
240
- end
234
+ it_behaves_like 'an invalid id'
235
+ end
241
236
 
242
- context 'with valid id' do
243
- let(:destroy) { subject.destroy(:valid_id) }
237
+ context 'with valid id' do
238
+ let(:id) { :valid_id }
244
239
 
245
- it { expect { destroy }.not_to raise_error }
246
- it('results is nil') { expect(results).to be_nil }
247
- it('error_messages array is empty') { expect(error_messages).to eq([]) }
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,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::PlaidAccountPermissions do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::PlaidAccounts do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::PlaidInstitutionLogos do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::PlaidWebhooks do
7
7
  include SpecHelpers::Client
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
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[0] }
10
- let(:error_messages) { subject[1] }
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) }
@@ -15,14 +15,10 @@ RSpec.describe FinApps::REST::Screenings do
15
15
  context 'with valid params' do
16
16
  let(:params) { {} }
17
17
 
18
- RSpec.shared_examples 'a GET request' do
19
- it { expect(results).to have_key(:records) }
20
- end
21
-
22
18
  RSpec.shared_examples 'a correct query builder' do |filter|
23
19
  it_behaves_like 'an API request'
24
20
  it_behaves_like 'a successful request'
25
- it_behaves_like 'a GET request'
21
+ it_behaves_like 'a GET index request'
26
22
  it 'builds query and sends proper request' do
27
23
  list
28
24
  encoded_filter = ERB::Util.url_encode filter.to_json
@@ -68,13 +64,13 @@ RSpec.describe FinApps::REST::Screenings do
68
64
  end
69
65
 
70
66
  context 'with invalid progress' do
71
- let(:params) { {progress: 'xyz'} }
67
+ let(:params) { {progress: 'not-an-integer'} }
72
68
 
73
- it_behaves_like 'a correct query builder', {progress: 0}
69
+ it { expect { list }.to raise_error(ArgumentError) }
74
70
  end
75
71
 
76
72
  context 'with valid progress' do
77
- let(:params) { {progress: 10} }
73
+ let(:params) { {progress: '10'} }
78
74
 
79
75
  it_behaves_like 'a correct query builder', {progress: 10}
80
76
  end
@@ -107,7 +103,7 @@ RSpec.describe FinApps::REST::Screenings do
107
103
 
108
104
  it_behaves_like 'an API request'
109
105
  it_behaves_like 'a successful request'
110
- it_behaves_like 'a GET request'
106
+ it_behaves_like 'a GET index request'
111
107
  end
112
108
  end
113
109
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::SignedDocumentsDownloads do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::VerixDocuments do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::VerixMetadata do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::VerixPdfDocuments do
7
7
  include SpecHelpers::Client
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helpers/client'
4
- require 'rest/api_request'
4
+ require 'spec_helpers/api_request'
5
5
 
6
6
  RSpec.describe FinApps::REST::VerixRecords do
7
7
  include SpecHelpers::Client
@@ -1,12 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.shared_examples 'an API request' do |_parameter|
4
- it do
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 |_parameter|
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.3
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-23 00:00:00.000000000 Z
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