finapps 5.0.27 → 5.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -1
  3. data/RELEASES.md +49 -0
  4. data/lib/finapps.rb +6 -1
  5. data/lib/finapps/rest/client.rb +14 -8
  6. data/lib/finapps/rest/consumers.rb +21 -5
  7. data/lib/finapps/rest/documents_orders.rb +104 -0
  8. data/lib/finapps/rest/documents_orders_notifications.rb +14 -0
  9. data/lib/finapps/rest/esign_templates.rb +11 -0
  10. data/lib/finapps/rest/signed_documents_downloads.rb +15 -0
  11. data/lib/finapps/rest/verix/verix_documents.rb +21 -0
  12. data/lib/finapps/rest/verix/verix_pdf_documents.rb +15 -0
  13. data/lib/finapps/version.rb +1 -1
  14. data/spec/rest/consumers_spec.rb +19 -0
  15. data/spec/rest/documents_orders_notifications_spec.rb +40 -0
  16. data/spec/rest/documents_orders_spec.rb +287 -0
  17. data/spec/rest/esign_templates_spec.rb +20 -0
  18. data/spec/rest/signed_documents_downloads_spec.rb +35 -0
  19. data/spec/rest/verix/verix_documents_spec.rb +52 -0
  20. data/spec/rest/verix/verix_pdf_documents_spec.rb +35 -0
  21. data/spec/rest/verix/verix_records_spec.rb +3 -14
  22. data/spec/support/fake_api.rb +74 -8
  23. data/spec/support/fixtures/documents_order.json +75 -0
  24. data/spec/support/fixtures/documents_orders.json +32 -0
  25. data/spec/support/fixtures/esign_templates.json +6 -0
  26. data/spec/support/fixtures/invalid_order_id.json +5 -0
  27. data/spec/support/fixtures/invalid_signature_id.json +5 -0
  28. data/spec/support/fixtures/sign_url.json +4 -0
  29. data/spec/support/fixtures/signed_document.pdf +0 -0
  30. data/spec/support/fixtures/verix/document/document.pdf +0 -0
  31. data/spec/support/fixtures/verix/document/list.json +36 -0
  32. data/spec/support/fixtures/verix/document/show.json +35 -0
  33. data/spec/support/fixtures/verix/record/create.json +25 -17
  34. data/spec/support/fixtures/verix/record/list.json +121 -45
  35. metadata +78 -54
  36. data/lib/finapps/rest/statements.rb +0 -16
  37. data/spec/rest/statements_spec.rb +0 -42
  38. 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: 4b8b7de9d5fc2e4ae26d24d98d1a08c6b55bf195814f86b98b9f570fde651053
4
- data.tar.gz: 1ae33a3b696c405a8a6f1f1ee03f7cbdd1f96d5b3979ab8d51b01226da722f23
3
+ metadata.gz: 05c3cbe0d36260925c0a4ca37018f711a959dc0607b4d379b9adb048ef76a0c9
4
+ data.tar.gz: 1a519b374d9345074573372872fcc731f7b55111adc47be50ce549f7db5b913d
5
5
  SHA512:
6
- metadata.gz: dcd6e21e5d4341304a6b1ab6482d18dbaf6cd66f2a3d4a642885a0f0aafb0549a59139fcf6bbbaf751b1e74cd19b290bd7c9b63ff0a44f51710c5e2ed731370f
7
- data.tar.gz: 8d2f9526699c782b00238335043df2eb599125f1a5858aca887df2ae34980d5150025ec61a574d3b41d88e030ab424cbd883665206c894d88eaa60a799918c5b
6
+ metadata.gz: 79b1294efebc55a4eb589511df152268a6afbd135b9d06c0d159d8beecdb3d5c968cd5f1978dfac92934d8f1e8464004f21f7327631f236ee53b084ac1ac1858
7
+ data.tar.gz: b333304eae828c57e73751fa1a09f5d3da6582499eab129ff4421ac8726c204cef74a6a5d90591f41e5c9a82d9dfeb5e4422cbf738b685fcdc83cf70a38a2945
@@ -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.32] - 2020-06-11
2
+
3
+ ### Fixed
4
+ * Argument error resulting from space search ([#225][i225])
5
+
6
+ [i225]: https://github.com/finapps/ruby-client/issues/225
7
+
8
+ [5.0.32]: https://github.com/finapps/ruby-client/compare/5.0.31...5.0.32
9
+
10
+ ## [5.0.31] - 2020-06-11
11
+
12
+ ### Changed
13
+ * Consumer and Doc-order search to query names on spaces ([#224][i224])
14
+
15
+ [i224]: https://github.com/finapps/ruby-client/issues/224
16
+
17
+ [5.0.31]: https://github.com/finapps/ruby-client/compare/5.0.30...5.0.31
18
+
19
+ ## [5.0.30] - 2020-05-28
20
+
21
+ ### Added
22
+ * New esign endpoints ([#222][i222])
23
+
24
+ ### Changed
25
+ * Search query for documents orders ([#221][i221])
26
+
27
+ [i221]: https://github.com/finapps/ruby-client/issues/221
28
+ [i222]: https://github.com/finapps/ruby-client/issues/222
29
+
30
+ [5.0.30]: https://github.com/finapps/ruby-client/compare/5.0.29...5.0.30
31
+
32
+ ## [5.0.29] - 2020-05-08
33
+
34
+ ### Added
35
+ * Document-orders endpoints ([#219][i219])
36
+
37
+ [i219]: https://github.com/finapps/ruby-client/issues/219
38
+
39
+ [5.0.29]: https://github.com/finapps/ruby-client/compare/5.0.28...5.0.29
40
+
41
+ ## [5.0.28] - 2020-02-19
42
+
43
+ ### Added
44
+ * Verix document endpoints ([#217][i217])
45
+
46
+ [i217]: https://github.com/finapps/ruby-client/issues/217
47
+
48
+ [5.0.28]: https://github.com/finapps/ruby-client/compare/5.0.27...5.0.28
49
+
1
50
  ## [5.0.27] - 2020-02-11
2
51
 
3
52
  ### Changed
@@ -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,30 @@ 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
+ if term.match(/\s/)
74
+ term.split.each do |t|
75
+ search_arr.append("first_name": t)
76
+ search_arr.append("last_name": t)
77
+ end
78
+ end
79
+ search_arr
80
+ end
65
81
  end
66
82
  end
67
83
  end
@@ -0,0 +1,104 @@
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 do |t|
67
+ search_arr.append("applicant.first_name": t)
68
+ search_arr.append("applicant.last_name": t)
69
+ end
70
+ end
71
+ search_arr
72
+ end
73
+
74
+ def with_space_search(term)
75
+ [
76
+ { "applicant.email": term },
77
+ { "applicant.first_name": term },
78
+ { "applicant.last_name": term },
79
+ {
80
+ "reference_no": {
81
+ "$regex": "^#{term}", "$options": 'i'
82
+ }
83
+ }
84
+ ]
85
+ end
86
+
87
+ def tag_query(tag)
88
+ if tag
89
+ { "tag": tag.empty? ? nil : tag }
90
+ else
91
+ {}
92
+ end
93
+ end
94
+
95
+ def consumer_query(consumer)
96
+ if consumer
97
+ { "consumer_id": consumer.empty? ? nil : consumer }
98
+ else
99
+ {}
100
+ end
101
+ end
102
+ end
103
+ end
104
+ 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.27'
4
+ VERSION = '5.0.32'
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