chimera_http_client 1.3.1 → 1.4.1

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: 0b68f9f3f76d137690c9f3fd9345b835efadee680ba8cd6b964095c554f9cb96
4
- data.tar.gz: 7a86650670f451558d407c04a9870f522cf6805413f256dfc453622c9c55263f
3
+ metadata.gz: d44d96daf4357f5f997f4874569c0f92bddeab9f945d5c950f8066d937c8d92b
4
+ data.tar.gz: 71eadaa902be940979f3fff031bddb78469beefafed2f605a19199ca54ce14f7
5
5
  SHA512:
6
- metadata.gz: 8a12bdf778c260bdfe95f529e7d94dbecf6b0d041f21da25a5f3503c185db8aaaa041d27d01b98767ddb98466e684c2fc266cab3e0bbaf8cb61b7353a8f37071
7
- data.tar.gz: 7da871e77ae5d29d207c5e6c4d95f3cdc831a15202cf7bf0a3f73ee44c8610ba1760189b542f86ff161b963640d448ac7a28fbeaa04845a1c8f462a28f13245c
6
+ metadata.gz: 7efe9e56feff54e326a568817cd2edde14ca7988188f67a150d6a4c507d0c87e6d4e08ab159102fdf91f6a86684acb18386cd9b433a63bc5b98e22a92b4e18d9
7
+ data.tar.gz: 97fa3cbea4100201f44264efccd9d5e574abbac20dcc36ef3cfdfd5b9aac16d993ba065b39fa56d2c6b31f9c1cbc2476ab58621bb0815aaa6343419e48c0dcff
data/.rubocop.yml CHANGED
@@ -1,11 +1,18 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
1
5
  AllCops:
2
- DisplayCopNames: true
3
6
  TargetRubyVersion: 2.5
7
+ DisplayCopNames: true
8
+ NewCops: enable # but feel free to disable them below
4
9
  Exclude:
5
10
  - vendor/**/*
6
11
  - config.ru
7
12
 
8
- # Cop supports --auto-correct.
13
+ Layout/EmptyLineBetweenDefs:
14
+ AllowAdjacentOneLineDefs: true
15
+
9
16
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
10
17
  # SupportedStyles: special_inside_parentheses, consistent, align_braces
11
18
  Layout/FirstHashElementIndentation:
@@ -20,6 +27,24 @@ Layout/LineLength:
20
27
  Metrics:
21
28
  Enabled: false
22
29
 
30
+ RSpec/ContextWording:
31
+ Enabled: false
32
+
33
+ RSpec/ExampleLength:
34
+ Max: 25
35
+
36
+ RSpec/MultipleExpectations:
37
+ Enabled: false
38
+
39
+ RSpec/MultipleMemoizedHelpers:
40
+ Enabled: false
41
+
42
+ RSpec/NestedGroups:
43
+ Max: 4
44
+
45
+ Style/CaseLikeIf:
46
+ Enabled: false
47
+
23
48
  Style/CommentedKeyword:
24
49
  Enabled: false
25
50
 
@@ -28,7 +53,6 @@ Style/Documentation:
28
53
 
29
54
  Style/DoubleNegation:
30
55
  Enabled: true
31
-
32
56
  Style/FrozenStringLiteralComment:
33
57
  Enabled: false
34
58
 
@@ -44,11 +68,22 @@ Style/StringLiterals:
44
68
  - single_quotes
45
69
  - double_quotes
46
70
 
47
- # Cop supports --auto-correct.
48
71
  Style/NumericLiterals:
49
72
  MinDigits: 15
50
73
 
51
- # Cop supports --auto-correct.
74
+ Style/PercentLiteralDelimiters:
75
+ PreferredDelimiters:
76
+ default: ()
77
+ "%": ()
78
+ "%i": ()
79
+ "%q": ()
80
+ "%Q": ()
81
+ "%r": "{}"
82
+ "%s": ()
83
+ "%w": ()
84
+ "%W": ()
85
+ "%x": ()
86
+
52
87
  # Configuration parameters: AllowAsExpressionSeparator.
53
88
  Style/Semicolon:
54
89
  AllowAsExpressionSeparator: true
@@ -56,7 +91,6 @@ Style/Semicolon:
56
91
  Style/SymbolProc:
57
92
  Enabled: false
58
93
 
59
- # Cop supports --auto-correct.
60
94
  # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
61
95
  # SupportedStyles: comma, consistent_comma, no_comma
62
96
  Style/TrailingCommaInArrayLiteral:
@@ -65,7 +99,6 @@ Style/TrailingCommaInArrayLiteral:
65
99
  Style/TrailingCommaInHashLiteral:
66
100
  EnforcedStyleForMultiline: comma
67
101
 
68
- # Cop supports --auto-correct.
69
102
  # Configuration parameters: SupportedStyles, MinSize, WordRegex.
70
103
  # SupportedStyles: percent, brackets
71
104
  Style/WordArray:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.0.1
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - ruby-head
4
+ - 3.0
5
+ - 2.7
5
6
  - 2.6
6
7
  - 2.5
7
8
  - jruby
@@ -16,10 +17,10 @@ matrix:
16
17
  before_install:
17
18
  - 'echo ''gem: --no-ri --no-rdoc'' > ~/.gemrc'
18
19
 
19
- bundler_args: --jobs 3 --retry 3
20
+ bundler_args: --jobs 4 --retry 4
20
21
 
21
22
  before_script:
22
23
 
23
24
  # execute rspec tests, rubocop and bundle:audit
24
25
  script:
25
- bundle exec rake
26
+ bundle exec rake ci
data/README.markdown CHANGED
@@ -17,13 +17,14 @@ The only other runtime dependency is Ruby's latest code loader [**zeitwerk**](ht
17
17
 
18
18
  ### Ruby version
19
19
 
20
- | Chimera version | Ruby version |
21
- |:----------------|:-------------|
22
- | >= 1.1 | >= 2.5 |
23
- | = 1.0 | >= 2.4 |
24
- | <= 0.5 | >= 2.1 |
25
-
26
- The test suite of v1.3 and newer also passes on **JRuby** and on **TruffleRuby**.
20
+ | Chimera version | Ruby version |
21
+ |:----------------|:-----------------------------------|
22
+ | >= 1.4 | >= 2.5 (3.0 compatibility ensured) |
23
+ | >= 1.1 | >= 2.5 |
24
+ | = 1.0 | >= 2.4, <= 3.0 |
25
+ | <= 0.5 | >= 2.1, <= 3.0 |
26
+
27
+ The test suite of v1.4 passes on **MRI Ruby** (2.5, 2.6, 2.7, 3.0) and on **JRuby**, but not on **TruffleRuby**.
27
28
 
28
29
  ### ENV variables
29
30
 
data/Rakefile CHANGED
@@ -1,17 +1,23 @@
1
1
  require "bundler/audit/task"
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
+ require "rubocop/rake_task"
4
5
 
6
+ # setup task bundle:audit
5
7
  Bundler::Audit::Task.new
6
8
 
9
+ # setup taks rspec
7
10
  RSpec::Core::RakeTask.new(:rspec) do |t|
8
11
  # t.exclude_pattern = "**/server/*_spec.rb" # skip real http server specs
9
12
  # t.exclude_pattern = "**/stubbed/*_spec.rb" # skip the stubbed Typhoeus specs
10
13
  end
11
14
 
15
+ # setup taks rubocop and rubocop:auto_correct
16
+ RuboCop::RakeTask.new
17
+
12
18
  desc "Open a console with the ChimeraHttpClient loaded"
13
19
  task :console do
14
- puts "Console with the gem and awesome_print loaded:"
20
+ puts "Console with the gem and amazing_print loaded:"
15
21
  ARGV.clear
16
22
  require "irb"
17
23
  require "ap"
@@ -19,15 +25,7 @@ task :console do
19
25
  IRB.start
20
26
  end
21
27
 
22
- desc "Run Rubocop"
23
- task :rubocop do
24
- system "bundle exec rubocop -c .rubocop.yml"
25
- end
26
-
27
- desc "Run Rubocop and auto-correct issues"
28
- task :rubocopa do
29
- system "bundle exec rubocop -c .rubocop.yml -a"
30
- end
28
+ desc "Run rubocop and the specs and check for known CVEs"
29
+ task ci: %i(rubocop rspec bundle:audit)
31
30
 
32
- desc "Run all the tests"
33
- task default: %i[rspec rubocop bundle:audit]
31
+ task default: :ci
@@ -32,14 +32,15 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency "zeitwerk", ">= 2.0"
33
33
 
34
34
  # general development and test dependencies
35
- spec.add_development_dependency "awesome_print", "~> 1.8"
35
+ spec.add_development_dependency "amazing_print", ">= 1.2"
36
36
  spec.add_development_dependency "bundler", ">= 1.0"
37
- spec.add_development_dependency "bundler-audit", "~> 0.6"
38
- spec.add_development_dependency "irb", "~> 1.0"
37
+ spec.add_development_dependency "bundler-audit", ">= 0.6"
38
+ spec.add_development_dependency "irb", ">= 1.0"
39
39
  spec.add_development_dependency "rake", ">= 10.0"
40
40
  spec.add_development_dependency "rspec", "~> 3.0"
