lhs 15.3.1 → 15.3.2

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.localch.yml +158 -21
  3. data/.rubocop.yml +9 -3
  4. data/lhs.gemspec +10 -9
  5. data/lib/lhs/complex.rb +1 -1
  6. data/lib/lhs/concerns/autoload_records.rb +1 -1
  7. data/lib/lhs/concerns/collection/handle_nested.rb +1 -1
  8. data/lib/lhs/concerns/inspect.rb +1 -1
  9. data/lib/lhs/concerns/item/validation.rb +2 -2
  10. data/lib/lhs/concerns/proxy/accessors.rb +1 -1
  11. data/lib/lhs/concerns/proxy/problems.rb +1 -1
  12. data/lib/lhs/concerns/record/chainable.rb +1 -1
  13. data/lib/lhs/concerns/record/endpoints.rb +2 -2
  14. data/lib/lhs/concerns/record/model.rb +1 -1
  15. data/lib/lhs/concerns/record/request.rb +5 -5
  16. data/lib/lhs/data.rb +5 -4
  17. data/lib/lhs/endpoint.rb +1 -1
  18. data/lib/lhs/item.rb +8 -0
  19. data/lib/lhs/pagination/base.rb +0 -1
  20. data/lib/lhs/problems/base.rb +1 -1
  21. data/lib/lhs/record.rb +1 -1
  22. data/lib/lhs/version.rb +1 -1
  23. data/spec/autoloading_spec.rb +4 -4
  24. data/spec/collection/accessors_spec.rb +1 -1
  25. data/spec/collection/collection_items_spec.rb +1 -1
  26. data/spec/collection/configurable_spec.rb +1 -1
  27. data/spec/collection/meta_data_spec.rb +1 -1
  28. data/spec/collection/to_a_spec.rb +1 -1
  29. data/spec/collection/to_ary_spec.rb +6 -2
  30. data/spec/collection/without_object_items_spec.rb +1 -1
  31. data/spec/complex/reduce_spec.rb +2 -2
  32. data/spec/concerns/record/request_spec.rb +1 -1
  33. data/spec/data/collection_spec.rb +1 -1
  34. data/spec/data/equality_spec.rb +1 -1
  35. data/spec/data/inspect_spec.rb +1 -1
  36. data/spec/data/is_item_or_collection_spec.rb +1 -1
  37. data/spec/data/item_spec.rb +1 -1
  38. data/spec/data/merge_spec.rb +1 -1
  39. data/spec/data/parent_spec.rb +1 -1
  40. data/spec/data/raw_spec.rb +1 -1
  41. data/spec/data/respond_to_spec.rb +3 -3
  42. data/spec/data/root_spec.rb +1 -1
  43. data/spec/data/select_spec.rb +1 -1
  44. data/spec/data/to_ary_spec.rb +26 -0
  45. data/spec/data/to_json_spec.rb +1 -1
  46. data/spec/endpoint/for_url_spec.rb +1 -1
  47. data/spec/item/access_errors_spec.rb +1 -1
  48. data/spec/item/accessors_spec.rb +1 -1
  49. data/spec/item/add_error_spec.rb +1 -1
  50. data/spec/item/becomes_spec.rb +1 -1
  51. data/spec/item/blacklisted_keywords_spec.rb +1 -1
  52. data/spec/item/delegate_spec.rb +1 -1
  53. data/spec/item/destroy_spec.rb +2 -2
  54. data/spec/item/dig_spec.rb +1 -1
  55. data/spec/item/error_codes_spec.rb +1 -1
  56. data/spec/item/errors_spec.rb +22 -22
  57. data/spec/item/fetch_spec.rb +1 -1
  58. data/spec/item/getter_spec.rb +1 -1
  59. data/spec/item/internal_data_structure_spec.rb +1 -1
  60. data/spec/item/map_spec.rb +1 -1
  61. data/spec/item/partial_update_spec.rb +3 -3
  62. data/spec/item/save_spec.rb +2 -2
  63. data/spec/item/setter_spec.rb +1 -1
  64. data/spec/item/translate_errors_spec.rb +1 -1
  65. data/spec/item/update_spec.rb +1 -1
  66. data/spec/item/validation_spec.rb +4 -4
  67. data/spec/item/warning_codes_spec.rb +1 -1
  68. data/spec/item/warnings_spec.rb +1 -3
  69. data/spec/pagination/pages_left_spec.rb +1 -1
  70. data/spec/pagination/parameters_spec.rb +1 -1
  71. data/spec/proxy/create_sub_resource_spec.rb +5 -5
  72. data/spec/proxy/load_spec.rb +8 -10
  73. data/spec/proxy/record_identification_spec.rb +1 -1
  74. data/spec/record/all_spec.rb +3 -3
  75. data/spec/record/build_spec.rb +1 -1
  76. data/spec/record/cast_nested_data_spec.rb +1 -1
  77. data/spec/record/chain_error_handling_spec.rb +1 -1
  78. data/spec/record/create_spec.rb +4 -4
  79. data/spec/record/creation_failed_spec.rb +2 -2
  80. data/spec/record/definitions_spec.rb +1 -1
  81. data/spec/record/destroy_spec.rb +1 -1
  82. data/spec/record/dig_configuration_spec.rb +1 -1
  83. data/spec/record/endpoint_inheritance_spec.rb +3 -3
  84. data/spec/record/endpoint_options_spec.rb +2 -2
  85. data/spec/record/endpoints_spec.rb +7 -7
  86. data/spec/record/equality_spec.rb +1 -1
  87. data/spec/record/expanded_spec.rb +1 -1
  88. data/spec/record/fetch_spec.rb +1 -1
  89. data/spec/record/find_by_chains_spec.rb +1 -1
  90. data/spec/record/find_by_spec.rb +2 -2
  91. data/spec/record/find_each_spec.rb +1 -1
  92. data/spec/record/find_in_batches_spec.rb +2 -2
  93. data/spec/record/find_in_parallel_spec.rb +2 -2
  94. data/spec/record/find_spec.rb +3 -3
  95. data/spec/record/first_spec.rb +2 -2
  96. data/spec/record/handle_includes_errors_spec.rb +1 -1
  97. data/spec/record/has_many_spec.rb +3 -3
  98. data/spec/record/ignore_errors_spec.rb +5 -14
  99. data/spec/record/immutable_chains_spec.rb +1 -1
  100. data/spec/record/includes_all_spec.rb +6 -6
  101. data/spec/record/includes_spec.rb +13 -13
  102. data/spec/record/includes_warning_spec.rb +1 -1
  103. data/spec/record/item_key_spec.rb +1 -1
  104. data/spec/record/items_created_key_configuration_spec.rb +1 -1
  105. data/spec/record/mapping_spec.rb +1 -1
  106. data/spec/record/model_name_spec.rb +1 -1
  107. data/spec/record/new_spec.rb +5 -5
  108. data/spec/record/options_spec.rb +5 -5
  109. data/spec/record/paginatable_collection_spec.rb +5 -6
  110. data/spec/record/pagination_chain_spec.rb +3 -3
  111. data/spec/record/pagination_links_spec.rb +1 -1
  112. data/spec/record/pagination_spec.rb +1 -1
  113. data/spec/record/persisted_spec.rb +2 -1
  114. data/spec/record/references_spec.rb +1 -1
  115. data/spec/record/reload_by_id_spec.rb +1 -1
  116. data/spec/record/reload_spec.rb +2 -2
  117. data/spec/record/request_spec.rb +3 -3
  118. data/spec/record/scope_chains_spec.rb +1 -1
  119. data/spec/record/to_hash_spec.rb +1 -1
  120. data/spec/record/to_json_spec.rb +1 -1
  121. data/spec/record/where_chains_spec.rb +3 -3
  122. data/spec/record/where_spec.rb +1 -1
  123. data/spec/record/where_values_hash_spec.rb +1 -1
  124. data/spec/request_cycle_cache/main_spec.rb +2 -1
  125. data/spec/require_lhs_spec.rb +1 -1
  126. data/spec/support/cleanup.rb +1 -1
  127. data/spec/support/request_cycle_cache.rb +1 -1
  128. data/spec/views/form_for_spec.rb +1 -1
  129. metadata +47 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2605f457afa3bd87e021820937032e07a5818c4
