finapps 6.7.0 → 6.9.1

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: 735176ac6ed0687571813a8c336c16b69af0c5667c6596700ff9e2a9f68f360a
4
- data.tar.gz: c6d8d16e7eefd52b3394211874bb3e525c012b63729465d0fdbad4ff06d23b53
3
+ metadata.gz: fd7bfa629da6059e44c977436c430e5b1e0e4b742abb5b19e8e7a070bf5a425b
4
+ data.tar.gz: a0bdb2709ea8130346b3e5e0d964fe3474b9238c5d8decae98347ad6f6236c6a
5
5
  SHA512:
6
- metadata.gz: 4839196dbed34dce8f802b4e4b95b45b0ce0a8d1e43993290a3783711c6a43394e1ad1680084590ec0ecc3baaa5ae3f4c3c5f52e69b06d72449ef2fd35698e70
7
- data.tar.gz: 60afeee0003d524c52a7e966e49e8f6972e5308c7d92c34451149ef25a3041078551eb391a72e38b6723bbcad6e2a8ae284f2b659a5814d6a22fbdb13bc491d8
6
+ metadata.gz: 3e94cbd91b30336272d92d4419ee827fdd8dc9cff2b0e64dcbb0180c5d2438e320cb004bfec2ccee7b36090b165a4a9015a0fbdcd635f27f35308ecfc2fe504e
7
+ data.tar.gz: 70ff07c8e19641bfea84e8b19b4ab979de6d6a21acc73a453e88d7736321a234a175d4a04ebaf19b089120b6ebb5f908ed55a683021d3596843382554b935b10
@@ -54,6 +54,32 @@ module FinApps
54
54
  version
55
55
  ].freeze
56
56
 
57
+ RESOURCES.each do |method|
58
+ define_method(method) do
59
+ method_definition(method) do |class_name|
60
+ Object.const_get(:FinApps)
61
+ .const_get(:REST)
62
+ .const_get(class_name)
63
+ end
64
+ end
65
+ end
66
+
67
+ QUERY_RESOURCES = [:query_screenings].freeze
68
+
69
+ QUERY_RESOURCES.each do |method|
70
+ define_method(method) do
71
+ class_name = method.to_s.gsub(/query_/, '').capitalize
72
+ variable = "@#{method}"
73
+
74
+ method_definition(method, class_name, variable) do |_|
75
+ Object.const_get(:FinApps)
76
+ .const_get(:REST)
77
+ .const_get(:Query)
78
+ .const_get(class_name)
79
+ end
80
+ end
81
+ end
82
+
57
83
  # @param [String] tenant_token
58
84
  # @param [Hash] options
59
85
  # @return [FinApps::REST::Client]
@@ -64,34 +90,23 @@ module FinApps
64
90
  super(options, logger)
65
91
  end
66
92
 
67
- def method_missing(symbol, *arguments, &block)
68
- if RESOURCES.include? symbol
69
- class_name = camelize(symbol.to_s)
70
- variable = "@#{class_name.downcase}"
71
- set_variable(class_name, variable) unless instance_variable_defined? variable
72
- instance_variable_get(variable)
73
- else
74
- super
75
- end
76
- end
93
+ private
77
94
 
78
- def set_variable(class_name, variable)
79
- klass = Object.const_get(:FinApps).const_get(:REST).const_get class_name
80
- instance_variable_set(variable, klass.new(self))
81
- end
95
+ def method_definition(method, class_name = nil, variable = nil)
96
+ class_name = camelize(method.to_s) if class_name.nil?
97
+ variable = "@#{class_name.downcase}" if variable.nil?
82
98
 
83
- def respond_to_missing?(method_sym, include_private = false)
84
- RESOURCES.include?(method_sym) ? true : super
99
+ unless instance_variable_defined?(variable)
100
+ klass = yield class_name
101
+ instance_variable_set(variable, klass.new(self))
102
+ end
103
+ instance_variable_get(variable)
85
104
  end
86
105
 
87
- private
88
-
89
106
  def camelize(term)
90
107
  string = term.to_s
91
108
  string = string.sub(/^[a-z\d]*/) { Regexp.last_match(0).capitalize }
