finapps 4.0.3 → 4.0.4

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: ad0c3cd173051fb6054b894661f943949eb6a6259d3525cc5516908213559179
4
- data.tar.gz: 899a589e42dbdb6e3101c85a761ed1036d3ff1f3b0e0ce317e95b9f8bc9f4956
3
+ metadata.gz: 2dd7ec5866071e303e8dc2fdb02e9acc9cc26ba2d0a8588bc346bd53817f8318
4
+ data.tar.gz: e3f9567ee09fdb348430f781036ab8cc6abf988bb03584475927a81c89bd2551
5
5
  SHA512:
6
- metadata.gz: 8323282a9818b87ae24aaa149bfb4508d20286bd139945c7ae6a9f41d2410bf7a653f6a856aa50335f432309cf5b82d83666165a259155d46c6129329a945db9
7
- data.tar.gz: 945b146c4329e4d01c4684acb6c590ed5786d66445b918ba810923ceb9c85ddea51cc2dc33c6504d843e8cfb4c48e57812bfd3da7aba3ee700d8a9ca1d9f63a5
6
+ metadata.gz: fdda1bd5546f283f62bb75431e22e7bd221d1171ab84f8011e5d1fad65704656769ba6bb9e47faabc2627b427da2cc94c74ec388053c0a4d519a36e89f4a9e25
7
+ data.tar.gz: baae39702afd10e7ad5900f781e7ca0df5d6219bda8c20e4d0f5bbb8ec22ec4749e47ae63fefe83a9a543aff53214d2dbbcfdf751f0e46c86be9a3b965a7e3e3
data/.rubocop.yml CHANGED
@@ -1,23 +1,23 @@
1
1
  Rails:
2
- Enabled: false
2
+ Enabled: true
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
6
  Exclude:
7
- - "vendor/**/*"
8
- - "db/schema.rb"
9
- - "bin/**/*"
10
- - "finapps.gemspec"
7
+ - "vendor/**/*"
8
+ - "db/schema.rb"
9
+ - "bin/**/*"
10
+ - "finapps_core.gemspec"
11
11
  UseCache: false
12
12
 
13
13
  # Commonly used screens these days easily fit more than 80 characters.
14
14
  Metrics/LineLength:
15
15
  Max: 120
16
16
 
17
- # No space makes the method definition shorter and differentiates
18
- # from a regular assignment.
19
- Layout/SpaceAroundEqualsInParameterDefault:
20
- EnforcedStyle: no_space
17
+ # Re-enable this when the following is resolved:
18
+ # https://github.com/rubocop-hq/rubocop/issues/5953
19
+ Style/AccessModifierDeclarations:
20
+ Enabled: false
21
21
 
22
22
  Layout/SpaceInsideBlockBraces:
23
23
  # The space here provides no real gain in readability while consuming
@@ -25,12 +25,6 @@ Layout/SpaceInsideBlockBraces:
25
25
  # Also {| differentiates better from a hash than { | does.
26
26
  SpaceBeforeBlockParameters: false
27
27
 
28
- # No trailing space differentiates better from the block:
29
- # foo} means hash, foo } means block.
30
- Layout/SpaceInsideHashLiteralBraces:
31
- EnforcedStyle: no_space
32
-
33
-
34
28
  Style/CollectionMethods:
35
29
  Description: Preferred collection methods.
36
30
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
@@ -41,47 +35,10 @@ Style/CollectionMethods:
41
35
  find: detect
42
36
  find_all: select
43
37
  reduce: inject
44
- Layout/DotPosition:
45
- Description: Checks the position of the dot in multi-line method calls.
46
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
47
- Enabled: true
48
- EnforcedStyle: leading
49
- SupportedStyles:
50
- - leading
51
- - trailing
52
- Style/FileName:
53
- Description: Use snake_case for source file names.
54
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
55
- Enabled: false
56
- Exclude: []
57
- Style/GuardClause:
58
- Description: Check for conditionals that can be replaced with guard clauses
59
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
60
- Enabled: false
61
- MinBodyLength: 1
62
- Style/IfUnlessModifier:
63
- Description: Favor modifier if/unless usage when you have a single-line body.
64
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
65
- Enabled: false
66
- MaxLineLength: 80
67
38
  Style/OptionHash:
68
39
  Description: Don't use option hashes when you can use keyword arguments.
69
40
  Enabled: false
70
- Style/PercentLiteralDelimiters:
71
- Description: Use `%`-literal delimiters consistently
72
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
73
- Enabled: false
74
- PreferredDelimiters:
75
- "%": "()"
76
- "%i": "()"
77
- "%q": "()"
78
- "%Q": "()"
79
- "%r": "{}"
80
- "%s": "()"
81
- "%w": "()"
82
- "%W": "()"
83
- "%x": "()"
84
- Style/PredicateName:
41
+ Naming/PredicateName:
85
42
  Description: Check the names of predicate methods.
