finapps 5.0.26 → 5.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -1
  3. data/RELEASES.md +49 -0
  4. data/finapps.gemspec +1 -1
  5. data/lib/finapps.rb +6 -1
  6. data/lib/finapps/rest/client.rb +14 -8
  7. data/lib/finapps/rest/consumers.rb +16 -5
  8. data/lib/finapps/rest/documents_orders.rb +101 -0
  9. data/lib/finapps/rest/documents_orders_notifications.rb +14 -0
  10. data/lib/finapps/rest/esign_templates.rb +11 -0
  11. data/lib/finapps/rest/signed_documents_downloads.rb +15 -0
  12. data/lib/finapps/rest/verix/verix_documents.rb +21 -0
  13. data/lib/finapps/rest/verix/verix_pdf_documents.rb +15 -0
  14. data/lib/finapps/version.rb +1 -1
  15. data/spec/rest/consumers_spec.rb +19 -0
  16. data/spec/rest/documents_orders_notifications_spec.rb +40 -0
  17. data/spec/rest/documents_orders_spec.rb +287 -0
  18. data/spec/rest/esign_templates_spec.rb +20 -0
  19. data/spec/rest/signed_documents_downloads_spec.rb +35 -0
  20. data/spec/rest/verix/verix_documents_spec.rb +52 -0
  21. data/spec/rest/verix/verix_pdf_documents_spec.rb +35 -0
  22. data/spec/rest/verix/verix_records_spec.rb +3 -14
  23. data/spec/support/fake_api.rb +74 -8
  24. data/spec/support/fixtures/documents_order.json +75 -0
  25. data/spec/support/fixtures/documents_orders.json +32 -0
  26. data/spec/support/fixtures/esign_templates.json +6 -0
  27. data/spec/support/fixtures/invalid_order_id.json +5 -0
  28. data/spec/support/fixtures/invalid_signature_id.json +5 -0
  29. data/spec/support/fixtures/sign_url.json +4 -0
  30. data/spec/support/fixtures/signed_document.pdf +0 -0
  31. data/spec/support/fixtures/verix/document/document.pdf +0 -0
  32. data/spec/support/fixtures/verix/document/list.json +36 -0
  33. data/spec/support/fixtures/verix/document/show.json +35 -0
  34. data/spec/support/fixtures/verix/record/create.json +25 -17
  35. data/spec/support/fixtures/verix/record/list.json +121 -45
  36. metadata +80 -56
  37. data/lib/finapps/rest/statements.rb +0 -16
  38. data/spec/rest/statements_spec.rb +0 -42
  39. data/spec/support/fixtures/fake_pdf_statement.json +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b136353c2e5d3fbe91062737608381a908baa5c6138c762baaabd89b53ca634
4
- data.tar.gz: 54104334c9a5912e805b1cfcd9846e2fd33287156aa495e79b628b63a25b20d8
3
+ metadata.gz: 9245578f87d01b1010faa9e0f1d426873a24c86f860e83883027b966ba5ac129
4
+ data.tar.gz: d2b313cbdddb91c8645684727f91b1b7359becbcad1678758a604e43c4e0587c
5
5
  SHA512:
6
- metadata.gz: d7fb1d1a3392a254bbb42ccec77b5d649274e05f8382933b1b67cca4ec004e0719f0c14a5900a9b76a1097bc94243718c5f9baa6ea81479303d492447c23e829
7
- data.tar.gz: 4b39f05d96dfb90108a75efa12866decf7830f74e1303fa80562389485fc6448bf86be9826e60da9f1e1ee7361a4254f85d7f246764e5c115116f606fa1e2405
6
+ metadata.gz: 46be47b08a87fa355fe54b4db658074496561a6cf0f95c32a239f9b7164159b2aa13ce3a9a8030c5050c30086534212e0d947e88875e686a51edaf197d69c47d
7
+ data.tar.gz: afa0a48469d1538cc2af130a61d5765c4f7dd3e72c24a2c624a20d28f6436d16074b8e73bb25f68c4751946ea1b062b2438309173857ebbe1a314b18948ff874
@@ -12,7 +12,8 @@ plugins:
12
12
  enabled: true
13
13
  config:
14
14
  languages:
15
- - ruby
15
+ ruby:
16
+ mass_threshold: 30
16
17
 
17
18
  ratings:
18
19
  paths:
@@ -1,3 +1,52 @@
1
+ ## [5.0.31] - 2020-06-11
2
+
3
+ ### Changed
4
+ * Consumer and Doc-order search to query names on spaces ([#224][i224])
5
+
6
+ [i224]: https://github.com/finapps/ruby-client/issues/224
7
+
8
+ [5.0.31]: https://github.com/finapps/ruby-client/compare/5.0.30...5.0.31
9
+
10
+ ## [5.0.30] - 2020-05-28
11
+
12
+ ### Added
13
+ * New esign endpoints ([#222][i222])
14
+
15
+ ### Changed
16
+ * Search query for documents orders ([#221][i221])
17
+
18
+ [i221]: https://github.com/finapps/ruby-client/issues/221
19
+ [i222]: https://github.com/finapps/ruby-client/issues/222
20
+
21
+ [5.0.30]: https://github.com/finapps/ruby-client/compare/5.0.29...5.0.30
22
+
23
+ ## [5.0.29] - 2020-05-08
24
+
25
+ ### Added
26
+ * Document-orders endpoints ([#219][i219])
27
+
28
+ [i219]: https://github.com/finapps/ruby-client/issues/219
29
+
30
+ [5.0.29]: https://github.com/finapps/ruby-client/compare/5.0.28...5.0.29
31
+
32
+ ## [5.0.28] - 2020-02-19
33
+
34
+ ### Added
35
+ * Verix document endpoints ([#217][i217])
36
+
37
+ [i217]: https://github.com/finapps/ruby-client/issues/217
38
+
39
+ [5.0.28]: https://github.com/finapps/ruby-client/compare/5.0.27...5.0.28
40
+
41
+ ## [5.0.27] - 2020-02-11
42
+
43
+ ### Changed
44
+ * Update finapps-core gem ([#215][i215])
45
+
46
+ [i215]: https://github.com/finapps/ruby-client/issues/215
47
+
48
+ [5.0.27]: https://github.com/finapps/ruby-client/compare/5.0.26...5.0.27
49
+
1
50
  ## [5.0.23] - 2020-01-16
2
51
 
3
52
  ### Changed
@@ -20,7 +20,7 @@ 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', '~> 5.0', '>= 5.0.6'
23
+ spec.add_runtime_dependency 'finapps_core', '~> 5.0', '>= 5.0.7'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
26
26
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
@@ -19,7 +19,6 @@ require 'finapps/rest/products'
19
19
  require 'finapps/rest/order_assignments'
20
20
  require 'finapps/rest/client'
21
21
  require 'finapps/rest/order_refreshes'
22
- require 'finapps/rest/statements'
23
22
  require 'finapps/rest/tenant_settings'
24
23
  require 'finapps/rest/tenant_app_settings'
25
24
  require 'finapps/rest/portfolios'
@@ -30,6 +29,10 @@ require 'finapps/rest/portfolios_alerts'
30
29
  require 'finapps/rest/portfolios_consumers'
31
30
  require 'finapps/rest/consumers_portfolios'
32
31
  require 'finapps/rest/portfolio_reports'
32
+ require 'finapps/rest/documents_orders'
33
+ require 'finapps/rest/esign_templates'
34
+ require 'finapps/rest/signed_documents_downloads'
35
+ require 'finapps/rest/documents_orders_notifications'
33
36
 
34
37
  require 'finapps/rest/plaid/plaid_resources'
35
38
  require 'finapps/rest/plaid/plaid_webhooks'
@@ -40,6 +43,8 @@ require 'finapps/rest/plaid/plaid_institution_logos'
40
43
 
41
44
  require 'finapps/rest/verix/verix_metadata'
42
45
  require 'finapps/rest/verix/verix_records'
46
+ require 'finapps/rest/verix/verix_pdf_documents'
47
+ require 'finapps/rest/verix/verix_documents'
43
48
 
44
49
  require 'finapps/utils/query_builder'
45
50
  require 'finapps/version' unless defined?(FinApps::VERSION)
@@ -9,7 +9,11 @@ module FinApps
9
9
  RESOURCES = %i[
10
10
  alert_definitions
11
11
  alert_occurrences
12
+ consumers
12
13
  consumers_portfolios
14
+ documents_orders
15
+ documents_orders_notifications
16
+ esign_templates
13
17
  orders
14
18
  order_assignments
15
19
  order_notifications
@@ -20,24 +24,26 @@ module FinApps
20
24
  operators
21
25
  operators_password_resets
22
26
  password_resets
23
- products
27
+ plaid_webhooks
28
+ plaid_consumer_institutions
29
+ plaid_accounts
30
+ plaid_account_permissions
31
+ plaid_institution_logos
24
32
  portfolios
25
33
  portfolios_alerts
26
34
  portfolios_available_consumers
27
35
  portfolios_consumers
28
36
  portfolio_reports
37
+ products
29
38
  sessions
30
- consumers
39
+ signed_documents_downloads
31
40
  tenant_settings
32
41
  tenant_app_settings
33
- version
34
- plaid_webhooks
35
- plaid_consumer_institutions
36
- plaid_accounts
37
- plaid_account_permissions
38
- plaid_institution_logos
39
42
  verix_metadata
40
43
  verix_records
44
+ verix_pdf_documents
45
+ verix_documents
46
+ version
41
47
  ].freeze
42
48
 
43
49
  # @param [String] tenant_token
@@ -54,14 +54,25 @@ module FinApps
54
54
  end
55
55
 
56
56
  def search_query(term)
57
+ query = with_space_search(term).concat(name_search(term))
57
58
  {
58
- "$or": [
59
- { "email": term },
60
- { "first_name": term },
61
- { "last_name": term }
62
- ]
59
+ "$or": query
63
60
  }
64
61
  end
62
+
63
+ def with_space_search(term)
64
+ [
65
+ { "email": term },
66
+ { "first_name": term },
67
+ { "last_name": term }
68
+ ]
69
+ end
70
+
71
+ def name_search(term)
72
+ search_arr = []
73
+ term.split.each { |t| search_arr.append({ "first_name": t }, "last_name": t) } if term.match(/\s/)
74
+ search_arr
75
+ end
65
76
  end
66
77
  end
67
78
  end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../utils/query_builder'
4
+
5
+ module FinApps
6
+ module REST
7
+ class DocumentsOrders < FinAppsCore::REST::Resources
8
+ include FinApps::Utils::QueryBuilder
9
+
10
+ def list(params = nil)
11
+ path = 'documents/orders'
12
+ return super(path) if params.nil?
13
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
14
+
15
+ super build_query_path(path, params)
16
+ end
17
+
18
+ def show(id)
19
+ not_blank(id, :order_id)
20
+ super(id, "documents/orders/#{id}")
21
+ end
22
+
23
+ def create(params)
24
+ not_blank(params, :params)
25
+ super(params, 'documents/orders')
26
+ end
27
+
28
+ def update(id, params = nil)
29
+ not_blank(id, :order_id)
30
+ not_blank(params, :params)
31
+ super(params, "documents/orders/#{id}")
32
+ end
33
+
34
+ def destroy(id)
35
+ not_blank(id, :order_id)
36
+ super(id, "documents/orders/#{id}")
37
+ end
38
+
39
+ def show_signing_url(order_id, signature_id)
40
+ not_blank(order_id, :order_id)
41
+ not_blank(signature_id, :signature_id)
42
+ path = "documents/orders/#{order_id}/sign_url/#{signature_id}"
43
+ send_request path, :get
44
+ end
45
+
46
+ private
47
+
48
+ def build_filter(params)
49
+ search_query(params[:searchTerm]).merge(consumer_query(params[:consumer])).merge(tag_query(params[:tag]))
50
+ end
51
+
52
+ def search_query(term)
53
+ if term
54
+ query = with_space_search(term).concat(name_search(term))
55
+ {
56
+ "$or": query
57
+ }
58
+ else
59
+ {}
60
+ end
61
+ end
62
+
63
+ def name_search(term)
64
+ search_arr = []
65
+ if term.match(/\s/)
66
+ term.split.each { |t| search_arr.append({ "applicant.first_name": t }, "applicant.last_name": t) }
67
+ end
68
+ search_arr
69
+ end
70
+
71
+ def with_space_search(term)
72
+ [
73
+ { "applicant.email": term },
74
+ { "applicant.first_name": term },
75
+ { "applicant.last_name": term },
76
+ {
77
+ "reference_no": {
78
+ "$regex": "^#{term}", "$options": 'i'
79
+ }
80
+ }
81
+ ]
82
+ end
83
+
84
+ def tag_query(tag)
85
+ if tag
86
+ { "tag": tag.empty? ? nil : tag }
87
+ else
88
+ {}
89
+ end
90
+ end
91
+
92
+ def consumer_query(consumer)
93
+ if consumer
94
+ { "consumer_id": consumer.empty? ? nil : consumer }
95
+ else
96
+ {}
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class DocumentsOrdersNotifications < FinAppsCore::REST::Resources
6
+ def create(id)
7
+ not_blank(id, :id)
8
+
9
+ path = "documents/orders/#{ERB::Util.url_encode(id)}/notify"
10
+ super nil, path
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class EsignTemplates < FinAppsCore::REST::Resources
6
+ def list
7
+ super('esign_templates')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class SignedDocumentsDownloads < FinAppsCore::REST::Resources
6
+ def show(consumer_id, signature_request_id)
7
+ not_blank(consumer_id, :consumer_id)
8
+ not_blank(signature_request_id, :signature_request_id)
9
+ path =
10
+ "consumers/#{ERB::Util.url_encode(consumer_id)}/documents/#{ERB::Util.url_encode(signature_request_id)}"
11
+ super(nil, path)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class VerixDocuments < FinAppsCore::REST::Resources
6
+ def list(record_id)
7
+ not_blank(record_id, :record_id)
8
+ path = "v/record/#{ERB::Util.url_encode(record_id)}/document"
9
+ super path
10
+ end
11
+
12
+ def show(record_id, document_id)
13
+ not_blank(record_id, :record_id)
14
+ not_blank(document_id, :document_id)
15
+ path =
16
+ "v/record/#{ERB::Util.url_encode(record_id)}/document/#{ERB::Util.url_encode(document_id)}"
17
+ super(nil, path)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class VerixPdfDocuments < FinAppsCore::REST::Resources # :nodoc:
6
+ def show(record_id, provider_id)
7
+ not_blank(record_id, :record_id)
8
+ not_blank(provider_id, :provider_id)
9
+ path =
10
+ "v/record/#{ERB::Util.url_encode(record_id)}/file/#{ERB::Util.url_encode(provider_id)}"
11
+ super(nil, path)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '5.0.26'
4
+ VERSION = '5.0.31'
5
5
  end
@@ -110,6 +110,25 @@ RSpec.describe FinApps::REST::Consumers,
110
110
  '&sort=date_created'
111
111
  expect(WebMock).to have_requested(:get, url)
112
112
  end
113
+
114
+ context 'when search term contains a space' do
115
+ let(:params) do
116
+ {
117
+ page: 2,
118
+ sort: 'date_created',
119
+ requested: 25,
120
+ searchTerm: 'Two terms'
121
+ }
122
+ end
123
+ it 'treats space as start of a new query for first and last name' do
124
+ list
125
+ url = "#{versioned_api_path}/consumers?filter=%7B%22$or%22:%5B%7B%22email%22:%22Two%20terms%22%7D,"\
126
+ '%7B%22first_name%22:%22Two%20terms%22%7D,%7B%22last_name%22:%22Two%20terms%22%7D,%7B%22first_name%22:'\
127
+ '%22Two%22%7D,%7B%22last_name%22:%22Two%22%7D,%7B%22first_name%22:%22terms%22%7D,%7B%22last_name%22:'\
128
+ '%22terms%22%7D%5D%7D&page=2&requested=25&sort=date_created'
129
+ expect(WebMock).to have_requested(:get, url)
130
+ end
131
+ end
113
132
  end
114
133
  end
115
134
 
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+
5
+ RSpec.describe FinApps::REST::DocumentsOrdersNotifications do
6
+ include SpecHelpers::Client
7
+
8
+ describe '#create' do
9
+ subject(:notifications) { FinApps::REST::DocumentsOrdersNotifications.new(client) }
10
+
11
+ context 'when missing id' do
12
+ let(:create) { subject.create(nil) }
13
+ it('returns missing argument error') do
14
+ expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
15
+ end
16
+ end
17
+
18
+ context 'when invalid id is provided' do
19
+ let(:create) { subject.create(:invalid_id) }
20
+ let(:results) { create[RESULTS] }
21
+ let(:error_messages) { create[ERROR_MESSAGES] }
22
+
23
+ it { expect { create }.not_to raise_error }
24
+ it('results is nil') { expect(results).to be_nil }
25
+ it('error messages array is populated') do
26
+ expect(error_messages.first.downcase).to eq('order id is invalid')
27
+ end
28
+ end
29
+
30
+ context 'for valid id' do
31
+ let(:create) { subject.create(:valid_id) }
32
+ let(:results) { create[RESULTS] }
33
+ let(:error_messages) { create[ERROR_MESSAGES] }
34
+
35
+ it { expect { create }.not_to raise_error }
36
+ it('results is nil') { expect(results).to be_nil }
37
+ it('error_messages array is empty') { expect(error_messages).to eq([]) }
38
+ end
39
+ end
40
+ end