finapps 6.2.0 → 6.4.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: 2f72a781755bf6469c544e60b5ae9fdf11edb57efe6dd947594c8c03e5d6204b
4
- data.tar.gz: 06df03914644a7b4eea4a5a3478d12959b4470f30ed1c31adbe4beed7b83dcb3
3
+ metadata.gz: 685415494dde868b2db873ce98d626c4ed45f4e96604b475c1db6fcd892abbeb
4
+ data.tar.gz: 0b4b6599766968bee2752b7d2e968c9d856a9f56f0ebfe1d33d411f3d57e6579
5
5
  SHA512:
6
- metadata.gz: 27109c39e9a476272df05507d7ab97b017add220878422120279708c70db385dd82bc0fe65d6c92521e3e640f9bcde905810893cf0c88fec452b9cd2d51782ae
7
- data.tar.gz: f02bc2aa43038d59036b43b312e81b9ef865082c28130c0b34745d4e7d2a84175fc4f00b0528433579334e906cfceb5409288bb0aa068fdc0eb4e033a1ee3f80
6
+ metadata.gz: eab93c5894770567f201112caf3b93455c4d473aa20c8e466a9aafb0afdbe6a6dd556d55efa10db62af89f6b41d3b332c04b162b4f728c712ff0982c9843bd1b
7
+ data.tar.gz: c008d2a8dffc8be3e359c95bd7de30f07de6c26b12d2d7bfbb382553eaa108d5228e652fe56ce10ef7be9b91abaafe753fc4644c50ab928d06f86d7db3889370
data/finapps.gemspec CHANGED
@@ -20,18 +20,18 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = Dir['spec/**/*.rb']
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_runtime_dependency 'finapps_core', '~> 6.0', '>= 6.0.0'
23
+ spec.add_runtime_dependency 'finapps_core', '~> 6.0', '>= 6.0.1'
24
24
 
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.9', '>= 1.9.2'
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.12', '>= 3.12.2'
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]
@@ -27,6 +27,7 @@ module FinApps
27
27
  operators
28
28
  operator_login_tokens
29
29
  operators_password_resets
30
+ operator_change_password_email
30
31
  password_resets
31
32
  plaid_webhooks
32
33
  plaid_consumer_institutions
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class OperatorChangePasswordEmail < FinAppsCore::REST::Resources
6
+ def create(params)
7
+ not_blank(params, :params)
8
+ super params, 'login/change_password_email'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -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
- search_query(params[:searchTerm])
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 search_query(term)
64
+ def term_filter(term)
62
65
  return {} unless term
63
66
 
64
- query = search_query_object(term)
65
- {'$or': query}
67
+ {'$or': term_array(term) + split_term_array(term)}
66
68
  end
67
69
 
68
- def search_query_object(term)
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.to_int}
119
+ end
120
+
121
+ def space?(string)
122
+ /\s/.match?(string)
123
+ end
74
124
  end
75
125
  end
76
126
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '6.2.0'
4
+ VERSION = '6.4.1'
5
5
  end
data/lib/finapps.rb CHANGED
@@ -17,6 +17,7 @@ require 'finapps/rest/password_resets'
17
17
  require 'finapps/rest/operators'
18
18
  require 'finapps/rest/operator_login_tokens'
19
19
  require 'finapps/rest/operators_password_resets'
20
+ require 'finapps/rest/operator_change_password_email'
20
21
  require 'finapps/rest/products'
21
22
  require 'finapps/rest/order_assignments'
22
23
  require 'finapps/rest/client'
@@ -215,7 +215,7 @@ RSpec.describe FinApps::REST::DocumentsOrders do
215
215
  end
216
216
  end
217
217
 
218
- context 'with missing params' do
218
+ context 'with missing params' do
219
219
  let(:params) { nil }
220
220
 