4
- data.tar.gz: eda107a74f9eae56ce91be8fc245896ddec4abd8
3
+ metadata.gz: 8010781e2fd91ba9ecac88aaf5894da86f1eeed4
4
+ data.tar.gz: c6d867261dd21b0092e028d2c575d35750eefd17
5
5
  SHA512:
6
- metadata.gz: cde3a3e444e3917500d2e96a499deb3ac10d1d27292b8eaf455e7a9325d352ee7b6fc9a4b227d28f18fd8c6385cb377607a77edb717e845b3a1689672c85cecf
7
- data.tar.gz: 12eeec0f97d72f5e451beb48727faa70b548b25297189a8b10a24644f80a5a491274a7c71b5d89d95eeb35d40b8cf084f0a7398e9c1b161a6f08ce6d95fb6008
6
+ metadata.gz: 22e05d07613f147ee2bf14955af07ea1f1f36307b7c0880c6d6e143514631f40f9fcddd2c7054ad0c72c6ed084c7260930e57123ff859f829f737dc53fc13113
7
+ data.tar.gz: 2fb6114404ce5fa4e089814bfd72c0b9283531c29b1aee6f04c9ced7f701a333de2db9311c514da621a0421de7e6fae9f591043b1619bfeed5e22a4ad3b1bf2b
data/.rubocop.localch.yml CHANGED
@@ -1,30 +1,41 @@
1
1
  # This is master rubocop configuration.
