finapps 6.8.0 → 6.9.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: d9f972096761ac681f6f984445a44fe9fe28dca7e2ee8b45839e0f1ef5b60a24
4
- data.tar.gz: a973e1c1790dd21f505b673e95660882c19a781e605cfea6e2707efef6e8b62d
3
+ metadata.gz: d40d367eccfbf2e294b583650afe8ca7f73478c3fb0d4b989560965552422af3
4
+ data.tar.gz: a267d69a66d99def1f79c0afebd02ba58fd6b8177aae4f041988eb04ba6469d9
5
5
  SHA512:
6
- metadata.gz: d47eecdc4513c9676b9fdb9f8b589a98acecfc593bdb828099079584832289f5b50275fdc3b7b280e774fb9e6aef4490c739b336e3dd9a8439c81e465a02c725
7
- data.tar.gz: 5fdedc48c9f1887f146e4c33ed55fed6b5ab604bec091670991972ff063f9174f93d56853af506595286af0fcccf15be75c465c8a72f56bf69f4e1a3c721bf3d
6
+ metadata.gz: 0efaad47504531652d32fb805477f5c1a253e656615402b54f787334813929674e871f4ca5eaf0a511d2f9257a805015de13afd851a150f24b6c61decc899e77
7
+ data.tar.gz: 8f45fe8f7c2e92351bad40af3a3d29868c908b0d7794bc006b67be12c2fbe8a6452d973beba135f6be5fd5da217b2e36cf694aee3af30eb50e1715cbf6a1ca51
@@ -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 = capitalize(method.to_s.gsub(/query_/, ''))
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '6.8.0'
4
+ VERSION = '6.9.0'
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)
@@ -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
@@ -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.8.0
4
+ version: 6.9.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: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2022-02-05 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