finapps 5.0.30 → 5.0.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yaml +37 -0
  3. data/.rubocop.yml +134 -61
  4. data/.rubocop_todo.yml +29 -0
  5. data/.tmuxinator.yml +1 -0
  6. data/.travis.yml +3 -1
  7. data/README.md +1 -0
  8. data/RELEASES.md +29 -0
  9. data/finapps.gemspec +4 -4
  10. data/lib/finapps/rest/alert_definitions.rb +1 -1
  11. data/lib/finapps/rest/alert_occurrences.rb +1 -1
  12. data/lib/finapps/rest/client.rb +6 -5
  13. data/lib/finapps/rest/consumers.rb +22 -6
  14. data/lib/finapps/rest/consumers_portfolios.rb +1 -1
  15. data/lib/finapps/rest/documents_orders.rb +43 -26
  16. data/lib/finapps/rest/operators.rb +5 -5
  17. data/lib/finapps/rest/operators_password_resets.rb +1 -1
  18. data/lib/finapps/rest/order_assignments.rb +1 -1
  19. data/lib/finapps/rest/order_reports.rb +1 -1
  20. data/lib/finapps/rest/orders.rb +33 -22
  21. data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
  22. data/lib/finapps/rest/portfolio_reports.rb +1 -1
  23. data/lib/finapps/rest/portfolios.rb +1 -1
  24. data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
  25. data/lib/finapps/rest/portfolios_consumers.rb +1 -1
  26. data/lib/finapps/rest/sessions.rb +11 -9
  27. data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
  28. data/lib/finapps/utils/query_builder.rb +13 -4
  29. data/lib/finapps/version.rb +1 -1
  30. data/spec/rest/alert_definitions_spec.rb +10 -6
  31. data/spec/rest/alert_occurrences_spec.rb +6 -1
  32. data/spec/rest/api_request.rb +1 -0
  33. data/spec/rest/client_spec.rb +33 -41
  34. data/spec/rest/consumers_portfolios_spec.rb +7 -2
  35. data/spec/rest/consumers_spec.rb +240 -192
  36. data/spec/rest/documents_orders_notifications_spec.rb +4 -2
  37. data/spec/rest/documents_orders_spec.rb +94 -17
  38. data/spec/rest/esign_templates_spec.rb +2 -1
  39. data/spec/rest/operators_password_resets_spec.rb +50 -52
  40. data/spec/rest/operators_spec.rb +181 -172
  41. data/spec/rest/order_assignments_spec.rb +6 -1
  42. data/spec/rest/order_notifications_spec.rb +4 -2
  43. data/spec/rest/order_refreshes_spec.rb +8 -5
  44. data/spec/rest/order_reports_spec.rb +21 -15
  45. data/spec/rest/order_statuses_spec.rb +14 -10
  46. data/spec/rest/order_tokens_spec.rb +37 -30
  47. data/spec/rest/orders_spec.rb +121 -73
  48. data/spec/rest/password_resets_spec.rb +46 -36
  49. data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
  50. data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
  51. data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +11 -11
  52. data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
  53. data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
  54. data/spec/rest/portfolio_reports_spec.rb +7 -2
  55. data/spec/rest/portfolios_alerts_spec.rb +9 -4
  56. data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
  57. data/spec/rest/portfolios_consumers_spec.rb +15 -4
  58. data/spec/rest/portfolios_spec.rb +20 -17
  59. data/spec/rest/products_spec.rb +17 -14
  60. data/spec/rest/sessions_spec.rb +63 -58
  61. data/spec/rest/signed_documents_downloads_spec.rb +10 -6
  62. data/spec/rest/tenant_app_settings_spec.rb +9 -3
  63. data/spec/rest/tenant_settings_spec.rb +9 -3
  64. data/spec/rest/verix/verix_documents_spec.rb +15 -22
  65. data/spec/rest/verix/verix_metadata_spec.rb +1 -1
  66. data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
  67. data/spec/rest/verix/verix_records_spec.rb +31 -10
  68. data/spec/rest/version_spec.rb +6 -4
  69. data/spec/spec_helper.rb +2 -2
  70. data/spec/support/fake_api.rb +9 -3
  71. data/spec/support/fixtures/documents_orders_none.json +6 -0
  72. data/spec/utils/query_builder_spec.rb +40 -14
  73. metadata +20 -17
@@ -10,7 +10,7 @@ RSpec.describe FinApps::REST::VerixMetadata do
10
10
  let(:api_client) { client }
11
11
 
12
12
  describe '#show' do
13
- subject(:show) { FinApps::REST::VerixMetadata.new(api_client).show }
13
+ subject(:show) { described_class.new(api_client).show }
14
14
 
15
15
  it_behaves_like 'an API request'
16
16
  it_behaves_like 'a successful request'