221
221
  it_behaves_like 'a request that raises an error'
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+
5
+ RSpec.describe FinApps::REST::OperatorChangePasswordEmail do
6
+ context 'when initialized with valid FinApps::Client object' do
7
+ include SpecHelpers::Client
8
+ subject(:operators_change_password_email) do
9
+ described_class.new(client)
10
+ end
11
+
12
+ describe '#create' do
13
+ let(:results) { create[0] }
14
+ let(:error_messages) { create[1] }
15
+
16
+ context 'when missing params' do
17
+ let(:create) { subject.create(nil) }
18
+
19
+ it do
20
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
21
+ end
22
+ end
23
+
24
+ context 'with valid params' do
25
+ let(:create) { subject.create(email: 'valid email') }
26
+
27
+ it('doesn\'t raise an error') { expect { create }.not_to raise_error }
28
+ it('doesn\'t have a response') { expect(results).to be_nil }
29
+ it('returns no error messages') { expect(error_messages).to be_empty }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -13,13 +13,20 @@ 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
- }
16
+ let(:params) { {} }
17
+
18
+ RSpec.shared_examples 'performs a GET request' do
19
+ it { expect(results).to have_key(:records) }
20
+ end
21
+
22
+ RSpec.shared_examples 'a correct query builder' do |filter|
23
+ it 'builds query and sends proper request' do
24
+ list
25
+ encoded_filter = ERB::Util.url_encode filter.to_json
26
+ url = "#{versioned_api_path}/screenings?filter=#{encoded_filter}"
27
+
28
+ expect(WebMock).to have_requested(:get, url)
29
+ end
23
30
  end
24
31
 
25
32
  context 'without searchTerm' do
@@ -27,36 +34,54 @@ RSpec.describe FinApps::REST::Screenings do
27
34
 
28
35
  it_behaves_like 'an API request'
29
36
  it_behaves_like 'a successful request'
30
- it 'performs a get and returns the response' do
31
- expect(results).to have_key(:records)
32
- end
33
-
37
+ it_behaves_like 'performs a GET request'
34
38
  it 'builds query and sends proper request' do
35
39
  list
36
40
  url = "#{versioned_api_path}/screenings?page=2"
41
+
37
42
  expect(WebMock).to have_requested(:get, url)
38
43
  end
39
44
  end
40
45
 
41
- # rubocop:disable RSpec/ExampleLength
42
- context 'with searchTerm' do
46
+ context 'with date range' do
47
+ let(:params) { {fromDate: '08/01/2021', toDate: '09/01/2021'} }
48
+
43
49
  it_behaves_like 'an API request'
44
50
  it_behaves_like 'a successful request'
45
- it 'performs a get and returns the response' do
46
- expect(results).to have_key(:records)
47
- end
51
+ it_behaves_like 'performs a GET request'
52
+ it_behaves_like 'a correct query builder', {
53
+ '*date_created': {'$gte': '2021-01-08T00:00:00%2B00:00',
54
+ '$lt': '2021-01-09T00:00:00%2B00:00'}
55
+ }
56
+ end
48
57
 
49
- it 'builds query and sends proper request' do
50
- list
51
- url =
52
- "#{versioned_api_path}/screenings?filter=%7B%22$or%22:%5B%7B%22" \
53
- 'consumer.public_id%22:%22term%22%7D,%7B%22consumer.email%22:%22' \
54
- 'term%22%7D%5D%7D&page=2&requested=25&sort=date_created'
58
+ context 'with progress' do
59
+ let(:params) { {progress: 10} }
55
60
 