2
2
  # DO NOT EDIT THIS FILE - it WILL be overwriten on every config update
3
3
  AllCops:
4
- TargetRubyVersion: 2.1
4
+ TargetRubyVersion: 2.3
5
5
  DisplayCopNames: true
6
6
  DisplayStyleGuide: true
7
- Include:
8
- - '**/Rakefile'
9
- - '**/config.ru'
10
- - '**/Capfile'
11
7
  Exclude:
12
8
  - 'db/**/*'
13
9
  - 'script/**/*'
14
10
  - 'vendor/bundle/**/*'
11
+ - 'vendor/assets/**/*'
15
12
  - 'bin/**/*'
16
13
  - 'config/unicorn.rb'
17
14
  - 'config/compass.rb'
18
15
  - 'Rakefile'
19
- - 'Gemfile'
16
+ - 'app/controllers/error_trap_controller.rb'
17
+ - 'app/controllers/hsts_controller.rb'
18
+ - 'spec/lib/util_spec.rb'
20
19
 
21
20
  Rails:
22
21
  Enabled: true
23
22
 
23
+ require:
24
+ - rubocop-rspec
25
+
26
+ Bundler/OrderedGems:
27
+ Enabled: false
28
+
24
29
  Lint/HandleExceptions:
25
30
  Exclude:
26
31
  - spec/**/*
27
32
 
33
+ Lint/UriEscapeUnescape:
34
+ Enabled: false
35
+
36
+ Style/RescueStandardError:
37
+ Enabled: false
38
+
28
39
  Metrics/LineLength:
29
40
  Enabled: false
30
41
 
@@ -46,6 +57,9 @@ Metrics/ClassLength:
46
57
  Metrics/ModuleLength:
47
58
  Enabled: false
48
59
 
60
+ Metrics/BlockLength:
61
+ Enabled: false
62
+
49
63
  Metrics/ParameterLists:
50
64
  Enabled: false
51
65
 
@@ -70,9 +84,39 @@ Performance/RedundantMerge:
70
84
  Performance/Casecmp:
71
85
  Enabled: false
72
86
 