@@ -7,29 +7,24 @@ RSpec.describe FinApps::REST::VerixPdfDocuments do
7
7
  include SpecHelpers::Client
8
8
 
9
9
  let(:api_client) { client }
10
- let(:document) { FinApps::REST::VerixPdfDocuments.new(api_client) }
10
+ let(:document) { described_class.new(api_client) }
11
11
 
12
12
  describe '#show' do
13
- context 'when missing parameters' do
14
- subject { document.show(nil, :provider_id) }
15
- it 'raises an error when missing record id' do
16
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
17
- end
18
-
19
- subject { document.show(:record_id, nil) }
20
- it 'raises an error when missing provider id' do
21
- expect { subject }.to raise_error(FinAppsCore::MissingArgumentsError)
22
- end
23
- end
24
-
25
- subject(:show) do
26
- document.show(
27
- :record_id,
28
- :provider_id
29
- )
30
- end
13
+ subject { document.show(:record_id, :provider_id) }
31
14
 
32
15
  it_behaves_like 'an API request'
33
16
  it_behaves_like 'a successful request'
17
+
18
+ context 'when missing record_id' do
19
+ subject(:show) { document.show(nil, :provider_id) }
20
+
21
+ it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
22
+ end
23
+
24
+ context 'when missing provider_id' do
25
+ subject(:show) { document.show(:record_id, nil) }
26
+
27
+ it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
28
+ end
34
29
  end
35
30
  end
@@ -6,12 +6,11 @@ require 'rest/api_request'
6
6
  RSpec.describe FinApps::REST::VerixRecords do
7
7
  include SpecHelpers::Client
8
8
 
9
- # noinspection RubyBlockToMethodReference
10
9
  let(:api_client) { client }
11
10
 
12
11
  describe '#create' do
13
12
  subject(:create) do