41
- spec.add_development_dependency "rubocop", "~> 0.50"
42
- spec.add_development_dependency "rubocop-rspec", "~> 1.4"
41
+ spec.add_development_dependency "rubocop", "~> 1.12"
42
+ spec.add_development_dependency "rubocop-rake", "~> 0.5"
43
+ spec.add_development_dependency "rubocop-rspec", "~> 2.2"
43
44
 
44
45
  # only for server specs with real HTTP requests
45
46
  spec.add_development_dependency "capybara", "~> 3.0"
@@ -47,4 +48,5 @@ Gem::Specification.new do |spec|
47
48
  spec.add_development_dependency "sinatra", "~> 2.0"
48
49
  spec.add_development_dependency "sinatra-contrib", "~> 2.0"
49
50
  spec.add_development_dependency "webmock", "~> 3.0"
51
+ spec.add_development_dependency "webrick"
50
52
  end
@@ -7,5 +7,5 @@ module ChimeraHttpClient
7
7
  loader.setup
8
8
 
9
9
  # as Zeitwerk can't handle innner classes properly :-/
10
- require_relative "./chimera_http_client/error.rb"
10
+ require_relative "./chimera_http_client/error"
11
11
  end
@@ -56,7 +56,7 @@ module ChimeraHttpClient
56
56
 
57
57
  # Remove leading and trailing "/" from a give part of a String (usually URL or endpoint)
58
58
  def trim(element)
59
- element.to_s.sub(%r{^\/}, "").chomp("/")
59
+ element.to_s.sub(%r{^/}, "").chomp("/")
60
60
  end
61
61
  end
62
62
  end
@@ -23,7 +23,7 @@ module ChimeraHttpClient
23
23
  private
24
24
 
25
25
  def run(method, endpoint, options = {})
26
- options[:body_optional] = true if %i[get delete head options trace].include?(method)
26
+ options[:body_optional] = true if %i(get delete head options trace).include?(method)
27
27
  body = extract_body(options)
28
28
  headers = extract_headers(options, default_headers)
29
29
 
@@ -37,7 +37,7 @@ module ChimeraHttpClient
37
37
  # end
38
38
  #
39
39
  def define_http_methods
40
- %i[get post put patch delete head options trace].each do |method_name|
40
+ %i(get post put patch delete head options trace).each do |method_name|
41
41
  self.class.send(:define_method, method_name) do |endpoint, options = {}|
42
42
  send(:run, method_name, endpoint, options)
43
43
  end
@@ -10,6 +10,8 @@ module ChimeraHttpClient
10
10
  @response = response # contains the request
11
11
 
12
12
  @deserializer = options[:deserializer][:error]
13
+
14
+ super(response.body)
13
15
  end
14
16
 
15
17
  def error?
@@ -2,7 +2,7 @@ module ChimeraHttpClient
2
2
  class Queue < Base
3
3
  def add(method, endpoint, options = {})
4
4
  http_method = method.downcase.to_sym
5
- options[:body_optional] = true if %i[get delete head options trace].include?(http_method)
5
+ options[:body_optional] = true if %i(get delete head options trace).include?(http_method)
6
6
 
7
7
  queued_requests << create_request(
8
8
  method: http_method,
@@ -1,3 +1,3 @@
1
1
  module ChimeraHttpClient
2
- VERSION = "1.3.1".freeze
2
+ VERSION = "1.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chimera_http_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Finger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: awesome_print
42
+ name: amazing_print
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.8'
47
+ version: '1.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.8'
54
+ version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,28 +70,28 @@ dependencies:
70
70
  name: bundler-audit
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.6'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.6'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: irb
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.0'
97
97
  - !ruby/object:Gem::Dependency
@@ -128,28 +128,42 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.50'
131
+ version: '1.12'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.12'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.5'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0.50'
152
+ version: '0.5'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-rspec
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '1.4'
159
+ version: '2.2'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '1.4'
166
+ version: '2.2'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: capybara
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +234,20 @@ dependencies:
220
234
  - - "~>"
221
235
  - !ruby/object:Gem::Version
222
236
  version: '3.0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: webrick
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
223
251
  description: |
224
252
  The Chimera http client offers an easy to learn interface and consistent error handling.
225
253
  It is lightweight, fast and enables you to queue HTTP requests to run them in parallel
@@ -271,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
299
  - !ruby/object:Gem::Version
272
300
  version: '0'
273
301
  requirements: []
274
- rubygems_version: 3.1.4
302
+ rubygems_version: 3.2.15
275
303
  signing_key:
276
304
  specification_version: 4
277
305
  summary: General http client functionality to quickly connect to JSON REST API endpoints