92
- string.gsub(%r{(?:_|(/))([a-z\d]*)}) do
93
- Regexp.last_match(2).capitalize.to_s
94
- end
109
+ string.gsub(%r{(?:_|(/))([a-z\d]*)}) { Regexp.last_match(2).capitalize }
95
110
  end
96
111
  end
97
112
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ module Query
6
+ class Base < FinAppsCore::REST::Resources
7
+ def end_point
8
+ "query/#{super}"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ module Query
6
+ class Screenings < FinApps::REST::Query::Base
7
+ end
8
+ end
9
+ end
10
+ end
@@ -17,7 +17,7 @@ module FinApps
17
17
  not_blank(value, :value)
18
18
 
19
19
  path = "screenings/#{ERB::Util.url_encode(id)}/meta"
20
- super({key => value}, path)
20
+ super({key: key, value: value}, path)
21
21
  end
22
22
 
23
23
  def destroy(id, key)
@@ -57,6 +57,7 @@ module FinApps
57
57
 
58
58
  def build_filter(params)
59
59
  term_filter(params[:searchTerm])
60
+ .merge(operator_filter(params[:operatorID]))
60
61
  .merge(date_range_filter(params[:fromDate], params[:toDate]))
61
62
  .merge(progress_filter(params[:progress]))
62
63
  end
@@ -73,7 +74,9 @@ module FinApps
73
74
  {'consumer.email': term},
74
75
  {'consumer.first_name': term},
75
76
  {'consumer.last_name': term},
76
- {'consumer.external_id': term}
77
+ {'consumer.external_id': term},
78
+ {'operator.first_name': term},
79
+ {'operator.last_name': term}
77
80
  ]
78
81
  end
79
82
 
@@ -84,11 +87,19 @@ module FinApps
84
87
  term.split.each do |t|
85
88
  arr.append('consumer.first_name': t)
86
89
  arr.append('consumer.last_name': t)
90
+ arr.append('operator.first_name': t)
91
+ arr.append('operator.last_name': t)
87
92
  end
88
93
 
89
94
  arr
90
95
  end
91
96
 
97
+ def operator_filter(operator_id)
98
+ return {} unless operator_id
99
+
100
+ {operator_id: operator_id}
101
+ end
102
+
92
103
  def date_range_filter(from_date, to_date)
93
104
  return {} unless from_date || to_date
94
105
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '6.7.0'
4
+ VERSION = '6.9.1'
5
5
  end
data/lib/finapps.rb CHANGED
@@ -54,5 +54,8 @@ require 'finapps/rest/verix/verix_records'
54
54
  require 'finapps/rest/verix/verix_pdf_documents'
55
55
  require 'finapps/rest/verix/verix_documents'
56
56
 
57
+ require 'finapps/rest/query/base'
58
+ require 'finapps/rest/query/screenings'
59
+
57
60
  require 'finapps/utils/query_builder'
58
61
  require 'finapps/version' unless defined?(FinApps::VERSION)
@@ -12,7 +12,8 @@ RSpec.describe FinApps::REST::Client do
12
12
  context 'with an instance of Client' do
13
13
  subject(:client) { described_class.new(:company_token) }
14
14
 
15
- FinApps::REST::Client::RESOURCES.each do |method|
15
+ (FinApps::REST::Client::RESOURCES +
16
+ FinApps::REST::Client::QUERY_RESOURCES).each do |method|
16
17
  it("responds to #{method}") { expect(client).to respond_to(method) }
17
18
 
18
19
  it "memoizes the result of #{method}" do
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+ require 'spec_helpers/api_request'
5
+
6
+ RSpec.describe FinApps::REST::Query::Base do
7
+ describe '#end_point' do
8
+ it 'starts with query/' do
9
+ expect(described_class.new(:client).end_point).to start_with('query/')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+ require 'spec_helpers/api_request'
5
+
6
+ RSpec.describe FinApps::REST::Query::Screenings do
7
+ include SpecHelpers::Client
8
+
9
+ subject(:create) { described_class.new(client).create('string') }
10
+
11
+ describe '#create' do
12
+ context 'when valid tenant token is provided' do
13
+ it_behaves_like 'an API request'
14
+ it_behaves_like 'a successful request'
15
+ it 'sends the params in the body of the request' do
16
+ create
17
+ url = "#{versioned_api_path}/query/screenings"
18
+
19
+ expect(WebMock).to have_requested(:post, url).with(body: 'string')
20
+ end
21
+ end
22
+ end
23
+ end
@@ -84,10 +84,24 @@ RSpec.describe FinApps::REST::Screenings do
84
84
  {'consumer.first_name': 'le term'},