56
- expect(WebMock).to have_requested(:get, url)
57
- end
61
+ it_behaves_like 'an API request'
62
+ it_behaves_like 'a successful request'
63
+ it_behaves_like 'performs a GET request'
64
+ it_behaves_like 'a correct query builder', {progress: 10}
65
+ end
66
+
67
+ context 'with searchTerm' do
68
+ let(:params) { {searchTerm: 'le term'} }
69
+
70
+ it_behaves_like 'an API request'
71
+ it_behaves_like 'a successful request'
72
+ it_behaves_like 'performs a GET request'
73
+ it_behaves_like 'a correct query builder', {
74
+ '$or': [{'consumer.public_id': 'le term'},
75
+ {'consumer.email': 'le term'},
76
+ {'consumer.first_name': 'le term'},
77
+ {'consumer.last_name': 'le term'},
78
+ {'consumer.external_id': 'le term'},
79
+ {'consumer.first_name': 'le'},
80
+ {'consumer.last_name': 'le'},
81
+ {'consumer.first_name': 'term'},
82
+ {'consumer.last_name': 'term'}]
83
+ }
58
84
  end
59
- # rubocop:enable RSpec/ExampleLength
60
85
  end
61
86
 
62
87
  context 'with invalid params' do
@@ -70,9 +95,7 @@ RSpec.describe FinApps::REST::Screenings do
70
95
 
71
96
  it_behaves_like 'an API request'
72
97
  it_behaves_like 'a successful request'
73
- it('performs a get and returns the response') do
74
- expect(results).to have_key(:records)
75
- end
98
+ it_behaves_like 'performs a GET request'
76
99
  end
77
100
  end
78
101
 
@@ -380,6 +380,17 @@ module Fake
380
380
  end
381
381
  end
382
382
 
383
+ # operator change password email
384
+ post("/#{version}/login/change_password_email") do
385
+ request.body.rewind
386
+ request_payload = JSON.parse request.body.read
387
+ if request_payload['email'] == 'valid email'
388
+ status 200
389
+ else
390
+ json_response 404, 'resource_not_found.json'
391
+ end
392
+ end
393
+
383
394
  # session
384
395
  post("/#{version}/login") do
385
396
  request.body.rewind
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.2.0
4
+ version: 6.4.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: 2021-07-19 00:00:00.000000000 Z
11
+ date: 2021-09-22 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: '6.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 6.0.0
22
+ version: 6.0.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '6.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 6.0.0
32
+ version: 6.0.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -96,20 +96,20 @@ dependencies:
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '1.9'
99
+ version: '1.11'
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 1.9.2
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.9'
109
+ version: '1.11'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 1.9.2
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.12'
213
+ version: '3.14'
214
214
  - - ">="
215
215
  - !ruby/object:Gem::Version
216
- version: 3.12.2
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.12'
223
+ version: '3.14'
224
224
  - - ">="
225
225
  - !ruby/object:Gem::Version
226
- version: 3.12.2
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
@@ -269,6 +269,7 @@ files:
269
269
  - lib/finapps/rest/documents_upload_types.rb
270
270
  - lib/finapps/rest/documents_uploads.rb
271
271
  - lib/finapps/rest/esign_templates.rb
272
+ - lib/finapps/rest/operator_change_password_email.rb
272
273
  - lib/finapps/rest/operator_login_tokens.rb
273
274
  - lib/finapps/rest/operators.rb
274
275
  - lib/finapps/rest/operators_password_resets.rb
@@ -316,6 +317,7 @@ files:
316
317
  - spec/rest/documents_upload_types_spec.rb
317
318
  - spec/rest/documents_uploads_spec.rb
318
319
  - spec/rest/esign_templates_spec.rb
320
+ - spec/rest/operator_change_password_email_spec.rb
319
321
  - spec/rest/operators_login_tokens_spec.rb
320
322
  - spec/rest/operators_password_resets_spec.rb
321
323
  - spec/rest/operators_spec.rb
@@ -457,53 +459,54 @@ signing_key:
457
459
  specification_version: 4
458
460
  summary: FinApps REST API ruby client.
459
461
  test_files:
460
- - spec/support/documents_uploads_routes.rb
461
462
  - spec/support/screenings_routes.rb
462
463
  - spec/support/fake_api.rb
463
- - spec/utils/query_builder_spec.rb
464
- - spec/spec_helpers/client.rb
464
+ - spec/support/documents_uploads_routes.rb
465
465
  - spec/spec_helper.rb