86
43
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
87
44
  Enabled: true
@@ -93,55 +50,6 @@ Style/PredicateName:
93
50
  - is_
94
51
  Exclude:
95
52
  - spec/**/*
96
- Style/RaiseArgs:
97
- Description: Checks the arguments passed to raise/fail.
98
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
99
- Enabled: false
100
- EnforcedStyle: exploded
101
- SupportedStyles:
102
- - compact
103
- - exploded
104
- Style/SignalException:
105
- Description: Checks for proper usage of fail and raise.
106
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
107
- Enabled: false
108
- EnforcedStyle: semantic
109
- SupportedStyles:
110
- - only_raise
111
- - only_fail
112
- - semantic
113
- Style/SingleLineBlockParams:
114
- Description: Enforces the names of some block params.
115
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
116
- Enabled: false
117
- Methods:
118
- - reduce:
119
- - a
120
- - e
121
- - inject:
122
- - a
123
- - e
124
- Style/SingleLineMethods:
125
- Description: Avoid single-line methods.
126
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
127
- Enabled: false
128
- AllowIfMethodIsEmpty: true
129
- Style/StringLiterals:
130
- Description: Checks if uses of quotes match the configured preference.
131
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
132
- Enabled: true
133
- EnforcedStyle: single_quotes
134
- SupportedStyles:
135
- - single_quotes
136
- - double_quotes
137
- Style/StringLiteralsInInterpolation:
138
- Description: Checks if uses of quotes inside expressions in interpolated strings
139
- match the configured preference.
140
- Enabled: true
141
- EnforcedStyle: single_quotes
142
- SupportedStyles:
143
- - single_quotes
144
- - double_quotes
145
53
  Metrics/AbcSize:
146
54
  Description: A calculated magnitude based on number of assignments, branches, and
147
55
  conditions.
@@ -181,75 +89,19 @@ Metrics/PerceivedComplexity:
181
89
  reader.
182
90
  Enabled: false
183
91
  Max: 7
184
- Lint/AssignmentInCondition:
185
- Description: Don't use assignment in conditions.
186
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
187
- Enabled: false
188
- AllowSafeAssignment: true
189
- Style/InlineComment:
190
- Description: Avoid inline comments.
191
- Enabled: false
192
- Style/AccessorMethodName:
193
- Description: Check the naming of accessor methods for get_/set_.
194
- Enabled: false
195
- Style/Alias:
196
- Description: Use alias_method instead of alias.
197
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
198
- Enabled: false
199
92
  Style/Documentation:
200
93
  Description: Document classes and non-namespace modules.
201
94
  Enabled: false
202
- Style/DoubleNegation:
203
- Description: Checks for uses of double negation (!!).
204
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
205
- Enabled: false
206
- Style/EachWithObject:
207
- Description: Prefer `each_with_object` over `inject` or `reduce`.
208
- Enabled: false
209
95
  Style/EmptyLiteral:
210
96
  Description: Prefer literals to Array.new/Hash.new/String.new.
211
97
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
212
98
  Enabled: false
213
- Style/ModuleFunction:
214
- Description: Checks for usage of `extend self` in modules.
215
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
216
- Enabled: false
217
- Style/OneLineConditional:
218
- Description: Favor the ternary operator(?:) over if/then/else/end constructs.
219
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
220
- Enabled: false
221
- Style/PerlBackrefs:
222
- Description: Avoid Perl-style regex back references.
223
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
224
- Enabled: false
225
- Style/Send:
226
- Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
227
- may overlap with existing methods.
228
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
229
- Enabled: false
230
- Style/SpecialGlobalVars:
231
- Description: Avoid Perl-style global variables.
232
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
233
- Enabled: false
234
99
  Style/VariableInterpolation:
235
100
  Description: Don't interpolate global, instance and class variables directly in
236
101
  strings.
237
102
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
238
103
  Enabled: false
239
- Style/WhenThen:
240
- Description: Use when x then ... for one-line cases.
241
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
242
- Enabled: false
243
- Lint/EachWithObjectArgument:
244
- Description: Check for immutable argument given to each_with_object.
245
- Enabled: true
246
104
  Lint/HandleExceptions:
247
105
  Description: Don't suppress exception.
248
106
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
249
- Enabled: false
250
- Lint/LiteralInCondition:
251
- Description: Checks of literals used in conditions.
252
- Enabled: false
253
- Lint/LiteralInInterpolation:
254
- Description: Checks for literals used in interpolation.
255
107
  Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.4.2
