lhc 13.0.0 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +15 -0
- data/.github/workflows/test.yml +15 -0
- data/.rubocop.yml +344 -19
- data/.ruby-version +1 -1
- data/README.md +44 -0
- data/Rakefile +3 -3
- data/lhc.gemspec +3 -1
- data/lib/lhc.rb +59 -59
- data/lib/lhc/concerns/lhc/fix_invalid_encoding_concern.rb +1 -0
- data/lib/lhc/config.rb +3 -0
- data/lib/lhc/endpoint.rb +3 -0
- data/lib/lhc/error.rb +5 -1
- data/lib/lhc/interceptor.rb +4 -0
- data/lib/lhc/interceptors.rb +1 -0
- data/lib/lhc/interceptors/auth.rb +3 -4
- data/lib/lhc/interceptors/caching.rb +14 -3
- data/lib/lhc/interceptors/logging.rb +2 -0
- data/lib/lhc/interceptors/monitoring.rb +46 -11
- data/lib/lhc/interceptors/retry.rb +2 -0
- data/lib/lhc/interceptors/rollbar.rb +1 -0
- data/lib/lhc/interceptors/throttle.rb +7 -2
- data/lib/lhc/interceptors/zipkin.rb +2 -0
- data/lib/lhc/request.rb +13 -3
- data/lib/lhc/response.rb +1 -0
- data/lib/lhc/response/data.rb +1 -1
- data/lib/lhc/version.rb +1 -1
- data/spec/error/to_s_spec.rb +7 -2
- data/spec/formats/multipart_spec.rb +2 -2
- data/spec/formats/plain_spec.rb +1 -1
- data/spec/interceptors/after_response_spec.rb +1 -1
- data/spec/interceptors/caching/main_spec.rb +2 -2
- data/spec/interceptors/caching/multilevel_cache_spec.rb +2 -1
- data/spec/interceptors/define_spec.rb +1 -0
- data/spec/interceptors/monitoring/caching_spec.rb +66 -0
- data/spec/interceptors/response_competition_spec.rb +2 -2
- data/spec/interceptors/return_response_spec.rb +2 -2
- data/spec/response/data_spec.rb +2 -2
- data/spec/support/zipkin_mock.rb +1 -0
- metadata +27 -21
- data/.rubocop.localch.yml +0 -325
- data/cider-ci.yml +0 -5
- data/cider-ci/bin/bundle +0 -51
- data/cider-ci/bin/ruby_install +0 -8
- data/cider-ci/bin/ruby_version +0 -25
- data/cider-ci/jobs/rspec-activesupport-5.yml +0 -27
- data/cider-ci/jobs/rspec-activesupport-6.yml +0 -28
- data/cider-ci/jobs/rubocop.yml +0 -18
- data/cider-ci/task_components/bundle.yml +0 -22
- data/cider-ci/task_components/rspec.yml +0 -36
- data/cider-ci/task_components/rubocop.yml +0 -29
- data/cider-ci/task_components/ruby.yml +0 -15
@@ -12,7 +12,7 @@ describe LHC do
|
|
12
12
|
|
13
13
|
def before_request
|
14
14
|
if @@cached
|
15
|
-
return LHC::Response.new(Typhoeus::Response.new(response_body: 'Im served from local cache'), nil)
|
15
|
+
return LHC::Response.new(Typhoeus::Response.new(response_code: 200, return_code: :ok, response_body: 'Im served from local cache'), nil)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -22,7 +22,7 @@ describe LHC do
|
|
22
22
|
|
23
23
|
def before_request
|
24
24
|
if request.response.nil?
|
25
|
-
return LHC::Response.new(Typhoeus::Response.new(response_body: 'Im served from remote cache'), nil)
|
25
|
+
return LHC::Response.new(Typhoeus::Response.new(response_code: 200, return_code: :ok, response_body: 'Im served from remote cache'), nil)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -8,7 +8,7 @@ describe LHC do
|
|
8
8
|
class CacheInterceptor < LHC::Interceptor
|
9
9
|
|
10
10
|
def before_request
|
11
|
-
LHC::Response.new(Typhoeus::Response.new(response_body: 'Im served from cache'), nil)
|
11
|
+
LHC::Response.new(Typhoeus::Response.new(response_code: 200, return_code: :ok, response_body: 'Im served from cache'), nil)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
LHC.configure { |c| c.interceptors = [CacheInterceptor] }
|
@@ -23,7 +23,7 @@ describe LHC do
|
|
23
23
|
before(:each) do
|
24
24
|
class AnotherInterceptor < LHC::Interceptor
|
25
25
|
def before_request
|
26
|
-
LHC::Response.new(Typhoeus::Response.new(
|
26
|
+
LHC::Response.new(Typhoeus::Response.new(response_code: 200, return_code: :ok), nil)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/spec/response/data_spec.rb
CHANGED
@@ -75,9 +75,9 @@ describe LHC::Response do
|
|
75
75
|
it 'does not throw a stack level to deep issue when accessing data in a rescue context' do
|
76
76
|
begin
|
77
77
|
LHC.get('http://listings')
|
78
|
-
rescue LHC::Error =>
|
78
|
+
rescue LHC::Error => e
|
79
79
|
expect(
|
80
|
-
|
80
|
+
e.response.request.response.data.meta.errors.detect { |item| item.code == 2000 }.msg
|
81
81
|
).to eq 'I like to hide error messages (this is meta).'
|
82
82
|
end
|
83
83
|
end
|
data/spec/support/zipkin_mock.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 14.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhc/contributors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -142,14 +142,28 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0
|
145
|
+
version: '1.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0
|
152
|
+
version: '1.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-performance
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: rubocop-rspec
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,8 +216,9 @@ executables: []
|
|
202
216
|
extensions: []
|
203
217
|
extra_rdoc_files: []
|
204
218
|
files:
|
219
|
+
- ".github/workflows/rubocop.yml"
|
220
|
+
- ".github/workflows/test.yml"
|
205
221
|
- ".gitignore"
|
206
|
-
- ".rubocop.localch.yml"
|
207
222
|
- ".rubocop.yml"
|
208
223
|
- ".ruby-version"
|
209
224
|
- Gemfile
|
@@ -212,17 +227,6 @@ files:
|
|
212
227
|
- LICENSE
|
213
228
|
- README.md
|
214
229
|
- Rakefile
|
215
|
-
- cider-ci.yml
|
216
|
-
- cider-ci/bin/bundle
|
217
|
-
- cider-ci/bin/ruby_install
|
218
|
-
- cider-ci/bin/ruby_version
|
219
|
-
- cider-ci/jobs/rspec-activesupport-5.yml
|
220
|
-
- cider-ci/jobs/rspec-activesupport-6.yml
|
221
|
-
- cider-ci/jobs/rubocop.yml
|
222
|
-
- cider-ci/task_components/bundle.yml
|
223
|
-
- cider-ci/task_components/rspec.yml
|
224
|
-
- cider-ci/task_components/rubocop.yml
|
225
|
-
- cider-ci/task_components/ruby.yml
|
226
230
|
- friday.yml
|
227
231
|
- lhc.gemspec
|
228
232
|
- lib/core_ext/hash/deep_transform_values.rb
|
@@ -357,6 +361,7 @@ files:
|
|
357
361
|
- spec/interceptors/define_spec.rb
|
358
362
|
- spec/interceptors/dup_spec.rb
|
359
363
|
- spec/interceptors/logging/main_spec.rb
|
364
|
+
- spec/interceptors/monitoring/caching_spec.rb
|
360
365
|
- spec/interceptors/monitoring/main_spec.rb
|
361
366
|
- spec/interceptors/prometheus_spec.rb
|
362
367
|
- spec/interceptors/response_competition_spec.rb
|
@@ -402,7 +407,7 @@ homepage: https://github.com/local-ch/lhc
|
|
402
407
|
licenses:
|
403
408
|
- GPL-3.0
|
404
409
|
metadata: {}
|
405
|
-
post_install_message:
|
410
|
+
post_install_message:
|
406
411
|
rdoc_options: []
|
407
412
|
require_paths:
|
408
413
|
- lib
|
@@ -410,7 +415,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
410
415
|
requirements:
|
411
416
|
- - ">="
|
412
417
|
- !ruby/object:Gem::Version
|
413
|
-
version: '
|
418
|
+
version: '2.7'
|
414
419
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
415
420
|
requirements:
|
416
421
|
- - ">="
|
@@ -418,8 +423,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
423
|
version: '0'
|
419
424
|
requirements:
|
420
425
|
- Ruby >= 2.0.0
|
421
|
-
rubygems_version: 3.
|
422
|
-
signing_key:
|
426
|
+
rubygems_version: 3.1.4
|
427
|
+
signing_key:
|
423
428
|
specification_version: 4
|
424
429
|
summary: Advanced HTTP Client for Ruby, fueled with interceptors
|
425
430
|
test_files:
|
@@ -511,6 +516,7 @@ test_files:
|
|
511
516
|
- spec/interceptors/define_spec.rb
|
512
517
|
- spec/interceptors/dup_spec.rb
|
513
518
|
- spec/interceptors/logging/main_spec.rb
|
519
|
+
- spec/interceptors/monitoring/caching_spec.rb
|
514
520
|
- spec/interceptors/monitoring/main_spec.rb
|
515
521
|
- spec/interceptors/prometheus_spec.rb
|
516
522
|
- spec/interceptors/response_competition_spec.rb
|
data/.rubocop.localch.yml
DELETED
@@ -1,325 +0,0 @@
|
|
1
|
-
# This is master rubocop configuration.
|
2
|
-
# DO NOT EDIT THIS FILE - it WILL be overwriten on every config update
|
3
|
-
AllCops:
|
4
|
-
TargetRubyVersion: 2.3
|
5
|
-
DisplayCopNames: true
|
6
|
-
DisplayStyleGuide: true
|
7
|
-
Exclude:
|
8
|
-
- 'db/**/*'
|
9
|
-
- 'script/**/*'
|
10
|
-
- 'vendor/bundle/**/*'
|
11
|
-
- 'vendor/assets/**/*'
|
12
|
-
- 'bin/**/*'
|
13
|
-
- 'config/unicorn.rb'
|
14
|
-
- 'config/compass.rb'
|
15
|
-
- 'Rakefile'
|
16
|
-
- 'app/controllers/error_trap_controller.rb'
|
17
|
-
- 'app/controllers/hsts_controller.rb'
|
18
|
-
- 'spec/lib/util_spec.rb'
|
19
|
-
|
20
|
-
Rails:
|
21
|
-
Enabled: true
|
22
|
-
|
23
|
-
require:
|
24
|
-
- rubocop-rspec
|
25
|
-
|
26
|
-
Bundler/OrderedGems:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Lint/HandleExceptions:
|
30
|
-
Exclude:
|
31
|
-
- spec/**/*
|
32
|
-
|
33
|
-
Lint/UriEscapeUnescape:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Style/RescueStandardError:
|
37
|
-
Enabled: false
|
38
|
-
|
39
|
-
Metrics/LineLength:
|
40
|
-
Enabled: false
|
41
|
-
|
42
|
-
Metrics/AbcSize:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Metrics/MethodLength:
|
46
|
-
Enabled: false
|
47
|
-
|
48
|
-
Metrics/CyclomaticComplexity:
|
49
|
-
Enabled: false
|
50
|
-
|
51
|
-
Metrics/PerceivedComplexity:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Metrics/ClassLength:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
Metrics/ModuleLength:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
Metrics/BlockLength:
|
61
|
-
Enabled: false
|
62
|
-
|
63
|
-
Metrics/ParameterLists:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
Metrics/BlockNesting:
|
67
|
-
Enabled: false
|
68
|
-
|
69
|
-
Performance/StringReplacement:
|
70
|
-
Enabled: false
|
71
|
-
|
72
|
-
Performance/TimesMap:
|
73
|
-
Enabled: false
|
74
|
-
|
75
|
-
Performance/RedundantBlockCall:
|
76
|
-
Enabled: false
|
77
|
-
|
78
|
-
Performance/RedundantMatch:
|
79
|
-
Enabled: false
|
80
|
-
|
81
|
-
Performance/RedundantMerge:
|
82
|
-
Enabled: false
|
83
|
-
|
84
|
-
Performance/Casecmp:
|
85
|
-
Enabled: false
|
86
|
-
|
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:
|
103
|
-
EnforcedStyle: indented
|
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
|
-
|
120
|
-
Style/StringLiterals:
|
121
|
-
Enabled: false
|
122
|
-
|
123
|
-
Style/RegexpLiteral:
|
124
|
-
Exclude:
|
125
|
-
- spec/**/*
|
126
|
-
|
127
|
-
Style/NumericLiterals:
|
128
|
-
Enabled: false
|
129
|
-
|
130
|
-
Style/WordArray:
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
Style/Next:
|
134
|
-
Enabled: false
|
135
|
-
|
136
|
-
Style/PercentLiteralDelimiters:
|
137
|
-
Enabled: false
|
138
|
-
|
139
|
-
Style/GlobalVars:
|
140
|
-
Enabled: false
|
141
|
-
|
142
|
-
Style/CommentAnnotation:
|
143
|
-
Enabled: false
|
144
|
-
|
145
|
-
Style/SymbolProc:
|
146
|
-
Enabled: false
|
147
|
-
|
148
|
-
Style/DoubleNegation:
|
149
|
-
Enabled: false
|
150
|
-
|
151
|
-
Style/FormatString:
|
152
|
-
Enabled: false
|
153
|
-
|
154
|
-
Style/AsciiComments:
|
155
|
-
Enabled: false
|
156
|
-
|
157
|
-
Style/BarePercentLiterals:
|
158
|
-
Enabled: false
|
159
|
-
|
160
|
-
Style/SingleLineBlockParams:
|
161
|
-
Enabled: false
|
162
|
-
|
163
|
-
Style/MultilineBlockChain:
|
164
|
-
Enabled: false
|
165
|
-
|
166
|
-
Style/UnneededCapitalW:
|
167
|
-
Enabled: false
|
168
|
-
|
169
|
-
Style/UnneededPercentQ:
|
170
|
-
Enabled: false
|
171
|
-
|
172
|
-
Style/BlockDelimiters:
|
173
|
-
Exclude:
|
174
|
-
- spec/**/*
|
175
|
-
|
176
|
-
Style/BracesAroundHashParameters:
|
177
|
-
EnforcedStyle: context_dependent
|
178
|
-
|
179
|
-
Style/IfUnlessModifier:
|
180
|
-
Enabled: false
|
181
|
-
|
182
|
-
Style/ClassAndModuleChildren:
|
183
|
-
Enabled: false
|
184
|
-
|
185
|
-
Style/Documentation:
|
186
|
-
Enabled: false
|
187
|
-
|
188
|
-
Style/GuardClause:
|
189
|
-
Enabled: false
|
190
|
-
|
191
|
-
Naming/AccessorMethodName:
|
192
|
-
Exclude:
|
193
|
-
- spec/support/pages/**/*
|
194
|
-
|
195
|
-
Style/NegatedIf:
|
196
|
-
Enabled: false
|
197
|
-
|
198
|
-
Style/MutableConstant:
|
199
|
-
Enabled: false
|
200
|
-
|
201
|
-
Style/ConditionalAssignment:
|
202
|
-
Enabled: false
|
203
|
-
|
204
|
-
Style/Lambda:
|
205
|
-
Enabled: false
|
206
|
-
|
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
|
248
|
-
|
249
|
-
RSpec/DescribeClass:
|
250
|
-
Exclude:
|
251
|
-
- spec/views/**/*
|
252
|
-
- spec/routing/**/*
|
253
|
-
- spec/requests/**/*
|
254
|
-
- spec/features/**/*
|
255
|
-
|
256
|
-
RSpec/FilePath:
|
257
|
-
Enabled: false
|
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
|
-
|
307
|
-
Rails/Output:
|
308
|
-
Exclude:
|
309
|
-
- 'config/application.rb'
|
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
|