73
- Style/MultilineOperationIndentation:
87
+ Layout/MultilineOperationIndentation:
88
+ EnforcedStyle: indented
89
+
90
+ Layout/DotPosition:
91
+ EnforcedStyle: leading
92
+
93
+ Layout/AlignParameters:
94
+ Enabled: false
95
+
96
+ Layout/EmptyLinesAroundClassBody:
97
+ Enabled: false
98
+
99
+ Layout/IndentArray:
100
+ EnforcedStyle: consistent
101
+
102
+ Layout/MultilineMethodCallIndentation:
74
103
  EnforcedStyle: indented
75
104
 
105
+ Layout/MultilineMethodCallBraceLayout:
106
+ EnforcedStyle: symmetrical
107
+
108
+ Layout/EmptyLinesAroundBlockBody:
109
+ EnforcedStyle: no_empty_lines
110
+
111
+ Layout/IndentHeredoc:
112
+ Enabled: false
113
+
114
+ Layout/MultilineArrayBraceLayout:
115
+ EnforcedStyle: symmetrical
116
+
117
+ Layout/MultilineHashBraceLayout:
118
+ EnforcedStyle: symmetrical
119
+
76
120
  Style/StringLiterals:
77
121
  Enabled: false
78
122
 
@@ -80,21 +124,12 @@ Style/RegexpLiteral:
80
124
  Exclude:
81
125
  - spec/**/*
82
126
 
83
- Style/DotPosition:
84
- EnforcedStyle: leading
85
-
86
- Style/AlignParameters:
87
- Enabled: false
88
-
89
127
  Style/NumericLiterals:
90
128
  Enabled: false
91
129
 
92
130
  Style/WordArray:
93
131
  Enabled: false
94
132
 
95
- Style/EmptyLinesAroundClassBody:
96
- Enabled: false
97
-
98
133
  Style/Next:
99
134
  Enabled: false
100
135
 
@@ -153,7 +188,7 @@ Style/Documentation:
153
188
  Style/GuardClause:
154
189
  Enabled: false
155
190
 
156
- Style/AccessorMethodName:
191
+ Naming/AccessorMethodName:
157
192
  Exclude:
158
193
  - spec/support/pages/**/*
159
194
 
@@ -166,11 +201,50 @@ Style/MutableConstant:
166
201
  Style/ConditionalAssignment:
167
202
  Enabled: false
168
203
 
169
- Style/IndentArray:
170
- EnforcedStyle: consistent
204
+ Style/Lambda:
205
+ Enabled: false
171
206
 
172
- Style/MultilineMethodCallIndentation:
173
- EnforcedStyle: indented
207
+ Style/FrozenStringLiteralComment:
208
+ Enabled: false
209
+
210
+ Style/SymbolArray:
211
+ Enabled: false
212
+
213
+ Style/HashSyntax:
214
+ EnforcedStyle: ruby19
215
+
216
+ Style/FormatStringToken:
217
+ Enabled: false
218
+
219
+ Style/EmptyMethod:
220
+ EnforcedStyle: expanded
221
+
222
+ Style/TernaryParentheses:
223
+ EnforcedStyle: require_parentheses_when_complex
224
+
225
+ Naming/VariableNumber:
226
+ Enabled: false
227
+
228
+ Style/PerlBackrefs:
229
+ Enabled: false
230
+
231
+ Style/RegexpLiteral:
232
+ AllowInnerSlashes: false
233
+
234
+ Style/BlockComments:
235
+ Enabled: false
236
+
237
+ Style/RedundantParentheses:
238
+ Enabled: false
239
+
240
+ Naming/FileName:
241
+ Exclude:
242
+ - Gemfile
243
+ - Brewfile
244
+ - Guardfile
245
+
246
+ Style/NumericPredicate:
247
+ Enabled: false
174
248
 
175
249
  RSpec/DescribeClass:
176
250
  Exclude:
@@ -182,7 +256,70 @@ RSpec/DescribeClass:
182
256
  RSpec/FilePath:
183
257
  Enabled: false