1
+ ruby-2.5.1
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.4.2
4
+ - 2.5.1
5
5
  before_install:
6
6
  - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
7
7
  - gem update --system
data/finapps.gemspec CHANGED
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
5
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
5
  require 'finapps/version'
7
6
  Gem::Specification.new do |spec|
@@ -21,17 +20,17 @@ Gem::Specification.new do |spec|
21
20
  spec.test_files = Dir['spec/**/*.rb']
22
21
  spec.require_paths = ['lib']
23
22
 
24
- spec.add_runtime_dependency 'finapps_core', '~> 3.0', '>= 3.0.6'
23
+ spec.add_runtime_dependency 'finapps_core', '~> 4.0', '>= 4.0.0'
25
24
 
26
- spec.add_development_dependency 'bundler', '~> 1.15', '>= 1.15.4'
27
- spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.8'
28
- spec.add_development_dependency 'gem-release', '~> 0.7', '>= 0.7.4'
29
- spec.add_development_dependency 'rake', '~> 12.1', '>= 12.1.0'
30
- spec.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.49.1'
32
- spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.0'
33
- spec.add_development_dependency 'webmock', '~> 3.0', '>= 3.0.1'
25
+ spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.6'
26
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
27
+ spec.add_development_dependency 'gem-release', '~> 2.0', '>= 2.0.1'
28
+ spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.1'
29
+ spec.add_development_dependency 'rspec', '~> 3.8', '>= 3.8.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.59', '>= 0.59.2'
31
+ spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.4'
32
+ spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
34
33
 
35
- spec.extra_rdoc_files = %w(README.md LICENSE.txt)
36
- spec.rdoc_options = %w(--line-numbers --inline-source --title finapps-ruby --main README.md)
34
+ spec.extra_rdoc_files = %w[README.md LICENSE.txt]
35
+ spec.rdoc_options = %w[--line-numbers --inline-source --title finapps-ruby --main README.md]
37
36
  end
data/lib/finapps.rb CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  require 'faraday'
4
4
  require 'faraday_middleware'
5
- require 'typhoeus'
6
- require 'typhoeus/adapters/faraday'
7
5
 
8
6
  require 'finapps_core'
9
7
 
@@ -6,7 +6,7 @@ require_relative './version'
6
6
  module FinApps
7
7
  module REST
8
8
  class Client < FinAppsCore::REST::BaseClient # :nodoc:
9
- RESOURCES = %i(
9
+ RESOURCES = %i[
10
10
  institutions
11
11
  institutions_forms
12
12
  orders
@@ -30,12 +30,12 @@ module FinApps
30
30
  user_institutions_forms
31
31
  user_institutions_statuses
32
32
  version
33
- ).freeze
33
+ ].freeze
34
34
 
35
35
  # @param [String] tenant_token
36
36
  # @param [Hash] options
37
37
  # @return [FinApps::REST::Client]
38
- def initialize(tenant_token, options={}, logger=nil)
38
+ def initialize(tenant_token, options = {}, logger = nil)
39
39
  not_blank(tenant_token, :tenant_token)
40
40
 
41
41
  merged_options = options.merge(tenant_token: tenant_token)
@@ -56,7 +56,7 @@ module FinApps
56
56
  end
57
57
  end
58
58
 
59
- def respond_to_missing?(method_sym, include_private=false)
59
+ def respond_to_missing?(method_sym, include_private = false)
60
60
  RESOURCES.include?(method_sym) ? true : super
61
61
  end
62
62
 
@@ -65,7 +65,7 @@ module FinApps
65
65
  def camelize(term)
66
66
  string = term.to_s
67
67
  string = string.sub(/^[a-z\d]*/) { $&.capitalize }
68
- string.gsub!(%r{(?:_|(/))([a-z\d]*)}) { $2.capitalize.to_s }
68
+ string.gsub!(%r{(?:_|(/))([a-z\d]*)}) { Regexp.last_match(2).capitalize.to_s }
69
69
  string
70
70
  end
71
71
  end
@@ -7,9 +7,10 @@ module FinApps
7
7
  class Operators < FinAppsCore::REST::Resources
8
8
  include FinApps::Utils::QueryBuilder
9
9
 
10
- def list(params=nil)
10
+ def list(params = nil)
11
11
  return super if params.nil?
12
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
12
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
13
+
13
14
  super build_query_path(end_point, params)
14
15
  end
15
16
 
@@ -19,7 +20,7 @@ module FinApps
19
20
  super id
20
21
  end
21
22
 