85
85
  {'consumer.last_name': 'le term'},
86
86
  {'consumer.external_id': 'le term'},
87
+ {'operator.first_name': 'le term'},
88
+ {'operator.last_name': 'le term'},
87
89
  {'consumer.first_name': 'le'},
88
90
  {'consumer.last_name': 'le'},
91
+ {'operator.first_name': 'le'},
92
+ {'operator.last_name': 'le'},
89
93
  {'consumer.first_name': 'term'},
90
- {'consumer.last_name': 'term'}]
94
+ {'consumer.last_name': 'term'},
95
+ {'operator.first_name': 'term'},
96
+ {'operator.last_name': 'term'}]
97
+ }
98
+ end
99
+
100
+ context 'with operator' do
101
+ let(:params) { {operatorID: '123abc'} }
102
+
103
+ it_behaves_like 'a correct query builder', {
104
+ operator_id: '123abc'
91
105
  }
92
106
  end
93
107
  end
@@ -5,6 +5,7 @@ require_relative 'documents_uploads_routes'
5
5
  require_relative 'screenings_routes'
6
6
  require_relative 'routes/actors'
7
7
  require_relative 'routes/screening_metadatas'
8
+ require_relative 'routes/query_screenings'
8
9
 
9
10
  module Fake
10
11
  # the FakeApi class is used to mock API requests while testing.
@@ -24,6 +25,7 @@ module Fake
24
25
  include DocumentsUploadsRoutes
25
26
  include ScreeningsRoutes
26
27
  include ScreeningMetadatasRoutes
28
+ include QueryScreeningRoutes
27
29
 
28
30
  # verix_metadata
29
31
  get("/#{version}/v/metadata") do
@@ -0,0 +1,68 @@
1
+ [
2
+ {
3
+ "answered_questions": [
4
+ {
5
+ "additional_label": "string",
6
+ "answer_type": "string",
7
+ "answers": [
8
+ {
9
+ "documents": [
10
+ {
11
+ "name": "string",
12
+ "type": 0
13
+ }
14
+ ],
15
+ "id": "string",
16
+ "input_value": "string",
17
+ "label": "string",
18
+ "next_question_id": "string",
19
+ "type": "string",
20
+ "value": "string"
21
+ }
22
+ ],
23
+ "group": "string",
24
+ "id": "string",
25
+ "label": "string",
26
+ "summary": "string"
27
+ }
28
+ ],
29
+ "consumer": {
30
+ "email": "string",
31
+ "external_id": "string",
32
+ "first_name": "string",
33
+ "last_name": "string",
34
+ "public_id": "string"
35
+ },
36
+ "date_created": "2022-02-04T14:29:03Z",
37
+ "date_modified": "2022-02-04T14:29:03Z",
38
+ "metadata": {
39
+ "property1": "string",
40
+ "property2": "string"
41
+ },
42
+ "operator": {
43
+ "email": "string",
44
+ "first_name": "string",
45
+ "last_name": "string"
46
+ },
47
+ "operator_id": "string",
48
+ "original_consumer": {
49
+ "email": "string",
50
+ "external_id": "string",
51
+ "first_name": "string",
52
+ "last_name": "string",
53
+ "public_id": "string"
54
+ },
55
+ "progress": 0,
56
+ "result": {
57
+ "documents": [
58
+ {
59
+ "name": "string",
60
+ "type": 0
61
+ }
62
+ ],
63
+ "status": "string"
64
+ },
65
+ "s_id": "string",
66
+ "schema_id": "string"
67
+ }
68
+ ]
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fake
4
+ module QueryScreeningRoutes
5
+ class << self
6
+ def included(base)
7
+ base.post("/#{base.version}/query/screenings") do
8
+ json_response 200, 'query/screenings.json'
9
+ end
10
+ super
11
+ end
12
+ end
13
+ end
14
+ 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.7.0
4
+ version: 6.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -294,6 +294,8 @@ files:
294
294
  - lib/finapps/rest/portfolios_available_consumers.rb
