finapps 5.0.32 → 5.0.33

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +134 -61
  3. data/.rubocop_todo.yml +120 -0
  4. data/.tmuxinator.yml +1 -0
  5. data/.travis.yml +3 -1
  6. data/finapps.gemspec +3 -3
  7. data/lib/finapps/rest/alert_definitions.rb +1 -1
  8. data/lib/finapps/rest/alert_occurrences.rb +1 -1
  9. data/lib/finapps/rest/consumers.rb +5 -5
  10. data/lib/finapps/rest/consumers_portfolios.rb +1 -1
  11. data/lib/finapps/rest/documents_orders.rb +25 -24
  12. data/lib/finapps/rest/operators.rb +5 -5
  13. data/lib/finapps/rest/operators_password_resets.rb +1 -1
  14. data/lib/finapps/rest/order_assignments.rb +1 -1
  15. data/lib/finapps/rest/order_reports.rb +1 -1
  16. data/lib/finapps/rest/orders.rb +10 -10
  17. data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
  18. data/lib/finapps/rest/portfolio_reports.rb +1 -1
  19. data/lib/finapps/rest/portfolios.rb +1 -1
  20. data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
  21. data/lib/finapps/rest/portfolios_consumers.rb +1 -1
  22. data/lib/finapps/rest/sessions.rb +1 -1
  23. data/lib/finapps/rest/signed_documents_downloads.rb +3 -1
  24. data/lib/finapps/version.rb +1 -1
  25. data/spec/rest/alert_definitions_spec.rb +10 -2
  26. data/spec/rest/alert_occurrences_spec.rb +6 -1
  27. data/spec/rest/api_request.rb +1 -0
  28. data/spec/rest/client_spec.rb +2 -2
  29. data/spec/rest/consumers_portfolios_spec.rb +7 -2
  30. data/spec/rest/consumers_spec.rb +39 -11
  31. data/spec/rest/documents_orders_notifications_spec.rb +3 -1
  32. data/spec/rest/documents_orders_spec.rb +85 -23
  33. data/spec/rest/esign_templates_spec.rb +2 -1
  34. data/spec/rest/operators_password_resets_spec.rb +6 -1
  35. data/spec/rest/operators_spec.rb +22 -2
  36. data/spec/rest/order_assignments_spec.rb +6 -1
  37. data/spec/rest/order_notifications_spec.rb +3 -1
  38. data/spec/rest/order_refreshes_spec.rb +7 -1
  39. data/spec/rest/order_reports_spec.rb +7 -1
  40. data/spec/rest/order_statuses_spec.rb +7 -3
  41. data/spec/rest/order_tokens_spec.rb +7 -1
  42. data/spec/rest/orders_spec.rb +63 -29
  43. data/spec/rest/password_resets_spec.rb +20 -10
  44. data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
  45. data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
  46. data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +10 -10
  47. data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
  48. data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
  49. data/spec/rest/portfolio_reports_spec.rb +7 -2
  50. data/spec/rest/portfolios_alerts_spec.rb +6 -1
  51. data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
  52. data/spec/rest/portfolios_consumers_spec.rb +13 -2
  53. data/spec/rest/portfolios_spec.rb +20 -5
  54. data/spec/rest/products_spec.rb +3 -1
  55. data/spec/rest/sessions_spec.rb +8 -4
  56. data/spec/rest/signed_documents_downloads_spec.rb +3 -3
  57. data/spec/rest/tenant_app_settings_spec.rb +9 -3
  58. data/spec/rest/tenant_settings_spec.rb +9 -3
  59. data/spec/rest/verix/verix_documents_spec.rb +13 -20
  60. data/spec/rest/verix/verix_metadata_spec.rb +1 -1
  61. data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
  62. data/spec/rest/verix/verix_records_spec.rb +31 -10
  63. data/spec/rest/version_spec.rb +3 -1
  64. data/spec/spec_helper.rb +2 -2
  65. data/spec/support/fake_api.rb +9 -3
  66. data/spec/support/fixtures/documents_orders_none.json +6 -0
  67. data/spec/utils/query_builder_spec.rb +40 -14
  68. metadata +17 -15
@@ -3,10 +3,12 @@
3
3
  RSpec.describe FinApps::REST::Version do
4
4
  include SpecHelpers::Client
5
5
 
6
- subject { FinApps::REST::Version.new(client) }
6
+ subject { described_class.new(client) }
7
+
7
8
  describe '#show' do
8
9
  it { expect { subject.show }.not_to raise_error }
9
10
  it('returns a string') { expect(subject.show[0]).to be_a(String) }
11
+
10
12
  it('starts with the words "Version =>"') do
11
13
  expect(subject.show[0]).to start_with('Version =>')
12
14
  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.32
4
+ version: 5.0.33
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-06-11 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -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
@@ -285,6 +285,7 @@ files:
285
285
  - ".hound.yml"
286
286
  - ".rspec"
287
287
  - ".rubocop.yml"
288
+ - ".rubocop_todo.yml"
288
289
  - ".ruby-gemset"
289
290
  - ".ruby-version"
290
291
  - ".tmuxinator.yml"
@@ -386,6 +387,7 @@ files:
386
387
  - spec/support/fixtures/alert_occurrences.json
387
388
  - spec/support/fixtures/documents_order.json
388
389
  - spec/support/fixtures/documents_orders.json
390
+ - spec/support/fixtures/documents_orders_none.json
389
391
  - spec/support/fixtures/error.json
390
392
  - spec/support/fixtures/esign_templates.json
391
393
  - spec/support/fixtures/invalid_order_id.json
@@ -468,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
470
  - !ruby/object:Gem::Version
469
471
  version: '0'
470
472
  requirements: []
471
- rubygems_version: 3.1.4
473
+ rubygems_version: 3.1.3
472
474
  signing_key:
473
475
  specification_version: 4
474
476
  summary: FinApps REST API ruby client.