184
258
 
259
+ RSpec/NamedSubject:
260
+ Enabled: false
261
+
262
+ RSpec/MultipleExpectations:
263
+ Enabled: false
264
+
265
+ RSpec/ExampleLength:
266
+ Enabled: false
267
+
268
+ RSpec/HookArgument:
269
+ EnforcedStyle: implicit
270
+
271
+ RSpec/MessageSpies:
272
+ EnforcedStyle: receive
273
+
274
+ RSpec/NestedGroups:
275
+ Enabled: false
276
+
277
+ RSpec/VerifiedDoubles:
278
+ Enabled: false
279
+
280
+ RSpec/LeadingSubject:
281
+ Enabled: false
282
+
283
+ RSpec/ExpectInHook:
284
+ Enabled: false
285
+
286
+ RSpec/ReturnFromStub:
287
+ Enabled: false
288
+
289
+ RSpec/SubjectStub:
290
+ Enabled: false
291
+
292
+ RSpec/EmptyLineAfterSubject:
293
+ Enabled: false
294
+
295
+ RSpec/LetSetup:
296
+ Enabled: false
297
+
298
+ RSpec/ImplicitExpect:
299
+ EnforcedStyle: is_expected
300
+
301
+ RSpec/ScatteredLet:
302
+ Enabled: false
303
+
304
+ RSpec/ContextWording:
305
+ Enabled: false
306
+
185
307
  Rails/Output:
186
308
  Exclude:
187
309
  - 'config/application.rb'
188
310
  - 'config/initializers/asset_manifest_warning.rb'
311
+
312
+ Rails/DynamicFindBy:
313
+ Enabled: false
314
+
315
+ Rails/Presence:
316
+ Enabled: false
317
+
318
+ Capybara/CurrentPathExpectation:
319
+ Enabled: false
320
+
321
+ Naming/UncommunicativeMethodParamName:
322
+ Enabled: false
323
+
324
+ Style/ExpandPathArguments:
325
+ Enabled: false
data/.rubocop.yml CHANGED
@@ -15,7 +15,10 @@ RSpec/DescribedClass:
15
15
  RSpec/AnyInstance:
16
16
  Enabled: false
17
17
 
18
- Style/MethodMissing:
18
+ Style/MethodMissingSuper:
19
+ Enabled: false
20
+
21
+ Style/MissingRespondToMissing:
19
22
  Enabled: false
20
23
 
21
24
  Rails/OutputSafety:
@@ -26,11 +29,11 @@ Style/SignalException:
26
29
 
27
30
  Rails/DynamicFindBy:
28
31
  Enabled: false
29
-
32
+
30
33
  Metrics/BlockLength:
31
34
  Enabled: false
32
35
 
33
- Style/EmptyLinesAroundBlockBody:
36
+ Layout/EmptyLinesAroundBlockBody:
34
37
  Enabled: false
35
38
 
36
39
  RSpec/MultipleExpectations:
@@ -38,3 +41,6 @@ RSpec/MultipleExpectations:
38
41
 
39
42
  Naming/PredicateName:
40
43
  Enabled: false
44
+
45
+ RSpec/MessageSpies:
46
+ Enabled: false
data/lhs.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  # Maintain your gem's version:
4
4
  require "lhs/version"
@@ -20,18 +20,19 @@ Gem::Specification.new do |s|
20
20
  s.requirements << 'Ruby >= 2.3.0'
21
21
  s.required_ruby_version = '>= 2.3.0'
22
22
 
23
- s.add_dependency 'lhc', '~> 9.2'
24
- s.add_dependency 'activesupport', '> 4.2'
25
23
  s.add_dependency 'activemodel'
24
+ s.add_dependency 'activesupport', '> 4.2'
25
+ s.add_dependency 'lhc', '~> 9.2'
26
26
 