22
- def create(params, path=nil)
23
+ def create(params, path = nil)
23
24
  not_blank(params, :params)
24
25
  super params, path
25
26
  end
@@ -35,7 +36,8 @@ module FinApps
35
36
  def update_password(params)
36
37
  # update password for current operator, need authorization session in header
37
38
  not_blank(params, :params)
38
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
39
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
40
+
39
41
  path = "#{end_point}/password/change"
40
42
 
41
43
  create params, path
@@ -60,11 +62,11 @@ module FinApps
60
62
  end
61
63
 
62
64
  def search_query(term)
63
- {"last_name": term}
65
+ { "last_name": term }
64
66
  end
65
67
 
66
68
  def role_query(role)
67
- role.is_a?(Array) ? {"role": {"$in": role.map(&:to_i)}} : {"role": role.to_i}
69
+ role.is_a?(Array) ? { "role": { "$in": role.map(&:to_i) } } : { "role": role.to_i }
68
70
  end
69
71
  end
70
72
  end
@@ -3,7 +3,7 @@
3
3
  module FinApps
4
4
  module REST
5
5
  class OperatorsPasswordResets < FinAppsCore::REST::Resources
6
- def create(params, path=nil)
6
+ def create(params, path = nil)
7
7
  not_blank(params, :params)
8
8
  validates_email(params) if path.nil?
9
9
 
@@ -22,9 +22,11 @@ module FinApps
22
22
  private
23
23
 
24
24
  def validates_email(params)
25
- unless params.key?(:email) && params[:email]
26
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.'
27
- end
25
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless email_exists? params
26
+ end
27
+
28
+ def email_exists?(params)
29
+ params.key?(:email) && params[:email]
28
30
  end
29
31
  end
30
32
  end
@@ -6,7 +6,7 @@ module FinApps
6
6
  def update(id, orders_array)
7
7
  not_blank(id, :operator_id)
8
8
  not_blank(orders_array, :params)
9
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless orders_array.is_a? Array
9
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless orders_array.is_a? Array
10
10
 
11
11
  path = "operators/#{ERB::Util.url_encode(id)}/assign"
12
12
  super orders_array, path
@@ -6,7 +6,7 @@ module FinApps
6
6
  def show(id, format)
7
7
  not_blank(id, :id)
8
8
  not_blank(format, :format)
9
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: format' unless accepted_format?(format)
9
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: format' unless accepted_format?(format)
10
10
 
11
11
  path = "orders/#{ERB::Util.url_encode(id)}/report.#{ERB::Util.url_encode(format)}"
12
12
  super nil, path
@@ -15,7 +15,7 @@ module FinApps
15
15
  private
16
16
 
17
17
  def accepted_format?(format)
18
- %i(json html pdf).include? format.to_sym
18
+ %i[json html pdf].include? format.to_sym
19
19
  end
20
20
  end
21
21
  end
@@ -18,19 +18,24 @@ module FinApps
18
18
  end
19
19
 
20
20
  # GET /v3/list/orders?page=1&requested=25&sort=-date
21
+ # @param [Hash] params
22
+ # Optional keys:
21
23
  # :page - page number requested
22
24
  # :requested - number of results per page requested
23
25
  # :sort - sort order
24
26
  # :filter - mongo object to filter
25
27
  # descending - append "-" before option for descending sort
26
- def list(params=nil) # params hash with optional keys [:page, :sort, :requested]
28
+ #
29
+ def list(params = nil)
27
30
  return super if params.nil?
28
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
31
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
32
+
29
33
  super build_query_path(end_point, params)
30
34
  end
31
35
 
32
- def update(id, params, path=nil)
36
+ def update(id, params, path = nil)
33
37
  return super nil, path if path
38
+
34
39
  not_blank(id, :id)
35
40
  not_blank(params, :params)
36
41
  # Params array need matching Institution ids & Account ids
@@ -63,33 +68,33 @@ module FinApps
63
68
  def search_query(term)
64
69
  {
65
70
  "$or": [
66
- {"public_id": {
71
+ { "public_id": {
67
72
  "$regex": "^#{term}",
68
73
  "$options": 'i'
69
- }},
70
- {"applicant.last_name": term},
71
- {"assignment.last_name": term},
72
- {"requestor.reference_no": {
74
+ } },
75
+ { "applicant.last_name": term },
76
+ { "assignment.last_name": term },
77
+ { "requestor.reference_no": {
73
78
  "$regex": "^#{term}",
74
79
  "$options": 'i'
75
- }}
80
+ } }
76
81
  ]
77
82
  }
78
83
  end
79
84
 
80
85
  def status_query(status)