295
295
  - lib/finapps/rest/portfolios_consumers.rb
296
296
  - lib/finapps/rest/products.rb
297
+ - lib/finapps/rest/query/base.rb
298
+ - lib/finapps/rest/query/screenings.rb
297
299
  - lib/finapps/rest/screening_metadatas.rb
298
300
  - lib/finapps/rest/screenings.rb
299
301
  - lib/finapps/rest/sessions.rb
@@ -342,6 +344,8 @@ files:
342
344
  - spec/rest/portfolios_consumers_spec.rb
343
345
  - spec/rest/portfolios_spec.rb
344
346
  - spec/rest/products_spec.rb
347
+ - spec/rest/query/base_spec.rb
348
+ - spec/rest/query/screenings_spec.rb
345
349
  - spec/rest/screening_metadatas_spec.rb
346
350
  - spec/rest/screenings_spec.rb
347
351
  - spec/rest/sessions_spec.rb
@@ -406,6 +410,7 @@ files:
406
410
  - spec/support/fixtures/portfolios_available_consumers.json
407
411
  - spec/support/fixtures/portfolios_consumers.json
408
412
  - spec/support/fixtures/products.json
413
+ - spec/support/fixtures/query/screenings.json
409
414
  - spec/support/fixtures/resource.json
410
415
  - spec/support/fixtures/resource_not_found.json
411
416
  - spec/support/fixtures/resources.json
@@ -434,6 +439,7 @@ files:
434
439
  - spec/support/fixtures/verix/record/create.json
435
440
  - spec/support/fixtures/verix/record/list.json
436
441
  - spec/support/routes/actors.rb
442
+ - spec/support/routes/query_screenings.rb
437
443
  - spec/support/routes/screening_metadatas.rb
438
444
  - spec/support/screenings_routes.rb
439
445
  - spec/utils/query_builder_spec.rb
@@ -468,58 +474,61 @@ signing_key:
468
474
  specification_version: 4
469
475
  summary: FinApps REST API ruby client.
470
476
  test_files:
477
+ - spec/utils/query_builder_spec.rb
478
+ - spec/support/fake_api.rb
479
+ - spec/support/documents_uploads_routes.rb
480
+ - spec/support/routes/query_screenings.rb
471
481
  - spec/support/routes/actors.rb
472
482
  - spec/support/routes/screening_metadatas.rb
473
483
  - spec/support/screenings_routes.rb
474
- - spec/support/documents_uploads_routes.rb
475
- - spec/support/fake_api.rb
476
- - spec/rest/operators_login_tokens_spec.rb
477
- - spec/rest/screening_metadatas_spec.rb
478
- - spec/rest/documents_upload_types_spec.rb
479
- - spec/rest/orders_spec.rb
480
- - spec/rest/tenant_app_settings_spec.rb
481
- - spec/rest/version_spec.rb
482
- - spec/rest/screenings_spec.rb
483
- - spec/rest/documents_orders_spec.rb
484
- - spec/rest/documents_uploads_spec.rb
485
- - spec/rest/alert_definitions_spec.rb
486
- - spec/rest/password_resets_spec.rb
487
- - spec/rest/order_reports_spec.rb
488
- - spec/rest/alert_occurrences_spec.rb
489
- - spec/rest/portfolios_available_consumers_spec.rb
490
- - spec/rest/consumer_login_tokens_spec.rb
491
- - spec/rest/tenant_settings_spec.rb
492
- - spec/rest/order_statuses_spec.rb
493
- - spec/rest/products_spec.rb
494
- - spec/rest/operators_spec.rb
495
- - spec/rest/sessions_spec.rb
496
- - spec/rest/order_notifications_spec.rb
497
- - spec/rest/signed_documents_downloads_spec.rb
498
- - spec/rest/portfolio_reports_spec.rb
499
- - spec/rest/portfolios_spec.rb
500
- - spec/rest/consumers_portfolios_spec.rb
484
+ - spec/spec_helper.rb
485
+ - spec/rest/documents_orders_notifications_spec.rb
486
+ - spec/rest/operator_change_password_email_spec.rb
487
+ - spec/rest/order_assignments_spec.rb
488
+ - spec/rest/order_refreshes_spec.rb
489
+ - spec/rest/verix/verix_records_spec.rb
501
490
  - spec/rest/verix/verix_documents_spec.rb
