finapps 5.0.34 → 5.0.35

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: 6958de8a43a73230709100da8c2ddc2c2eef53d2ae74f546c37dbab8d6790b6a
4
- data.tar.gz: 4af6e7780029881e968ef5551d3b24c965471a65080b9b45fda47ceb0e57d424
3
+ metadata.gz: 4756aafb56941b9eaf0609a1aa07d9eae9b3485e70a10bf1ab7590cc973654d1
4
+ data.tar.gz: 0e55b4ed791fc263027a21b6193ca025778e983fb0742006111b9fc1c5d88e4d
5
5
  SHA512:
6
- metadata.gz: 06c98f429646d29272d6a5b4d7f3f9d9bb38ca20e9e5d4fbce6db76d86200eab81acb64476170f05c705eee82c4cfa44f83f4f3b783777ccb13e962b458be7c3
7
- data.tar.gz: fdaa7e5508c7d0f7929f15d8a68ba4137180ce56b1e4be46dcd83d7230d1f2d796d40ef1949d082309e55d7e9a78433ae927f9ec13785ec49dc80d345e8cfb6a
6
+ metadata.gz: 90031e4f43d5a3fda8f4f3f2df53e7ecb8a5e27ab53830f79aaf80ab981b293b8890ad3e2bf8a31ebc210dcaf37f29fbcc1442fb139ee463b465243223381393
7
+ data.tar.gz: 56d79d89f1a40e4ee1fff5b58ad8e49f762375c7ea6a4911a3e149004272eba89fe3e6348653a49f75a2bf1cd6a1f41ef4e8c20af6857c0e75af76c818b88467
@@ -1,12 +1,6 @@
1
1
  name: Main
2
2
 
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
3
+ on: [push, pull_request]
10
4
 
11
5
  jobs:
12
6
  ci:
@@ -6,115 +6,24 @@
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 12
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
12
- # URISchemes: http, https
13
- Layout/LineLength:
14
- Max: 119
15
-
16
- # Offense count: 1
17
- # Configuration parameters: IgnoredMethods.
18
- Metrics/AbcSize:
19
- Max: 16
20
-
21
9
  # Offense count: 1
22
10
  # Configuration parameters: CountComments, ExcludedMethods.
23
11
  # ExcludedMethods: refine
12
+ # finapps.gemspec - leaving as is intentionally
24
13
  Metrics/BlockLength:
25
14
  Max: 28
26
15
 
27
16
  # Offense count: 1
28
17
  # Configuration parameters: CountComments.
18
+ # fake_api.rb - leaving as is intentionally
29
19
  Metrics/ClassLength:
30
20
  Max: 431
31
21
 
32
- # Offense count: 3
33
- # Configuration parameters: CountComments, ExcludedMethods.
34
- Metrics/MethodLength:
35
- Max: 16
36
-
37
- # Offense count: 29
38
- # Configuration parameters: Prefixes.
39
- # Prefixes: when, with, without
40
- RSpec/ContextWording:
41
- Exclude:
42
- - 'spec/rest/client_spec.rb'
43
- - 'spec/rest/consumers_spec.rb'
44
- - 'spec/rest/documents_orders_notifications_spec.rb'
45
- - 'spec/rest/operators_password_resets_spec.rb'
46
- - 'spec/rest/operators_spec.rb'
47
- - 'spec/rest/order_notifications_spec.rb'
48
- - 'spec/rest/order_tokens_spec.rb'
49
- - 'spec/rest/orders_spec.rb'
50
- - 'spec/rest/portfolios_consumers_spec.rb'
51
- - 'spec/rest/sessions_spec.rb'
52
-
53
- # Offense count: 6
54
- RSpec/DescribeMethod:
55
- Exclude:
56
- - 'spec/rest/consumers_spec.rb'
57
- - 'spec/rest/operators_password_resets_spec.rb'
58
- - 'spec/rest/operators_spec.rb'
59
- - 'spec/rest/order_tokens_spec.rb'
60
- - 'spec/rest/products_spec.rb'
61
- - 'spec/rest/sessions_spec.rb'
62
-
63
22
  # Offense count: 5
