finapps 6.3.1 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/finapps.gemspec +2 -2
- data/lib/finapps/rest/screenings.rb +56 -6
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/screenings_spec.rb +37 -13
- metadata +49 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8428ee4965080f78c083fc2e3d0de2fc66b59596bf5ea81bbbc17e2c11ad2b39
|
4
|
+
data.tar.gz: 0656c926f0b3c70929fb6fbe1b69282d766c56c777aa32ed377218ceac9a6824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4163eda4a00e4df6c1a34cd76733d11c53fc4774899aabea933bbfe304e5acbd92ea714ccbbd974f8bd496278e501d7fd0d8591ad503480356e9ca75f98198ee
|
7
|
+
data.tar.gz: 756edbc47cdb115e15efe6dc53be0aeea1610feb93470fed421105ce2a7a6b8fa59c04fc84c99c9c5d75a8914b21de5e68d69c29ff584ab810506f948daed233
|
data/finapps.gemspec
CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.16'
|
26
26
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.10', '>= 3.10.0'
|
28
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
28
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.5'
|
29
29
|
spec.add_development_dependency 'rubocop-rake', '~> 0.5', '>= 0.5.1'
|
30
30
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.4', '>= 2.4.0'
|
31
31
|
spec.add_development_dependency 'simplecov', '~> 0.21', '>= 0.21.2'
|
32
32
|
spec.add_development_dependency 'simplecov-console', '~> 0.9'
|
33
33
|
spec.add_development_dependency 'sinatra', '~> 2.1', '>= 2.1.0'
|
34
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
34
|
+
spec.add_development_dependency 'webmock', '~> 3.14', '>= 3.14.0'
|
35
35
|
|
36
36
|
spec.extra_rdoc_files = %w[README.md LICENSE.txt]
|
37
37
|
spec.rdoc_options = %w[--line-numbers --inline-source --title finapps-ruby --main README.md]
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'date'
|
3
4
|
require_relative '../utils/query_builder'
|
4
5
|
|
5
6
|
module FinApps
|
@@ -55,22 +56,71 @@ module FinApps
|
|
55
56
|
private
|
56
57
|
|
57
58
|
def build_filter(params)
|
58
|
-
|
59
|
+
term_filter(params[:searchTerm])
|
60
|
+
.merge(date_range_filter(params[:fromDate], params[:toDate]))
|
61
|
+
.merge(progress_filter(params[:progress]))
|
59
62
|
end
|
60
63
|
|
61
|
-
def
|
64
|
+
def term_filter(term)
|
62
65
|
return {} unless term
|
63
66
|
|
64
|
-
|
65
|
-
{'$or': query}
|
67
|
+
{'$or': term_array(term) + split_term_array(term)}
|
66
68
|
end
|
67
69
|
|
68
|
-
def
|
70
|
+
def term_array(term)
|
69
71
|
[
|
70
72
|
{'consumer.public_id': term},
|
71
|
-
{'consumer.email': term}
|
73
|
+
{'consumer.email': term},
|
74
|
+
{'consumer.first_name': term},
|
75
|
+
{'consumer.last_name': term},
|
76
|
+
{'consumer.external_id': term}
|
72
77
|
]
|
73
78
|
end
|
79
|
+
|
80
|
+
def split_term_array(term)
|
81
|
+
return [] unless space?(term)
|
82
|
+
|
83
|
+
arr = []
|
84
|
+
term.split.each do |t|
|
85
|
+
arr.append('consumer.first_name': t)
|
86
|
+
arr.append('consumer.last_name': t)
|
87
|
+
end
|
88
|
+
|
89
|
+
arr
|
90
|
+
end
|
91
|
+
|
92
|
+
def date_range_filter(from_date, to_date)
|
93
|
+
return {} unless from_date || to_date
|
94
|
+
|
95
|
+
{'*date_created': from_filter(from_date).merge(to_filter(to_date))}
|
96
|
+
end
|
97
|
+
|
98
|
+
def from_filter(from_date)
|
99
|
+
return {} unless from_date
|
100
|
+
|
101
|
+
{'$gte': to_rfc_date(from_date.to_s)}
|
102
|
+
end
|
103
|
+
|
104
|
+
def to_filter(to_date)
|
105
|
+
return {} unless to_date
|
106
|
+
|
107
|
+
{'$lt': to_rfc_date(to_date.to_s)}
|
108
|
+
end
|
109
|
+
|
110
|
+
def to_rfc_date(str)
|
111
|
+
date = DateTime.parse(str)
|
112
|
+
date.rfc3339
|
113
|
+
end
|
114
|
+
|
115
|
+
def progress_filter(progress)
|
116
|
+
return {} unless progress
|
117
|
+
|
118
|
+
{progress: progress}
|
119
|
+
end
|
120
|
+
|
121
|
+
def space?(string)
|
122
|
+
/\s/.match?(string)
|
123
|
+
end
|
74
124
|
end
|
75
125
|
end
|
76
126
|
end
|
data/lib/finapps/version.rb
CHANGED
@@ -13,15 +13,6 @@ RSpec.describe FinApps::REST::Screenings do
|
|
13
13
|
subject(:list) { described_class.new(client).list(params) }
|
14
14
|
|
15
15
|
context 'with valid params' do
|
16
|
-
let(:params) do
|
17
|
-
{
|
18
|
-
page: 2,
|
19
|
-
sort: 'date_created',
|
20
|
-
requested: 25,
|
21
|
-
searchTerm: 'term'
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
16
|
context 'without searchTerm' do
|
26
17
|
let(:params) { {searchTerm: nil, page: 2} }
|
27
18
|
|
@@ -38,8 +29,34 @@ RSpec.describe FinApps::REST::Screenings do
|
|
38
29
|
end
|
39
30
|
end
|
40
31
|
|
32
|
+
# rubocop:disable RSpec/ExampleLength
|
33
|
+
context 'with date range' do
|
34
|
+
let(:params) { {fromDate: '08/01/2021', toDate: '09/01/2021'} }
|
35
|
+
|
36
|
+
it_behaves_like 'an API request'
|
37
|
+
it_behaves_like 'a successful request'
|
38
|
+
it 'performs a get and returns the response' do
|
39
|
+
expect(results).to have_key(:records)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'builds query and sends proper request' do
|
43
|
+
list
|
44
|
+
json_filter = {
|
45
|
+
'*date_created': {'$gte': '2021-01-08T00:00:00%2B00:00',
|
46
|
+
'$lt': '2021-01-09T00:00:00%2B00:00'}
|
47
|
+
}.to_json
|
48
|
+
encoded_filter = ERB::Util.url_encode json_filter
|
49
|
+
url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
|
50
|
+
|
51
|
+
expect(WebMock).to have_requested(:get, url)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
# rubocop:enable RSpec/ExampleLength
|
55
|
+
|
41
56
|
# rubocop:disable RSpec/ExampleLength
|
42
57
|
context 'with searchTerm' do
|
58
|
+
let(:params) { {searchTerm: 'le term'} }
|
59
|
+
|
43
60
|
it_behaves_like 'an API request'
|
44
61
|
it_behaves_like 'a successful request'
|
45
62
|
it 'performs a get and returns the response' do
|
@@ -48,10 +65,17 @@ RSpec.describe FinApps::REST::Screenings do
|
|
48
65
|
|
49
66
|
it 'builds query and sends proper request' do
|
50
67
|
list
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
68
|
+
json_filter = {'$or': [{'consumer.public_id': 'le term'},
|
69
|
+
{'consumer.email': 'le term'},
|
70
|
+
{'consumer.first_name': 'le term'},
|
71
|
+
{'consumer.last_name': 'le term'},
|
72
|
+
{'consumer.external_id': 'le term'},
|
73
|
+
{'consumer.first_name': 'le'},
|
74
|
+
{'consumer.last_name': 'le'},
|
75
|
+
{'consumer.first_name': 'term'},
|
76
|
+
{'consumer.last_name': 'term'}]}.to_json
|
77
|
+
encoded_filter = ERB::Util.url_encode json_filter
|
78
|
+
url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
|
55
79
|
|
56
80
|
expect(WebMock).to have_requested(:get, url)
|
57
81
|
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
|
+
version: 6.4.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-
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -96,20 +96,20 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '1.
|
99
|
+
version: '1.11'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
102
|
+
version: 1.11.5
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '1.
|
109
|
+
version: '1.11'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 1.
|
112
|
+
version: 1.11.5
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rubocop-rake
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,20 +210,20 @@ dependencies:
|
|
210
210
|
requirements:
|
211
211
|
- - "~>"
|
212
212
|
- !ruby/object:Gem::Version
|
213
|
-
version: '3.
|
213
|
+
version: '3.14'
|
214
214
|
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: 3.
|
216
|
+
version: 3.14.0
|
217
217
|
type: :development
|
218
218
|
prerelease: false
|
219
219
|
version_requirements: !ruby/object:Gem::Requirement
|
220
220
|
requirements:
|
221
221
|
- - "~>"
|
222
222
|
- !ruby/object:Gem::Version
|
223
|
-
version: '3.
|
223
|
+
version: '3.14'
|
224
224
|
- - ">="
|
225
225
|
- !ruby/object:Gem::Version
|
226
|
-
version: 3.
|
226
|
+
version: 3.14.0
|
227
227
|
description: A simple library for communicating with the FinApps REST API.
|
228
228
|
email:
|
229
229
|
- erich@financialapps.com
|
@@ -459,54 +459,54 @@ signing_key:
|
|
459
459
|
specification_version: 4
|
460
460
|
summary: FinApps REST API ruby client.
|
461
461
|
test_files:
|
462
|
-
- spec/
|
463
|
-
- spec/
|
464
|
-
- spec/
|
465
|
-
- spec/
|
466
|
-
- spec/
|
467
|
-
- spec/rest/
|
468
|
-
- spec/rest/password_resets_spec.rb
|
462
|
+
- spec/support/screenings_routes.rb
|
463
|
+
- spec/support/fake_api.rb
|
464
|
+
- spec/support/documents_uploads_routes.rb
|
465
|
+
- spec/spec_helper.rb
|
466
|
+
- spec/spec_helpers/client.rb
|
467
|
+
- spec/rest/portfolios_alerts_spec.rb
|
469
468
|
- spec/rest/products_spec.rb
|
469
|
+
- spec/rest/documents_orders_spec.rb
|
470
|
+
- spec/rest/password_resets_spec.rb
|
471
|
+
- spec/rest/order_statuses_spec.rb
|
472
|
+
- spec/rest/operators_spec.rb
|
473
|
+
- spec/rest/operator_change_password_email_spec.rb
|
474
|
+
- spec/rest/esign_templates_spec.rb
|
475
|
+
- spec/rest/order_tokens_spec.rb
|
476
|
+
- spec/rest/order_reports_spec.rb
|
477
|
+
- spec/rest/documents_upload_types_spec.rb
|
478
|
+
- spec/rest/consumers_portfolios_spec.rb
|
479
|
+
- spec/rest/portfolios_consumers_spec.rb
|
470
480
|
- spec/rest/verix/verix_metadata_spec.rb
|
471
|
-
- spec/rest/verix/verix_records_spec.rb
|
472
481
|
- spec/rest/verix/verix_documents_spec.rb
|
482
|
+
- spec/rest/verix/verix_records_spec.rb
|
473
483
|
- spec/rest/verix/verix_pdf_documents_spec.rb
|
484
|
+
- spec/rest/api_request.rb
|
485
|
+
- spec/rest/tenant_settings_spec.rb
|
486
|
+
- spec/rest/consumers_spec.rb
|
487
|
+
- spec/rest/client_spec.rb
|
488
|
+
- spec/rest/portfolios_available_consumers_spec.rb
|
489
|
+
- spec/rest/alert_definitions_spec.rb
|
490
|
+
- spec/rest/order_notifications_spec.rb
|
491
|
+
- spec/rest/operators_password_resets_spec.rb
|
492
|
+
- spec/rest/version_spec.rb
|
493
|
+
- spec/rest/portfolios_spec.rb
|
494
|
+
- spec/rest/sessions_spec.rb
|
495
|
+
- spec/rest/documents_orders_notifications_spec.rb
|
496
|
+
- spec/rest/tenant_app_settings_spec.rb
|
474
497
|
- spec/rest/documents_uploads_spec.rb
|
475
|
-
- spec/rest/
|
476
|
-
- spec/rest/
|
477
|
-
- spec/rest/
|
478
|
-
- spec/rest/
|
498
|
+
- spec/rest/screenings_spec.rb
|
499
|
+
- spec/rest/signed_documents_downloads_spec.rb
|
500
|
+
- spec/rest/plaid/plaid_account_permissions_spec.rb
|
501
|
+
- spec/rest/plaid/plaid_webhooks_spec.rb
|
479
502
|
- spec/rest/plaid/plaid_accounts_spec.rb
|
480
503
|
- spec/rest/plaid/plaid_institution_logos_spec.rb
|
481
504
|
- spec/rest/plaid/plaid_consumer_institutions_spec.rb
|
482
|
-
- spec/rest/plaid/plaid_account_permissions_spec.rb
|
483
|
-
- spec/rest/plaid/plaid_webhooks_spec.rb
|
484
|
-
- spec/rest/portfolios_consumers_spec.rb
|
485
|
-
- spec/rest/order_statuses_spec.rb
|
486
505
|
- spec/rest/order_assignments_spec.rb
|
487
|
-
- spec/rest/version_spec.rb
|
488
|
-
- spec/rest/portfolio_reports_spec.rb
|
489
|
-
- spec/rest/order_tokens_spec.rb
|
490
|
-
- spec/rest/order_notifications_spec.rb
|
491
|
-
- spec/rest/sessions_spec.rb
|
492
|
-
- spec/rest/client_spec.rb
|
493
|
-
- spec/rest/documents_orders_spec.rb
|
494
|
-
- spec/rest/portfolios_available_consumers_spec.rb
|
495
|
-
- spec/rest/consumers_spec.rb
|
496
506
|
- spec/rest/consumer_login_tokens_spec.rb
|
497
|
-
- spec/rest/
|
498
|
-
- spec/rest/tenant_app_settings_spec.rb
|
499
|
-
- spec/rest/order_reports_spec.rb
|
500
|
-
- spec/rest/signed_documents_downloads_spec.rb
|
507
|
+
- spec/rest/alert_occurrences_spec.rb
|
501
508
|
- spec/rest/operators_login_tokens_spec.rb
|
502
|
-
- spec/rest/
|
503
|
-
- spec/rest/
|
504
|
-
- spec/rest/
|
505
|
-
- spec/rest/portfolios_spec.rb
|
506
|
-
- spec/rest/alert_definitions_spec.rb
|
507
|
-
- spec/spec_helpers/client.rb
|
508
|
-
- spec/support/fake_api.rb
|
509
|
-
- spec/support/screenings_routes.rb
|
510
|
-
- spec/support/documents_uploads_routes.rb
|
511
|
-
- spec/spec_helper.rb
|
509
|
+
- spec/rest/order_refreshes_spec.rb
|
510
|
+
- spec/rest/portfolio_reports_spec.rb
|
511
|
+
- spec/rest/orders_spec.rb
|
512
512
|
- spec/utils/query_builder_spec.rb
|