81
- status.is_a?(Array) ? {"status": {"$in": status.map(&:to_i)}} : {"status": status.to_i}
86
+ status.is_a?(Array) ? { "status": { "$in": status.map(&:to_i) } } : { "status": status.to_i }
82
87
  end
83
88
 
84
89
  def assignment_query(assignment)
85
- {"assignment.operator_id": assignment.empty? ? nil : assignment} # translate "" to null assignment
90
+ { "assignment.operator_id": assignment.empty? ? nil : assignment } # translate "" to null assignment
86
91
  end
87
92
 
88
93
  def relation_query(relation)
89
94
  {
90
95
  "$or": [
91
- {"public_id": {"$in": relation}},
92
- {"original_order_id": {"$in": relation}}
96
+ { "public_id": { "$in": relation } },
97
+ { "original_order_id": { "$in": relation } }
93
98
  ]
94
99
  }
95
100
  end
@@ -5,9 +5,10 @@ module FinApps
5
5
  class Sessions < FinAppsCore::REST::Resources # :nodoc:
6
6
  LOGOUT = 'logout'
7
7
 
8
- def create(params, path=nil)
8
+ def create(params, path = nil)
9
9
  return super nil, path if path == LOGOUT
10
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
10
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
11
+
11
12
  path ||= 'login'
12
13
 
13
14
  super params, path
@@ -8,7 +8,7 @@ module FinApps
8
8
  page = "page=#{params[:page].to_i}" if params[:page]
9
9
  requested = "requested=#{params[:requested].to_i}" if params[:requested]
10
10
  sort = "sort=#{ERB::Util.url_encode(params[:sort])}" if params[:sort]
11
- filter = "filter=#{ERB::Util.url_encode(filter_obj.to_json)}" if filter_obj && !filter_obj.empty?
11
+ filter = "filter=#{ERB::Util.url_encode(filter_obj.to_json)}" unless filter_obj.empty?
12
12
  query_join(root_url, [page, requested, sort, filter])
13
13
  end
14
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '4.0.3'
4
+ VERSION = '4.0.4'
5
5
  end
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
4
4
  RSpec.describe FinApps::REST::Consumers, 'initialized with valid FinApps::Client object' do
5
5
  include SpecHelpers::Client
6
6
  subject(:users) { FinApps::REST::Consumers.new(client) }
7
- missing_public_id = 'Missing argument: public_id'
7
+ missing_public_id = ': public_id'
8
8
 
9
9
  describe '#create' do
10
10
  let(:results) { create[0] }
@@ -26,7 +26,7 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
26
26
  end
27
27
 
28
28
  context 'when including valid params' do
29
- let(:params) { {page: 2, sort: 'date_created', requested: 25, searchTerm: 'term', role: 2} }
29
+ let(:params) { { page: 2, sort: 'date_created', requested: 25, searchTerm: 'term', role: 2 } }
30
30
 
31
31
  it { expect { list }.not_to raise_error }
32
32
  it('performs a get and returns the response') { expect(results).to respond_to(:records) }
@@ -160,7 +160,7 @@ RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client
160
160
  end
161
161
 
162
162
  context 'with valid params' do
163
- let(:valid_params) { {password: 'valid password', password_confirm: 'valid_password'} }
163
+ let(:valid_params) { { password: 'valid password', password_confirm: 'valid_password' } }
164
164
  let(:update_password) { subject.update_password(valid_params) }
165
165
 
166
166
  it { expect { update_password }.not_to raise_error }
@@ -9,7 +9,7 @@ RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Clie
9
9
  let(:error_messages) { show[ERROR_MESSAGES] }
10
10
 
11
11
  context 'when missing token' do
12
- it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError, 'Missing argument: token') }
12
+ it { expect { subject.show(nil) }.to raise_error(FinAppsCore::MissingArgumentsError, ': token') }
13
13
  end
14
14
 
15
15
  context 'for valid token' do
@@ -32,7 +32,7 @@ RSpec.describe FinApps::REST::Orders do
32
32
 
33
33
  context 'when valid params are provided' do
34
34
  subject { FinApps::REST::Orders.new(client).create(valid_params) }
35
- let(:valid_params) { {applicant: 'valid', institutions: 'valid', product: 'valid'} }
35
+ let(:valid_params) { { applicant: 'valid', institutions: 'valid', product: 'valid' } }
36
36
 
37
37
  it { expect { subject }.not_to raise_error }
38
38
  it('returns an array') { expect(subject).to be_a(Array) }
@@ -45,7 +45,7 @@ RSpec.describe FinApps::REST::Orders do
45
45
 
46
46
  context 'when invalid params are provided' do
47
47
  subject { FinApps::REST::Orders.new(client).create(invalid_params) }