64
23
  # Configuration parameters: Max.
24
+ # Leaving as is intentionally - url being tested takes up as many lines
65
25
  RSpec/ExampleLength:
66
26
  Exclude:
67
27
  - 'spec/rest/consumers_spec.rb'
68
28
  - 'spec/rest/documents_orders_spec.rb'
69
29
  - 'spec/rest/orders_spec.rb'
70
-
71
- # Offense count: 1
72
- # Configuration parameters: .
73
- # SupportedStyles: have_received, receive
74
- RSpec/MessageSpies:
75
- EnforcedStyle: receive
76
-
77
- # Offense count: 13
78
- RSpec/MultipleExpectations:
79
- Max: 3
80
-
81
- # Offense count: 114
82
- # Configuration parameters: IgnoreSharedExamples.
83
- RSpec/NamedSubject:
84
- Exclude:
85
- - 'spec/rest/client_spec.rb'
86
- - 'spec/rest/consumers_spec.rb'
87
- - 'spec/rest/documents_orders_spec.rb'
88
- - 'spec/rest/order_reports_spec.rb'
89
- - 'spec/rest/order_statuses_spec.rb'
90
- - 'spec/rest/order_tokens_spec.rb'
91
- - 'spec/rest/orders_spec.rb'
92
- - 'spec/rest/password_resets_spec.rb'
93
- - 'spec/rest/plaid/plaid_consumer_institutions_spec.rb'
94
- - 'spec/rest/sessions_spec.rb'
95
- - 'spec/rest/signed_documents_downloads_spec.rb'
96
- - 'spec/rest/verix/verix_documents_spec.rb'
97
- - 'spec/rest/verix/verix_pdf_documents_spec.rb'
98
- - 'spec/rest/version_spec.rb'
99
-
100
- # Offense count: 6
101
- RSpec/RepeatedExample:
102
- Exclude:
103
- - 'spec/rest/signed_documents_downloads_spec.rb'
104
- - 'spec/rest/verix/verix_documents_spec.rb'
105
- - 'spec/rest/verix/verix_pdf_documents_spec.rb'
106
-
107
- # Offense count: 2
108
- RSpec/RepeatedExampleGroupBody:
109
- Exclude:
110
- - 'spec/rest/client_spec.rb'
111
-
112
- # Offense count: 4
113
- RSpec/RepeatedExampleGroupDescription:
114
- Exclude:
115
- - 'spec/rest/client_spec.rb'
116
-
117
- # Offense count: 1
118
- RSpec/SubjectStub:
119
- Exclude:
120
- - 'spec/rest/orders_spec.rb'
data/README.md CHANGED
@@ -3,6 +3,7 @@ FinApps Ruby-Client
3
3
  ===================
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/finapps.svg)](https://rubygems.org/gems/finapps)
6
+ ![Main](https://github.com/finapps/ruby-client/workflows/Main/badge.svg)
6
7
  [![Build Status](https://travis-ci.org/finapps/ruby-client.svg?branch=master)](https://travis-ci.org/finapps/ruby-client)
7
8
  [![Code Climate](https://codeclimate.com/github/finapps/ruby-client/badges/gpa.svg)](https://codeclimate.com/github/finapps/ruby-client)
8
9
  [![Test Coverage](https://codeclimate.com/github/finapps/ruby-client/badges/coverage.svg)](https://codeclimate.com/github/finapps/ruby-client/coverage)
@@ -1,3 +1,14 @@
1
+ ## [5.0.35] - 2020-07-09
2
+
3
+ ### Changed
4
+ * Change code to match rubocop suggestions ([#232][i232])
5
+ * Add support for first name order search with space ([#404][i404])
6
+
7
+ [i232]: https://github.com/finapps/ruby-client/issues/232
8
+ [i404]: https://github.com/finapps/tenant-dashboard-react/issues/404
9
+
10
+ [5.0.35]: https://github.com/finapps/ruby-client/compare/5.0.34...5.0.35
11
+
1
12
  ## [5.0.32] - 2020-06-11
2
13
 
3
14
  ### Fixed
@@ -60,17 +60,18 @@ module FinApps
60
60
  if RESOURCES.include? symbol
61
61
  class_name = camelize(symbol.to_s)
62
62
  variable = "@#{class_name.downcase}"
63
- unless instance_variable_defined? variable
64
- klass =
65
- Object.const_get('FinApps').const_get('REST').const_get class_name
66
- instance_variable_set(variable, klass.new(self))
67
- end
63
+ set_variable(class_name, variable) unless instance_variable_defined? variable
68
64
  instance_variable_get(variable)
69
65
  else
70
66
  super
71
67
  end
72
68
  end
73
69
 
70
+ def set_variable(class_name, variable)
71
+ klass = Object.const_get('FinApps').const_get('REST').const_get class_name
72
+ instance_variable_set(variable, klass.new(self))
73
+ end
74
+
74
75
  def respond_to_missing?(method_sym, include_private = false)
75
76
  RESOURCES.include?(method_sym) ? true : super
76
77
  end
@@ -63,22 +63,33 @@ module FinApps
63
63
  end
64
64
 
65
65
  def search_query(term)
66
- if term
67
- {
68
- "$or": [
69
- {"public_id": {"$regex": "^#{term}", "$options": 'i'}},
70
- {"applicant.last_name": term},
71
- {"assignment.last_name": term},
72
- {
73
- "requestor.reference_no": {
74
- "$regex": "^#{term}", "$options": 'i'
75
- }
76
- }
77
- ]
78
- }
79
- else
80
- {}
66
+ return {} unless term
67
+
68
+ query = search_query_object(term).concat(consumer_name_query(term))
69
+ {"$or": query}
70
+ end
71
+
72
+ def consumer_name_query(term)
73
+ search_arr = []
74
+ if /\s/.match?(term)
75
+ term.split.each do |t|
76
+ search_arr.append("applicant.first_name": t)
77
+ search_arr.append("applicant.last_name": t)
78
+ end
81
79
  end
80
+ search_arr
81
+ end
82
+
83
+ def search_query_object(term)
84
+ [{"public_id": {"$regex": "^#{term}", "$options": 'i'}},
85
+ {"assignment.last_name": term},
86
+ {"applicant.first_name": term},
87
+ {"applicant.last_name": term},
88
+ {
89
+ "requestor.reference_no": {
90
+ "$regex": "^#{term}", "$options": 'i'
91
+ }
92
+ }]
82
93
  end
83
94
 
84
95
  def status_query(status)
@@ -15,14 +15,7 @@ module FinApps
15
15
  begin
16
16
  super params, path
17
17
  rescue FinAppsCore::ApiUnauthenticatedError
18
- (
19
- [
20
- nil,
21
- [
22
- "Invalid #{path == CONSUMER_LOGIN ? 'Consumer' : 'Operator'} Identifier or Credentials"
23
- ]
24
- ]
25
- )
18
+ login_error(path)
26
19
  end
27
20
  end
28
21
 
@@ -36,6 +29,15 @@ module FinApps
36
29
  params.key?(:email) && params[:email] && params.key?(:password) &&
37
30
  params[:password]
38
31
  end
32
+
33
+ def login_error(path)
34
+ [
35
+ nil,
36
+ [
37
+ "Invalid #{path == CONSUMER_LOGIN ? 'Consumer' : 'Operator'} Identifier or Credentials"
38
+ ]
39
+ ]
40
+ end
39
41
  end
40
42
  end
41
43
  end
@@ -5,15 +5,24 @@ module FinApps
5
5
  module QueryBuilder
6
6
  def build_query_path(root_url, params)
7
7
  filter_obj = build_filter(params)
8
- page = "page=#{params[:page].to_i}" if params[:page]
9
- requested = "requested=#{params[:requested].to_i}" if params[:requested]
10
- sort = "sort=#{ERB::Util.url_encode(params[:sort])}" if params[:sort]
11
8
  filter = "filter=#{ERB::Util.url_encode(filter_obj.to_json)}" unless filter_obj.empty?
12
- query_join(root_url, [page, requested, sort, filter])
9
+ query_join(root_url, [page(params), requested(params), sort(params), filter])
13
10
  end
14
11
 
15
12
  private
16
13
 
14
+ def page(params)
15
+ "page=#{params[:page].to_i}" if params[:page]
16
+ end
17
+
18
+ def requested(params)
19
+ "requested=#{params[:requested].to_i}" if params[:requested]
20
+ end
21
+
22
+ def sort(params)
23
+ "sort=#{ERB::Util.url_encode(params[:sort])}" if params[:sort]
24
+ end
25
+
17
26
  def query_join(root_url, params_array)
18
27
  query_string = params_array.compact.join('&')
19
28
  [root_url, query_string].reject(&:empty?).join('?')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '5.0.34'
4
+ VERSION = '5.0.35'
5
5
  end
@@ -68,12 +68,8 @@ RSpec.describe FinApps::REST::AlertDefinitions do
68
68
 
69
69
  it { expect { show }.not_to raise_error }
70
70
  it('returns an array') { expect(show).to be_a(Array) }
71
-
72
- it('performs a get and returns the response') do
73
- expect(results).to have_key(:_id)
74
- expect(results).to have_key(:rule_name)
75
- end
76
-
71
+ it { expect(results).to have_key(:_id) }
72
+ it { expect(results).to have_key(:rule_name) }
77
73
  it('returns no error messages') { expect(errors).to be_empty }
78
74
  end
79
75
 
@@ -9,22 +9,22 @@ RSpec.describe FinApps::REST::Client do
9
9
  end
10
10
  end
11
11
 
12
- context 'an instance of Client' do
13
- subject { described_class.new(:company_token) }
12
+ context 'with an instance of Client' do
13
+ subject(:client) { described_class.new(:company_token) }
14
14
 
15
15
  FinApps::REST::Client::RESOURCES.each do |method|
16
- it("responds to #{method}") { expect(subject).to respond_to(method) }
16
+ it("responds to #{method}") { expect(client).to respond_to(method) }
17
17
 
18
18
  it "memoizes the result of #{method}" do
19
- first = subject.send(method)
20
- second = subject.send(method)
19
+ first = client.send(method)
20
+ second = client.send(method)
21
21
  expect(first.object_id).to eq(second.object_id)
22
22
  end
23
23
  end
24
24
 
25
25
  describe '#alert_definitions' do
26
26
  it do
27
- expect(subject.alert_definitions).to be_an_instance_of(
27
+ expect(client.alert_definitions).to be_an_instance_of(
28
28
  FinApps::REST::AlertDefinitions
29
29
  )
30
30
  end
@@ -32,7 +32,7 @@ RSpec.describe FinApps::REST::Client do
32
32
 
33
33
  describe '#alert_occurrences' do
34
34
  it do
35
- expect(subject.alert_occurrences).to be_an_instance_of(
35
+ expect(client.alert_occurrences).to be_an_instance_of(
36
36
  FinApps::REST::AlertOccurrences
37
37
  )
38
38
  end
@@ -40,41 +40,41 @@ RSpec.describe FinApps::REST::Client do
40
40
 
41
41
  describe '#version' do
42
42
  it do
43
- expect(subject.version).to be_an_instance_of(FinApps::REST::Version)
43
+ expect(client.version).to be_an_instance_of(FinApps::REST::Version)
44
44
  end
45
45
  end
46
46
 
47
47
  describe '#consumers' do
48
48
  it do
49
- expect(subject.consumers).to be_an_instance_of(FinApps::REST::Consumers)
49
+ expect(client.consumers).to be_an_instance_of(FinApps::REST::Consumers)
50
50
  end
51
51
  end
52
52
 
53
53
  describe '#plaid_webhooks' do
54
54
  it do
55
55
  expect(
56
- subject.plaid_webhooks
56
+ client.plaid_webhooks
57
57
  ).to be_an_instance_of FinApps::REST::PlaidWebhooks
58
58
  end
59
59
  end
60
60
 
61
61
  describe '#sessions' do
62
62
  it do
63
- expect(subject.sessions).to be_an_instance_of(FinApps::REST::Sessions)
63
+ expect(client.sessions).to be_an_instance_of(FinApps::REST::Sessions)
64
64
  end
65
65
  end
66
66
 
67
67
  describe '#order_assignments' do
68
68
  it do
69
- expect(subject.order_assignments).to be_an_instance_of(
69
+ expect(client.order_assignments).to be_an_instance_of(
70
70
  FinApps::REST::OrderAssignments
71
71
  )
72
72
  end
73
73
  end
74
74
 
75
- describe '#order_statuses' do
75
+ describe '#order_notifications' do
76
76
  it do
77
- expect(subject.order_notifications).to be_an_instance_of(
77
+ expect(client.order_notifications).to be_an_instance_of(
78
78
  FinApps::REST::OrderNotifications
79
79
  )
80
80
  end
@@ -82,7 +82,7 @@ RSpec.describe FinApps::REST::Client do
82
82
 
83
83
  describe '#order_statuses' do
84
84
  it do
85
- expect(subject.order_statuses).to be_an_instance_of(
85
+ expect(client.order_statuses).to be_an_instance_of(
86
86
  FinApps::REST::OrderStatuses
87
87
  )
88
88
  end
@@ -90,7 +90,7 @@ RSpec.describe FinApps::REST::Client do
90
90
 
91
91
  describe '#order_refreshes' do
92
92
  it do
93
- expect(subject.order_refreshes).to be_an_instance_of(
93
+ expect(client.order_refreshes).to be_an_instance_of(
94
94
  FinApps::REST::OrderRefreshes
95
95
  )
96
96
  end
@@ -98,7 +98,7 @@ RSpec.describe FinApps::REST::Client do
98
98
 
99
99
  describe '#order_reports' do
100
100
  it do
101
- expect(subject.order_reports).to be_an_instance_of(
101
+ expect(client.order_reports).to be_an_instance_of(
102
102
  FinApps::REST::OrderReports
103
103
  )
104
104
  end
@@ -106,19 +106,19 @@ RSpec.describe FinApps::REST::Client do
106
106
 
107
107
  describe '#order_tokens' do
108
108
  it do
109
- expect(subject.order_tokens).to be_an_instance_of(
109
+ expect(client.order_tokens).to be_an_instance_of(
110
110
  FinApps::REST::OrderTokens
111
111
  )
112
112
  end
113
113
  end
114
114
 
115
115
  describe '#orders' do
116
- it { expect(subject.orders).to be_an_instance_of(FinApps::REST::Orders) }
116
+ it { expect(client.orders).to be_an_instance_of(FinApps::REST::Orders) }
117
117
  end
118
118
 
119
119
  describe '#password_resets' do
120
120
  it do
121
- expect(subject.password_resets).to be_an_instance_of(
121
+ expect(client.password_resets).to be_an_instance_of(
122
122
  FinApps::REST::PasswordResets
123
123
  )
124
124
  end
@@ -126,7 +126,7 @@ RSpec.describe FinApps::REST::Client do
126
126
 
127
127
  describe '#operators_password_resets' do
128
128
  it do
129
- expect(subject.operators_password_resets).to be_an_instance_of(
129
+ expect(client.operators_password_resets).to be_an_instance_of(
130
130
  FinApps::REST::OperatorsPasswordResets
131
131
  )
132
132
  end
@@ -134,19 +134,19 @@ RSpec.describe FinApps::REST::Client do
134
134
 
135
135
  describe '#operators' do
136
136
  it do
137
- expect(subject.operators).to be_an_instance_of(FinApps::REST::Operators)
137
+ expect(client.operators).to be_an_instance_of(FinApps::REST::Operators)
138
138
  end
139
139
  end
140
140
 
141
141
  describe '#products' do
142
142
  it do
143
- expect(subject.products).to be_an_instance_of(FinApps::REST::Products)
143
+ expect(client.products).to be_an_instance_of(FinApps::REST::Products)
144
144
  end
145
145
  end
146
146
 
147
147
  describe '#portfolios' do
148
148
  it do
149
- expect(subject.portfolios).to be_an_instance_of(
149
+ expect(client.portfolios).to be_an_instance_of(
150
150
  FinApps::REST::Portfolios
151
151
  )
152
152
  end
@@ -154,7 +154,7 @@ RSpec.describe FinApps::REST::Client do
154
154
 
155
155
  describe '#portfolios_alerts' do
156
156
  it do
157
- expect(subject.portfolios_alerts).to be_an_instance_of(
157
+ expect(client.portfolios_alerts).to be_an_instance_of(
158
158
  FinApps::REST::PortfoliosAlerts
159
159
  )
160
160
  end
@@ -162,7 +162,7 @@ RSpec.describe FinApps::REST::Client do
162
162
 
163
163
  describe '#portfolios_available_consumers' do
164
164
  it do
165
- expect(subject.portfolios_available_consumers).to be_an_instance_of(
165
+ expect(client.portfolios_available_consumers).to be_an_instance_of(
166
166
  FinApps::REST::PortfoliosAvailableConsumers
167
167
  )
168
168
  end
@@ -170,7 +170,7 @@ RSpec.describe FinApps::REST::Client do
170
170
 
171
171
  describe '#portfolios_consumers' do
172
172
  it do
173
- expect(subject.portfolios_consumers).to be_an_instance_of(
173
+ expect(client.portfolios_consumers).to be_an_instance_of(
174
174
  FinApps::REST::PortfoliosConsumers
175
175
  )
176
176
  end
@@ -178,7 +178,7 @@ RSpec.describe FinApps::REST::Client do
178
178
 
179
179
  describe '#consumers_portfolios' do
180
180
  it do
181
- expect(subject.consumers_portfolios).to be_an_instance_of(
181
+ expect(client.consumers_portfolios).to be_an_instance_of(
182
182
  FinApps::REST::ConsumersPortfolios
183
183
  )
184
184
  end
@@ -186,7 +186,7 @@ RSpec.describe FinApps::REST::Client do
186
186
 
187
187
  describe '#portfolio_reports' do
188
188
  it do
189
- expect(subject.portfolio_reports).to be_an_instance_of(
189
+ expect(client.portfolio_reports).to be_an_instance_of(
190
190
  FinApps::REST::PortfolioReports
191
191
  )
192
192
  end
@@ -194,7 +194,7 @@ RSpec.describe FinApps::REST::Client do
194
194
 
195
195
  describe '#tenant_settings' do
196
196
  it do
197
- expect(subject.tenant_settings).to be_an_instance_of(
197
+ expect(client.tenant_settings).to be_an_instance_of(
198
198
  FinApps::REST::TenantSettings
199
199
  )
200
200
  end
@@ -202,23 +202,15 @@ RSpec.describe FinApps::REST::Client do
202
202
 
203
203
  describe '#tenant_app_settings' do
204
204
  it do
205
- expect(subject.tenant_app_settings).to be_an_instance_of(
205
+ expect(client.tenant_app_settings).to be_an_instance_of(
206
206
  FinApps::REST::TenantAppSettings
207
207
  )
208
208
  end
209
209
  end
210
210
 
211
- describe '#plaid_webhooks' do
212
- it do
213
- expect(subject.plaid_webhooks).to be_an_instance_of(
214
- FinApps::REST::PlaidWebhooks
215
- )
216
- end
217
- end
218
-
219
211
  describe '#plaid_institution_logos' do
220
212
  it do
221
- expect(subject.plaid_institution_logos).to be_an_instance_of(
213
+ expect(client.plaid_institution_logos).to be_an_instance_of(
222
214
  FinApps::REST::PlaidInstitutionLogos
223
215
  )
224
216
  end