466
- - spec/rest/order_reports_spec.rb
467
- - spec/rest/api_request.rb
468
- - spec/rest/operators_login_tokens_spec.rb
469
- - spec/rest/tenant_app_settings_spec.rb
466
+ - spec/spec_helpers/client.rb
467
+ - spec/rest/portfolios_alerts_spec.rb
470
468
  - spec/rest/products_spec.rb
471
- - spec/rest/orders_spec.rb
472
- - spec/rest/esign_templates_spec.rb
473
- - spec/rest/sessions_spec.rb
474
- - spec/rest/order_assignments_spec.rb
475
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
476
475
  - spec/rest/order_tokens_spec.rb
477
- - spec/rest/order_notifications_spec.rb
478
- - spec/rest/order_refreshes_spec.rb
479
- - spec/rest/plaid/plaid_accounts_spec.rb
480
- - spec/rest/plaid/plaid_institution_logos_spec.rb
481
- - spec/rest/plaid/plaid_account_permissions_spec.rb
482
- - spec/rest/plaid/plaid_consumer_institutions_spec.rb
483
- - spec/rest/plaid/plaid_webhooks_spec.rb
484
- - spec/rest/verix/verix_pdf_documents_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
485
480
  - spec/rest/verix/verix_metadata_spec.rb
486
- - spec/rest/verix/verix_records_spec.rb
487
481
  - spec/rest/verix/verix_documents_spec.rb
488
- - spec/rest/portfolios_alerts_spec.rb
489
- - spec/rest/operators_password_resets_spec.rb
490
- - spec/rest/portfolio_reports_spec.rb
491
- - spec/rest/alert_definitions_spec.rb
492
- - spec/rest/consumers_spec.rb
482
+ - spec/rest/verix/verix_records_spec.rb
483
+ - spec/rest/verix/verix_pdf_documents_spec.rb
484
+ - spec/rest/api_request.rb
493
485
  - spec/rest/tenant_settings_spec.rb
494
- - spec/rest/signed_documents_downloads_spec.rb
495
- - spec/rest/consumers_portfolios_spec.rb
496
- - spec/rest/documents_upload_types_spec.rb
497
- - spec/rest/documents_orders_notifications_spec.rb
498
- - spec/rest/version_spec.rb
499
- - spec/rest/documents_uploads_spec.rb
486
+ - spec/rest/consumers_spec.rb
500
487
  - spec/rest/client_spec.rb
501
- - spec/rest/portfolios_consumers_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
502
493
  - spec/rest/portfolios_spec.rb
503
- - spec/rest/order_statuses_spec.rb
504
- - spec/rest/alert_occurrences_spec.rb
494
+ - spec/rest/sessions_spec.rb
495
+ - spec/rest/documents_orders_notifications_spec.rb
496
+ - spec/rest/tenant_app_settings_spec.rb
497
+ - spec/rest/documents_uploads_spec.rb
505
498
  - spec/rest/screenings_spec.rb
506
- - spec/rest/operators_spec.rb
507
- - spec/rest/password_resets_spec.rb
508
- - spec/rest/portfolios_available_consumers_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
502
+ - spec/rest/plaid/plaid_accounts_spec.rb
503
+ - spec/rest/plaid/plaid_institution_logos_spec.rb
504
+ - spec/rest/plaid/plaid_consumer_institutions_spec.rb
505
+ - spec/rest/order_assignments_spec.rb
509
506
  - spec/rest/consumer_login_tokens_spec.rb
507
+ - spec/rest/alert_occurrences_spec.rb
508
+ - spec/rest/operators_login_tokens_spec.rb
509
+ - spec/rest/order_refreshes_spec.rb
510
+ - spec/rest/portfolio_reports_spec.rb
511
+ - spec/rest/orders_spec.rb
512
+ - spec/utils/query_builder_spec.rb