48
- let(:invalid_params) { {applicant: 'valid'} }
48
+ let(:invalid_params) { { applicant: 'valid' } }
49
49
 
50
50
  it { expect { subject }.not_to raise_error }
51
51
  it('results is nil') { expect(subject[RESULTS]).to be_nil }
@@ -69,7 +69,7 @@ RSpec.describe FinApps::REST::Orders do
69
69
 
70
70
  context 'when invalid params are provided' do
71
71
  subject { FinApps::REST::Orders.new(client).list(invalid_params) }
72
- let(:invalid_params) { %w(this is an array) }
72
+ let(:invalid_params) { %w[this is an array] }
73
73
 
74
74
  it { expect { subject }.to raise_error(FinAppsCore::InvalidArgumentsError) }
75
75
  end
@@ -77,8 +77,8 @@ RSpec.describe FinApps::REST::Orders do
77
77
  context 'when including valid params' do
78
78
  subject { FinApps::REST::Orders.new(client).list(params) }
79
79
  let(:params) do
80
- {page: 2, sort: 'status', requested: 25, searchTerm: 'term', status: %w(1 7),
81
- assignment: 'valid_operator', relation: ['valid_order_id']}
80
+ { page: 2, sort: 'status', requested: 25, searchTerm: 'term', status: %w[1 7],
81
+ assignment: 'valid_operator', relation: ['valid_order_id'] }
82
82
  end
83
83
 
84
84
  it { expect { subject }.not_to raise_error }
@@ -28,8 +28,8 @@ RSpec.describe FinApps::REST::PasswordResets do
28
28
  end
29
29
 
30
30
  describe '#update' do
31
- let(:valid_params) { {token: 'valid_token'} }
32
- let(:invalid_params) { {token: 'invalid_token'} }
31
+ let(:valid_params) { { token: 'valid_token' } }
32
+ let(:invalid_params) { { token: 'invalid_token' } }
33
33
 
34
34
  context 'when missing id' do
35
35
  subject { FinApps::REST::PasswordResets.new(client).update(nil, :params) }
@@ -24,7 +24,7 @@ RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client
24
24
  end
25
25
 
26
26
  context 'for invalid credentials' do
27
- let(:credentials) { {email: 'email@domain.com', password: 'invalid_password'} }
27
+ let(:credentials) { { email: 'email@domain.com', password: 'invalid_password' } }
28
28
 
29
29
  it { expect { create }.not_to raise_error }
30
30
  it('results is nil') { expect(results).to be_nil }
@@ -33,7 +33,7 @@ RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client
33
33
  end
34
34
 
35
35
  context 'for valid credentials' do
36
- let(:credentials) { {email: 'email@domain.com', password: 'valid_password'} }
36
+ let(:credentials) { { email: 'email@domain.com', password: 'valid_password' } }
37
37
 
38
38
  it('results is a Hashie::Rash') { expect(results).to be_a(Hashie::Mash::Rash) }
39
39
  it('token value is in the result') { expect(results).to respond_to(:token) }
@@ -42,7 +42,7 @@ RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client
42
42
 
43
43
  context 'for valid credentials & path argument' do
44
44
  let(:create) { subject.create(credentials, 'operators/login') }
45
- let(:credentials) { {email: 'email@domain.com', password: 'valid_password'} }
45
+ let(:credentials) { { email: 'email@domain.com', password: 'valid_password' } }
46
46
 
47
47
  it('results is a Hashie::Rash') { expect(results).to be_a(Hashie::Mash::Rash) }
48
48
  it('token value is in the result') { expect(results).to respond_to(:token) }
@@ -25,7 +25,7 @@ RSpec.describe FinApps::REST::TenantAppSettings do
25
25
  end
26
26
 
27
27
  context 'when valid params are provided' do
28
- let(:params) { {pdf_statement_months: 2} }
28
+ let(:params) { { pdf_statement_months: 2 } }
29
29
 
30
30
  it { expect { update }.not_to raise_error }
31
31
  it('performs put and returns no content') { expect(update[RESULTS]).to be_nil }
@@ -33,7 +33,7 @@ RSpec.describe FinApps::REST::TenantAppSettings do
33
33
  end
34
34
 
35
35
  context 'when invalid params are provided' do
36
- let(:params) { {pdf_statement_months: nil} }
36
+ let(:params) { { pdf_statement_months: nil } }
37
37
 
38
38
  it { expect { update }.not_to raise_error }
39
39
  it('results is nil') { expect(update[RESULTS]).to be_nil }
@@ -25,7 +25,7 @@ RSpec.describe FinApps::REST::TenantSettings do
25
25
  end
26
26
 