27
- s.add_development_dependency 'rspec-rails', '>= 3.7.0'
28
- s.add_development_dependency 'rails', '>= 4.0.0'
29
- s.add_development_dependency 'webmock'
30
- s.add_development_dependency 'pry'
31
- s.add_development_dependency 'pry-byebug'
32
27
  s.add_development_dependency 'capybara'
33
- s.add_development_dependency 'rubocop', '~> 0.47.0'
34
28
  s.add_development_dependency 'json', '>= 1.8.2'
29
+ s.add_development_dependency 'pry'
30
+ s.add_development_dependency 'pry-byebug'
31
+ s.add_development_dependency 'rails', '>= 4.0.0'
32
+ s.add_development_dependency 'rspec-rails', '>= 3.7.0'
33
+ s.add_development_dependency 'rubocop', '~> 0.57.1'
34
+ s.add_development_dependency 'rubocop-rspec', '~> 1.26.0'
35
+ s.add_development_dependency 'webmock'
35
36
 
36
37
  s.license = 'GPL-3'
37
38
  end
data/lib/lhs/complex.rb CHANGED
@@ -91,7 +91,7 @@ class LHS::Complex
91
91
  end
92
92
 
93
93
  # add it to the array if there was no hash to merge it
94
- data.push(other) if !data.any? { |element| element.data.is_a?(Hash) }
94
+ data.push(other) if data.none? { |element| element.data.is_a?(Hash) }
95
95
  end
96
96
 
97
97
  def merge_into_hash!(other)
@@ -26,7 +26,7 @@ module AutoloadRecords
26
26
  end
27
27
 
28
28
  def self.require_records
29
- Dir.glob(Rails.root.join('app/models/**/*.rb')).each do |file|
29
+ Dir.glob(Rails.root.join('app', 'models', '**', '*.rb')).each do |file|
30
30
  require_dependency file if File.read(file).match('LHS::Record')
31
31
  end
32
32
  end
@@ -34,7 +34,7 @@ class LHS::Collection < LHS::Proxy
34
34
  # Takes configured items key to access collection of items
35
35
  # of falls back to the default key
36
36
  def items_key(record)
37
- record && record.items_key || LHS::Record.items_key
37
+ record&.items_key || LHS::Record.items_key
38
38
  end
39
39
  end
40
40
  end
@@ -30,7 +30,7 @@ module LHS
30
30
  current = self
31
31
  path = []
32
32
  _collect_parents_for_inspect!(path, current)
33
- return unless path.present?
33
+ return if path.blank?
34
34
  "> #{path.reverse.join(' > ')}"
35
35
  end
36
36
 
@@ -31,7 +31,7 @@ class LHS::Item < LHS::Proxy
31
31
  end
32
32
 
33
33
  def merge_validation_params!(endpoint)
34
- validates_params = endpoint.options[:validates].select { |key, _| key.to_sym != :path }
34
+ validates_params = endpoint.options[:validates].reject { |key, _| key.to_sym == :path }
35
35
  params = endpoint.options.fetch(:params, {}).merge(params_from_link)
36
36
  params = params.merge(validates_params) if validates_params.is_a?(Hash)
37
37
  params
@@ -52,7 +52,7 @@ class LHS::Item < LHS::Proxy
52
52
  def validation_endpoint
53
53
  endpoint = endpoint_from_link if _data.href # take embeded first
54
54
  endpoint ||= record.find_endpoint(_data._raw)
55
- validates = endpoint.options && endpoint.options.fetch(:validates, false)
55
+ validates = endpoint.options&.fetch(:validates, false)
56
56
  raise 'Endpoint does not support validations!' unless validates
57
57
  endpoint
58
58
  end
@@ -73,7 +73,7 @@ class LHS::Proxy
73
73
  def wrap_return(value, record, name, args = nil)
74
74
  name = args.first if name == :[]
75
75
  return value unless worth_wrapping?(value)
76
- data = value.is_a?(LHS::Data) || value.is_a?(LHS::Record) ? value : LHS::Data.new(value, _data)
76
+ data = (value.is_a?(LHS::Data) || value.is_a?(LHS::Record)) ? value : LHS::Data.new(value, _data)
77
77
  data.errors = LHS::Problems::Nested::Errors.new(errors, name) if errors.any?