502
491
  - spec/rest/verix/verix_pdf_documents_spec.rb
503
492
  - spec/rest/verix/verix_metadata_spec.rb
504
- - spec/rest/verix/verix_records_spec.rb
505
- - spec/rest/order_refreshes_spec.rb
493
+ - spec/rest/consumers_portfolios_spec.rb
494
+ - spec/rest/signed_documents_downloads_spec.rb
495
+ - spec/rest/portfolio_reports_spec.rb
496
+ - spec/rest/order_statuses_spec.rb
497
+ - spec/rest/esign_templates_spec.rb
498
+ - spec/rest/order_reports_spec.rb
499
+ - spec/rest/tenant_settings_spec.rb
500
+ - spec/rest/portfolios_alerts_spec.rb
501
+ - spec/rest/orders_spec.rb
502
+ - spec/rest/consumer_login_tokens_spec.rb
503
+ - spec/rest/operators_spec.rb
504
+ - spec/rest/actors_spec.rb
505
+ - spec/rest/plaid/plaid_accounts_spec.rb
506
506
  - spec/rest/plaid/plaid_account_permissions_spec.rb
507
- - spec/rest/plaid/plaid_consumer_institutions_spec.rb
508
- - spec/rest/plaid/plaid_institution_logos_spec.rb
509
507
  - spec/rest/plaid/plaid_webhooks_spec.rb
510
- - spec/rest/plaid/plaid_accounts_spec.rb
511
- - spec/rest/client_spec.rb
512
- - spec/rest/portfolios_alerts_spec.rb
508
+ - spec/rest/plaid/plaid_institution_logos_spec.rb
509
+ - spec/rest/plaid/plaid_consumer_institutions_spec.rb
510
+ - spec/rest/tenant_app_settings_spec.rb
513
511
  - spec/rest/consumers_spec.rb
514
- - spec/rest/order_assignments_spec.rb
515
- - spec/rest/operator_change_password_email_spec.rb
516
- - spec/rest/documents_orders_notifications_spec.rb
517
- - spec/rest/operators_password_resets_spec.rb
518
- - spec/rest/esign_templates_spec.rb
519
512
  - spec/rest/order_tokens_spec.rb
513
+ - spec/rest/alert_definitions_spec.rb
514
+ - spec/rest/documents_upload_types_spec.rb
515
+ - spec/rest/order_notifications_spec.rb
516
+ - spec/rest/documents_orders_spec.rb
517
+ - spec/rest/documents_uploads_spec.rb
518
+ - spec/rest/portfolios_available_consumers_spec.rb
519
+ - spec/rest/screening_metadatas_spec.rb
520
+ - spec/rest/client_spec.rb
521
+ - spec/rest/screenings_spec.rb
522
+ - spec/rest/sessions_spec.rb
523
+ - spec/rest/query/screenings_spec.rb
524
+ - spec/rest/query/base_spec.rb
525
+ - spec/rest/operators_password_resets_spec.rb
526
+ - spec/rest/password_resets_spec.rb
527
+ - spec/rest/products_spec.rb
528
+ - spec/rest/portfolios_spec.rb
529
+ - spec/rest/operators_login_tokens_spec.rb
530
+ - spec/rest/alert_occurrences_spec.rb
520
531
  - spec/rest/portfolios_consumers_spec.rb
521
- - spec/rest/actors_spec.rb
532
+ - spec/rest/version_spec.rb
522
533
  - spec/spec_helpers/api_request.rb
523
534
  - spec/spec_helpers/client.rb
524
- - spec/utils/query_builder_spec.rb
525
- - spec/spec_helper.rb