27
27
  context 'when valid params are provided' do
28
- let(:params) { {iav_default_product: 'valid'} }
28
+ let(:params) { { iav_default_product: 'valid' } }
29
29
 
30
30
  it { expect { update }.not_to raise_error }
31
31
  it('performs put and returns no content') { expect(update[RESULTS]).to be_nil }
@@ -33,7 +33,7 @@ RSpec.describe FinApps::REST::TenantSettings do
33
33
  end
34
34
 
35
35
  context 'when invalid params are provided' do
36
- let(:params) { {bad_params: true} }
36
+ let(:params) { { bad_params: true } }
37
37
 
38
38
  it { expect { update }.not_to raise_error }
39
39
  it('results is nil') { expect(update[RESULTS]).to be_nil }
data/spec/spec_helper.rb CHANGED
@@ -36,8 +36,8 @@ RSpec.configure do |config|
36
36
  WebMock.disable_net_connect!(allow: 'codeclimate.com')
37
37
  end
38
38
 
39
- VALID_CREDENTIALS = {identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
40
- token: 'hohoho='}.freeze
39
+ VALID_CREDENTIALS = { identifier: '49fb918d-7e71-44dd-7378-58f19606df2a',
40
+ token: 'hohoho=' }.freeze
41
41
 
42
42
  RESULTS = 0
43
43
  ERROR_MESSAGES = 1
@@ -64,7 +64,7 @@ class FakeApi < Sinatra::Base
64
64
  post('/v3/orders') do
65
65
  request.body.rewind
66
66
  request_payload = JSON.parse request.body.read
67
- if %w(applicant institutions product).all? {|s| request_payload.key? s }
67
+ if %w[applicant institutions product].all? {|s| request_payload.key? s }
68
68
  json_response 200, 'order_token.json'
69
69
  else
70
70
  json_response 400, 'invalid_request_body.json'
@@ -3,7 +3,7 @@
3
3
  class FakeClass
4
4
  include FinApps::Utils::QueryBuilder
5
5
 
6
- def build_filter(p); end
6
+ def build_filter(param); end
7
7
  end
8
8
 
9
9
  RSpec.describe FinApps::Utils::QueryBuilder do
@@ -13,9 +13,9 @@ RSpec.describe FinApps::Utils::QueryBuilder do
13
13
  let(:end_point) { 'orders' }
14
14
 
15
15
  context 'with full params' do
16
- let(:params) { {page: '1', requested: '20', sort: '-date', random: 'random'} }
16
+ let(:params) { { page: '1', requested: '20', sort: '-date', random: 'random' } }
17
17
  it 'calls #build_filter and returns correct string' do
18
- allow(subject).to receive(:build_filter) { {role: 2} }
18
+ allow(subject).to receive(:build_filter) { { role: 2 } }
19
19
  expect(subject).to receive(:build_filter).with(params)
20
20
  correct_string = 'orders?page=1&requested=20&sort=-date&filter=%7B%22role%22%3A2%7D'
21
21
  expect(subject.build_query_path(end_point, params)).to eq(correct_string)
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: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2018-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '4.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.6
22
+ version: 4.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '3.0'
29
+ version: '4.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 3.0.6
32
+ version: 4.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.15'
39
+ version: '1.16'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.15.4
42
+ version: 1.16.6
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '1.15'
49
+ version: '1.16'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 1.15.4
52
+ version: 1.16.6
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: codeclimate-test-reporter
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '1.0'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.0.8
62
+ version: 1.0.9
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,81 +69,87 @@ dependencies:
69
69
  version: '1.0'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.0.8
72
+ version: 1.0.9
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: gem-release
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '0.7'
79
+ version: '2.0'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.7.4
82
+ version: 2.0.1
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.7'
89
+ version: '2.0'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 0.7.4
92
+ version: 2.0.1
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rake
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '12.1'
99
+ version: '12.3'
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 12.1.0
102
+ version: 12.3.1
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: '12.1'
109
+ version: '12.3'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 12.1.0
112
+ version: 12.3.1
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '3.5'
119
+ version: '3.8'
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 3.5.0
122
+ version: 3.8.0
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '3.5'
129
+ version: '3.8'
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 3.5.0
132
+ version: 3.8.0
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rubocop
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 0.49.1
139
+ version: '0.59'
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 0.59.2
140
143
  type: :development
141
144
  prerelease: false
142
145
  version_requirements: !ruby/object:Gem::Requirement
143
146
  requirements:
144
147
  - - "~>"
145
148
  - !ruby/object:Gem::Version
146
- version: 0.49.1
149
+ version: '0.59'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 0.59.2
147
153
  - !ruby/object:Gem::Dependency