78
78
  data.warnings = LHS::Problems::Nested::Warnings.new(warnings, name) if warnings.any?
79
79
  return record.new(data) if record && !value.is_a?(LHS::Record)
@@ -14,7 +14,7 @@ class LHS::Proxy
14
14
  end
15
15
 
16
16
  def errors
17
- response = _raw.present? && _raw.is_a?(Hash) && _raw[:field_errors] ? OpenStruct.new(body: _raw.to_json) : nil
17
+ response = (_raw.present? && _raw.is_a?(Hash) && _raw[:field_errors]) ? OpenStruct.new(body: _raw.to_json) : nil
18
18
  @errors ||= LHS::Problems::Errors.new(response, record)
19
19
  end
20
20
 
@@ -140,7 +140,7 @@ class LHS::Record
140
140
  attr_accessor :_links
141
141
 
142
142
  def self.unfold(args)
143
- args.size == 1 ? args[0] : args
143
+ (args.size == 1) ? args[0] : args
144
144
  end
145
145
 
146
146
  def initialize(record_class, link, record = nil)
@@ -71,8 +71,8 @@ class LHS::Record
71
71
  private
72
72
 
73
73
  def validates_deprecation_check!(options)
74
- return unless options.present?
75
- return unless options[:validates].present?
74
+ return if options.blank?
75
+ return if options[:validates].blank?
76
76
  return if options[:validates].is_a?(Hash)
77
77
  return if !options[:validates].is_a?(TrueClass) && options[:validates].match(%r{^\/})
78
78
  raise 'Validates with either true or a simple string is deprecated! See here: https://github.com/local-ch/lhs#validation'
@@ -11,7 +11,7 @@ class LHS::Record
11
11
  end
12
12
 
13
13
  def persisted?
14
- !href.blank?
14
+ href.present?
15
15
  end
16
16
 
17
17
  included do
@@ -54,7 +54,7 @@ class LHS::Record
54
54
  end
55
55
 
56
56
  def convert_options_to_endpoint(options)
57
- return unless options.present?
57
+ return if options.blank?
58
58
  url = options[:url]
59
59
  endpoint = LHS::Endpoint.for_url(url)
60
60
  return unless endpoint
@@ -70,7 +70,7 @@ class LHS::Record
70
70
  # and return them as a ruby hash
71
71
  def values_from_get_params(url, options)
72
72
  uri = parse_uri(url, options)
73
- return {} unless uri.query.present?
73
+ return {} if uri.query.blank?
74
74
  params = Rack::Utils.parse_nested_query(uri.query)
75
75
  params
76
76
  end
@@ -401,7 +401,7 @@ class LHS::Record
401
401
 
402
402
  def multiple_requests(options)
403
403
  options = options.map do |option|
404
- next unless option.present?
404
+ next if option.blank?
405
405
  process_options(option, find_endpoint(option[:params], option.fetch(:url, nil)))
406
406
  end
407
407
  data = LHC.request(options.compact).map do |response|
@@ -461,12 +461,12 @@ class LHS::Record
461
461
  ignored_errors = options[:ignored_errors]
462
462
  options = options.deep_dup
463
463
  options[:ignored_errors] = ignored_errors if ignored_errors.present?
464
- options[:params].deep_symbolize_keys! if options[:params]
464
+ options[:params]&.deep_symbolize_keys!
465
465
  options[:error_handler] = merge_error_handlers(options[:error_handler]) if options[:error_handler]
466
466
  options = (endpoint.options || {}).deep_merge(options)
467
467
  options[:url] = compute_url!(options[:params]) unless options.key?(:url)
468
468
  merge_explicit_params!(options[:params])
469
- options.delete(:params) if options[:params] && options[:params].empty?
469
+ options.delete(:params) if options[:params]&.empty?
470
470
  inject_request_cycle_cache!(options)
471
471
  options
472
472
  end