14
- FinApps::REST::VerixRecords.new(api_client).create(
13
+ described_class.new(api_client).create(
15
14
  code: 'authcode'
16
15
  )
17
16
  end
@@ -19,24 +18,46 @@ RSpec.describe FinApps::REST::VerixRecords do
19
18
  it_behaves_like 'an API request'
20
19
  it_behaves_like 'a successful request'
21
20
  it('returns an id') { expect(create[RESULTS]).to have_key(:_id) }
22
- it('returns a consumer id') { expect(create[RESULTS]).to have_key(:consumer_id) }
21
+
22
+ it('returns a consumer id') {
23
+ expect(create[RESULTS]).to have_key(:consumer_id)
24
+ }
25
+
23
26
  it('returns a status') { expect(create[RESULTS]).to have_key(:status) }
24
27
  it('returns an error node') { expect(create[RESULTS]).to have_key(:error) }
25
- it('returns a list of documents') { expect(create[RESULTS]).to have_key(:documents) }
26
- it('returns a list of downloaded documents') { expect(create[RESULTS]).to have_key(:downloaded_documents) }
28
+
29
+ it('returns a list of documents') {
30
+ expect(create[RESULTS]).to have_key(:documents)
31
+ }
32
+
33
+ it('returns a list of downloaded documents') {
34
+ expect(create[RESULTS]).to have_key(:downloaded_documents)
35
+ }
27
36
  end
28
37
 
29
38
  describe '#list' do
30
- subject(:list) { FinApps::REST::VerixRecords.new(api_client).list }
39
+ subject(:list) { described_class.new(api_client).list }
31
40
 
32
41
  it_behaves_like 'an API request'
33
42
  it_behaves_like 'a successful request'
34
43
  it('returns an array') { expect(list[RESULTS]).to be_an_instance_of(Array) }
35
44
  it('returns an id') { expect(list[RESULTS].first).to have_key(:_id) }
36
45
  it('returns a status') { expect(list[RESULTS].first).to have_key(:status) }
37
- it('returns a consumer id') { expect(list[RESULTS].first).to have_key(:consumer_id) }
38
- it('returns an error node') { expect(list[RESULTS].first).to have_key(:error) }
39
- it('returns a list of documents') { expect(list[RESULTS].first).to have_key(:documents) }
40
- it('returns a list of downloaded documents') { expect(list[RESULTS].first).to have_key(:downloaded_documents) }
46
+
47
+ it('returns a consumer id') {
48
+ expect(list[RESULTS].first).to have_key(:consumer_id)
49
+ }
50
+
51
+ it('returns an error node') {
52
+ expect(list[RESULTS].first).to have_key(:error)
53
+ }
54
+
55
+ it('returns a list of documents') {
56
+ expect(list[RESULTS].first).to have_key(:documents)
57
+ }
58
+
59
+ it('returns a list of downloaded documents') {
60
+ expect(list[RESULTS].first).to have_key(:downloaded_documents)
61
+ }
41
62
  end
42
63
  end
@@ -3,12 +3,14 @@
3
3
  RSpec.describe FinApps::REST::Version do
4
4
  include SpecHelpers::Client
5
5
 
6
- subject { FinApps::REST::Version.new(client) }
6
+ subject(:version) { described_class.new(client) }
7
+
7
8
  describe '#show' do
8
- it { expect { subject.show }.not_to raise_error }
9
- it('returns a string') { expect(subject.show[0]).to be_a(String) }
9
+ it { expect { version.show }.not_to raise_error }
10
+ it('returns a string') { expect(version.show[0]).to be_a(String) }
11
+
10
12
  it('starts with the words "Version =>"') do
11
- expect(subject.show[0]).to start_with('Version =>')
13
+ expect(version.show[0]).to start_with('Version =>')
12
14
  end
13
15
  end
14
16
  end
@@ -21,7 +21,7 @@ RSpec.configure do |config|
21
21
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
22
22
  expectations.syntax = :expect
23
23
  end
24
- config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
24
+ config.mock_with(:rspec) {|mocks| mocks.verify_partial_doubles = true }
25
25
  # config.filter_run_including :focus => true
26
26
  config.default_formatter = 'doc' if config.files_to_run.one?
27
27
  config.order = :random
@@ -29,7 +29,7 @@ RSpec.configure do |config|
29
29
  config.warnings = true
30
30
  Kernel.srand config.seed
31
31
 
32
- config.before(:each) do
32
+ config.before do
33
33
  base_url =
34
34
  "#{FinAppsCore::REST::Defaults::DEFAULTS[:host]}/v#{FinAppsCore::REST::Defaults::API_VERSION}/"
35
35
  stub_request(:any, /#{base_url}/).to_rack(::FakeApi)
@@ -195,7 +195,7 @@ class FakeApi < Sinatra::Base
195
195
  post("/#{version}/orders") do
196
196
  request.body.rewind
197
197
  request_payload = JSON.parse request.body.read
198
- if %w[applicant institutions product].all? { |s| request_payload.key? s }
198
+ if %w[applicant institutions product].all? {|s| request_payload.key? s }
199
199
  json_response 200, 'order_token.json'
200
200
  else
201
201
  json_response 400, 'invalid_request_body.json'
@@ -203,7 +203,13 @@ class FakeApi < Sinatra::Base
203
203
  end
204
204
 
205
205
  # documents_orders
206
- get("/#{version}/documents/orders") { json_response 200, 'documents_orders.json' }
206
+ get("/#{version}/documents/orders") do
207
+ if params[:filter]&.include?('"status":2')
208
+ json_response 200, 'documents_orders_none.json'
209
+ else
210
+ json_response 200, 'documents_orders.json'
211
+ end
212
+ end
207
213
  get("/#{version}/documents/orders/valid_order_id") do
208
214
  json_response 200, 'documents_order.json'
209
215
  end
@@ -213,7 +219,7 @@ class FakeApi < Sinatra::Base
213
219
  post("/#{version}/documents/orders") do
214
220
  request.body.rewind
215
221
  request_payload = JSON.parse request.body.read
216
- if %w[applicant esign_documents tag].all? { |s| request_payload.key? s }
222
+ if %w[applicant esign_documents tag].all? {|s| request_payload.key? s }
217
223
  json_response 200, 'documents_order.json'
218
224
  else
219
225
  json_response 400, 'invalid_request_body.json'
@@ -0,0 +1,6 @@
1
+ {
2
+ "total_records": 0,
3
+ "page": 0,
4
+ "total_pages": 0,
5
+ "records": []
6
+ }
@@ -1,38 +1,64 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi'
4
+
3
5
  class FakeClass
4
6
  include FinApps::Utils::QueryBuilder
5
7
 
6
- def build_filter(param); end
8
+ def build_filter(params)
9
+ params&.key?(:role) ? {role: params[:role]} : {}
10
+ end
7
11
  end
8
12
 
9
13
  RSpec.describe FinApps::Utils::QueryBuilder do
10
- subject { FakeClass.new }
14
+ subject(:fake_class) { FakeClass.new }
11
15
 
12
16
  describe '#build_query_path' do
13
17
  let(:end_point) { 'orders' }
14
18
 
15
19
  context 'with full params' do
16
20
  let(:params) do
17
- { page: '1', requested: '20', sort: '-date', random: 'random' }
21
+ {
22
+ page: '1',
23
+ requested: '20',
24
+ sort: '-date',
25
+ random: 'random',
26
+ role: 2
27
+ }
28
+ end
29
+ let(:escaped_filter) { "filter=#{CGI.escape({role: 2}.to_json)}" }
30
+
31
+ it 'includes a page value in the query string' do
32
+ value = 'page=1'
33
+ expect(fake_class.build_query_path(end_point, params)).to include(value)
34
+ end
35
+
36
+ it 'includes a requested value in the query string' do
37
+ value = 'requested=20'
38
+ expect(fake_class.build_query_path(end_point, params)).to include(value)
18
39
  end
19
- it 'calls #build_filter and returns correct string' do
20
- allow(subject).to receive(:build_filter) { { role: 2 } }
21
- expect(subject).to receive(:build_filter).with(params)
22
- correct_string =
23
- 'orders?page=1&requested=20&sort=-date&filter=%7B%22role%22%3A2%7D'
24
- expect(subject.build_query_path(end_point, params)).to eq(
25
- correct_string
26
- )
40
+
41
+ it 'includes a sort value in the query string' do
42
+ value = 'sort=-date'
43
+ expect(fake_class.build_query_path(end_point, params)).to include(value)
44
+ end
45
+
46
+ it 'includes a filter value in the query string' do
47
+ value = escaped_filter
48
+ expect(fake_class.build_query_path(end_point, params)).to include(value)
49
+ end
50
+
51
+ it 'builds a properly formatted query string' do
52
+ expected = "orders?page=1&requested=20&sort=-date&#{escaped_filter}"
53
+ expect(fake_class.build_query_path(end_point, params)).to eq(expected)
27
54
  end
28
55
  end
29
56
 
30
57
  context 'with no params' do
31
58
  let(:params) { {} }
59
+
32
60
  it 'returns root' do
33
- allow(subject).to receive(:build_filter) { {} }
34
- expect(subject).to receive(:build_filter).with(params)
35
- expect(subject.build_query_path(end_point, params)).to eq(end_point)
61
+ expect(fake_class.build_query_path(end_point, params)).to eq(end_point)
36
62
  end
37
63
  end
38
64
  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: 5.0.30
4
+ version: 5.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-28 00:00:00.000000000 Z
11
+ date: 2020-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 5.0.7
22
+ version: 5.0.10
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 5.0.7
32
+ version: 5.0.10
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -176,60 +176,60 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '0.79'
179
+ version: '0.86'
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
- version: 0.79.0
182
+ version: 0.86.0
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - "~>"
188
188
  - !ruby/object:Gem::Version
189
- version: '0.79'
189
+ version: '0.86'
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
- version: 0.79.0
192
+ version: 0.86.0
193
193
  - !ruby/object:Gem::Dependency
194
194
  name: rubocop-performance
195
195
  requirement: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '1.5'
199
+ version: '1.6'
200
200
  - - ">="
201
201
  - !ruby/object:Gem::Version
202
- version: 1.5.2
202
+ version: 1.6.1
203
203
  type: :development
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '1.5'
209
+ version: '1.6'
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- version: 1.5.2
212
+ version: 1.6.1
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: rubocop-rspec
215
215
  requirement: !ruby/object:Gem::Requirement
216
216
  requirements:
217
217
  - - "~>"
218
218
  - !ruby/object:Gem::Version
219
- version: '1.37'
219
+ version: '1.40'
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 1.37.1
222
+ version: 1.40.0
223
223
  type: :development
224
224
  prerelease: false
225
225
  version_requirements: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '1.37'
229
+ version: '1.40'
230
230
  - - ">="
231
231
  - !ruby/object:Gem::Version
232
- version: 1.37.1
232
+ version: 1.40.0
233
233
  - !ruby/object:Gem::Dependency
234
234
  name: sinatra
235
235
  requirement: !ruby/object:Gem::Requirement
@@ -280,11 +280,13 @@ extra_rdoc_files:
280
280
  - LICENSE.txt
281
281
  files:
282
282
  - ".codeclimate.yml"
283
+ - ".github/workflows/main.yaml"
283
284
  - ".gitignore"
284
285
  - ".gitlab-ci.yml"
285
286
  - ".hound.yml"
286
287
  - ".rspec"
287
288
  - ".rubocop.yml"
289
+ - ".rubocop_todo.yml"
288
290
  - ".ruby-gemset"
289
291
  - ".ruby-version"
290
292
  - ".tmuxinator.yml"
@@ -386,6 +388,7 @@ files:
386
388
  - spec/support/fixtures/alert_occurrences.json
387
389
  - spec/support/fixtures/documents_order.json
388
390
  - spec/support/fixtures/documents_orders.json
391
+ - spec/support/fixtures/documents_orders_none.json
389
392
  - spec/support/fixtures/error.json
390
393
  - spec/support/fixtures/esign_templates.json
391
394
  - spec/support/fixtures/invalid_order_id.json
@@ -468,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
471
  - !ruby/object:Gem::Version
469
472
  version: '0'
470
473
  requirements: []
471
- rubygems_version: 3.1.3
474
+ rubygems_version: 3.1.4
472
475
  signing_key:
473
476
  specification_version: 4
474
477
  summary: FinApps REST API ruby client.