148
154
  name: sinatra
149
155
  requirement: !ruby/object:Gem::Requirement
@@ -153,7 +159,7 @@ dependencies:
153
159
  version: '2.0'
154
160
  - - ">="
155
161
  - !ruby/object:Gem::Version
156
- version: 2.0.0
162
+ version: 2.0.4
157
163
  type: :development
158
164
  prerelease: false
159
165
  version_requirements: !ruby/object:Gem::Requirement
@@ -163,27 +169,27 @@ dependencies:
163
169
  version: '2.0'
164
170
  - - ">="
165
171
  - !ruby/object:Gem::Version
166
- version: 2.0.0
172
+ version: 2.0.4
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: webmock
169
175
  requirement: !ruby/object:Gem::Requirement
170
176
  requirements:
171
177
  - - "~>"
172
178
  - !ruby/object:Gem::Version
173
- version: '3.0'
179
+ version: '3.4'
174
180
  - - ">="
175
181
  - !ruby/object:Gem::Version
176
- version: 3.0.1
182
+ version: 3.4.2
177
183
  type: :development
178
184
  prerelease: false
179
185
  version_requirements: !ruby/object:Gem::Requirement
180
186
  requirements:
181
187
  - - "~>"
182
188
  - !ruby/object:Gem::Version
183
- version: '3.0'
189
+ version: '3.4'
184
190
  - - ">="
185
191
  - !ruby/object:Gem::Version
186
- version: 3.0.1
192
+ version: 3.4.2
187
193
  description: A simple library for communicating with the FinApps REST API.
188
194
  email:
189
195
  - erich@financialapps.com
@@ -322,36 +328,36 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
328
  version: '0'
323
329
  requirements: []
324
330
  rubyforge_project:
325
- rubygems_version: 2.7.3
331
+ rubygems_version: 2.7.7
326
332
  signing_key:
327
333
  specification_version: 4
328
334
  summary: FinApps REST API ruby client.
329
335
  test_files:
330
- - spec/rest/operators_password_resets_spec.rb
331
- - spec/rest/products_spec.rb
332
- - spec/rest/statements_spec.rb
333
- - spec/rest/version_spec.rb
334
- - spec/rest/user_institutions_forms_spec.rb
335
- - spec/rest/consumers_spec.rb
336
- - spec/rest/orders_spec.rb
337
- - spec/rest/order_tokens_spec.rb
338
- - spec/rest/institutions_forms_spec.rb
336
+ - spec/spec_helper.rb
337
+ - spec/spec_helpers/client.rb
338
+ - spec/utils/query_builder_spec.rb
339
+ - spec/support/fake_api.rb
339
340
  - spec/rest/tenant_app_settings_spec.rb
340
- - spec/rest/operators_spec.rb
341
- - spec/rest/user_institutions_statuses_spec.rb
341
+ - spec/rest/order_reports_spec.rb
342
342
  - spec/rest/client_spec.rb
343
- - spec/rest/tenant_settings_spec.rb
344
343
  - spec/rest/user_institutions_spec.rb
345
- - spec/rest/consumer_institution_refreshes_spec.rb
346
- - spec/rest/password_resets_spec.rb
347
- - spec/rest/order_reports_spec.rb
348
- - spec/rest/institutions_spec.rb
344
+ - spec/rest/consumers_spec.rb
349
345
  - spec/rest/order_statuses_spec.rb
350
- - spec/rest/order_refreshes_spec.rb
351
346
  - spec/rest/order_notifications_spec.rb
347
+ - spec/rest/operators_password_resets_spec.rb
348
+ - spec/rest/institutions_forms_spec.rb
349
+ - spec/rest/operators_spec.rb
350
+ - spec/rest/version_spec.rb
351
+ - spec/rest/statements_spec.rb
352
352
  - spec/rest/order_assignments_spec.rb
353
+ - spec/rest/order_refreshes_spec.rb
354
+ - spec/rest/user_institutions_statuses_spec.rb
355
+ - spec/rest/order_tokens_spec.rb
356
+ - spec/rest/products_spec.rb
353
357
  - spec/rest/sessions_spec.rb
354
- - spec/support/fake_api.rb
355
- - spec/utils/query_builder_spec.rb
356
- - spec/spec_helpers/client.rb
357
- - spec/spec_helper.rb
358
+ - spec/rest/password_resets_spec.rb
359
+ - spec/rest/consumer_institution_refreshes_spec.rb
360
+ - spec/rest/user_institutions_forms_spec.rb
361
+ - spec/rest/institutions_spec.rb
362
+ - spec/rest/tenant_settings_spec.rb
363
+ - spec/rest/orders_spec.rb