net_http_timeout_errors 0.3.2 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,17 +1,7 @@
1
1
  ---
2
- !binary "U0hBMjU2":
3
- metadata.gz: !binary |-
4
- ZGVmZWUzMjkxM2NkOTc4ZjUxZDMxNzA3MTgyNmE2NWJjZDY0Yjg3ZDBlYjZm
5
- MTNkNGMwYjhjOGY1ZjlhODA3MA==
6
- data.tar.gz: !binary |-
7
- YmYwMTJmMmUzZjEwY2VlNzlhY2E2M2ZmODI2N2U5ZjMzYzdiODM5YWJjOTA5
8
- YzEwZjNkODNiZGRhMTE5ZDNlZA==
2
+ SHA256:
3
+ metadata.gz: 943e742b7f7430cfd585b1457eae1f8b28708079e1a0067cf51c443f41fc6ca3
4
+ data.tar.gz: 4df52a53c4f55a55b89a7333993ae3beb6f0d5d34c739ffc54939399838b6089
9
5
  SHA512:
10
- metadata.gz: !binary |-
11
- NzRjNDUzZWQ1NWE3YTNiZjc5MDFkYmUzNTJmNmE5Yjc5NjNiNTk2NDVjNGJm
12
- NzM5MTY0YWFmOGY3M2IwYWUwZGU5NzJiNTYyMWE1NDVlNzA3MDhmM2EzYWFj
13
- ZDVhODljYjNkMjlhMWViMmI1ZDY2MzljOGIyZTlhMmVkMmVmZDY=
14
- data.tar.gz: !binary |-
15
- MzgyOTRhNjgyN2JiMGMxNTcwNmY3YWQwM2VkNzQwYzJjMzVlM2EzYjNhODli
16
- ZGIxZjNjZjAxNzU3ZDQ4MWNmNmM2YTI0YWZmZjA2YWYyYTY5OGY5Mzk3ZGMw
17
- MjQwZWI0NzYyYjdhZWU1YjYyZmJiNDRhMTk2YjFjNGFiMDFkOTQ=
6
+ metadata.gz: e6b0d0b56a9b844b4b099e7473a55ea866244bbcd3a55bd680f490d9e5b968a148a8ade64b4f23af306f20c21c790be321659dd4955258a5579d079ead8a1e80
7
+ data.tar.gz: 88b0ccf3caa8c6ba069b48b57662032bcf34e6e0fa35c96300092eb473e5659378cf904cb376249fa748ede611fd8766c6e5723254834515b2e3e5ff013da11d
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ["3.0", "2.7", "2.6"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby ${{ matrix.ruby-version }}
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25
+ - name: Run tests
26
+ run: bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "tmp/**/*"
4
+ inherit_gem:
5
+ barsoom_utils: shared_rubocop.yml
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0
4
+
5
+ * Added `Errno::ECONNABORTED`.
6
+
7
+ ## 0.3.5 and earlier
8
+
9
+ * See Git history.
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in net_http_timeout_errors.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem "barsoom_utils", github: "barsoom/barsoom_utils"
8
+ gem "rubocop"
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 [Barsoom AB](http://barsoom.se)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,30 +1,30 @@
1
1
  # NetHttpTimeoutErrors
2
2
 
3
- Tired of having to rescue an ever-growing list of Net::HTTP timeout error types?
3
+ Whether you use Net::HTTP or some higher abstraction like HTTParty, are you tired of having to rescue an ever-growing list of Net::HTTP timeout error types?
4
4
 
5
5
  Just load this gem and then do:
6
6
 
7
7
  ``` ruby
8
8
  begin
9
- NetHttpTimeoutErrors.conflate do
10
- uri = URI.parse("http://google.com/")
11
- response = Net::HTTP.get_response(uri)
12
- end
13
- rescue NetHttpTimeoutError
9
+ uri = URI.parse("http://google.com/")
10
+ response = Net::HTTP.get_response(uri)
11
+ rescue *NetHttpTimeoutErrors.all
14
12
  puts "It timed out some way or other!"
13
+ rescue AnotherError, *NetHttpTimeoutErrors.all
14
+ puts "This works too."
15
15
  end
16
16
  ```
17
17
 
18
- Or if you like:
18
+ Or if you prefer:
19
19
 
20
20
  ``` ruby
21
21
  begin
22
- uri = URI.parse("http://google.com/")
23
- response = Net::HTTP.get_response(uri)
24
- rescue *NetHttpTimeoutErrors.all
22
+ NetHttpTimeoutErrors.conflate do
23
+ uri = URI.parse("http://google.com/")
24
+ response = Net::HTTP.get_response(uri)
25
+ end
26
+ rescue NetHttpTimeoutError
25
27
  puts "It timed out some way or other!"
26
- rescue AnotherError, *NetHttpTimeoutErrors.all
27
- puts "This works too."
28
28
  end
29
29
  ```
30
30
 
@@ -56,25 +56,4 @@ You may prefer about *this* library that it very explicitly raises a single exce
56
56
 
57
57
  ## License
58
58
 
59
- Copyright (c) 2012 [Barsoom AB](http://barsoom.se)
60
-
61
- MIT License
62
-
63
- Permission is hereby granted, free of charge, to any person obtaining
64
- a copy of this software and associated documentation files (the
65
- "Software"), to deal in the Software without restriction, including
66
- without limitation the rights to use, copy, modify, merge, publish,
67
- distribute, sublicense, and/or sell copies of the Software, and to
68
- permit persons to whom the Software is furnished to do so, subject to
69
- the following conditions:
70
-
71
- The above copyright notice and this permission notice shall be
72
- included in all copies or substantial portions of the Software.
73
-
74
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
75
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
76
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
77
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
78
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
79
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
80
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -6,4 +6,4 @@ Rake::TestTask.new do |t|
6
6
  t.pattern = "spec/*_spec.rb"
7
7
  end
8
8
 
9
- task :default => :test
9
+ task default: :test
@@ -1,3 +1,3 @@
1
1
  class NetHttpTimeoutErrors
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -11,10 +11,13 @@ end
11
11
 
12
12
  class NetHttpTimeoutErrors
13
13
  def self.all
14
+ # Based on the errors listed in https://ruby-doc.org/stdlib-2.7.1/libdoc/net/http/rdoc/Net/HTTP.html#method-i-max_retries-3D.
14
15
  [
16
+ Net::ReadTimeout,
15
17
  EOFError,
16
- Errno::ECONNREFUSED,
17
18
  Errno::ECONNRESET,
19
+ Errno::ECONNABORTED,
20
+ Errno::ECONNREFUSED,
18
21
  Errno::EHOSTUNREACH,
19
22
  Errno::EINVAL,
20
23
  Errno::ENETUNREACH,
@@ -1,20 +1,19 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/net_http_timeout_errors/version', __FILE__)
2
+ require File.expand_path("../lib/net_http_timeout_errors/version", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Henrik Nyh"]
6
- gem.email = ["henrik@nyh.se"]
5
+ gem.authors = [ "Henrik Nyh" ]
6
+ gem.email = [ "henrik@nyh.se" ]
7
7
  gem.summary = %q{Provides a list of Net::HTTP timeout errors.}
8
8
  gem.homepage = "https://github.com/barsoom/net_http_timeout_errors"
9
+ gem.license = "MIT"
10
+ gem.metadata = { "rubygems_mfa_required" => "true" }
9
11
 
10
12
  gem.files = `git ls-files`.split($\)
11
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "net_http_timeout_errors"
14
- gem.require_paths = ["lib"]
14
+ gem.require_paths = [ "lib" ]
15
15
  gem.version = NetHttpTimeoutErrors::VERSION
16
16
 
17
- if RUBY_VERSION < "1.9.3"
18
- gem.add_development_dependency "minitest"
19
- end
17
+ gem.add_development_dependency "rake"
18
+ gem.add_development_dependency "minitest"
20
19
  end
@@ -5,6 +5,12 @@ describe NetHttpTimeoutErrors, ".all" do
5
5
  it "has some" do
6
6
  assert_includes NetHttpTimeoutErrors.all, some_timeout_error
7
7
  end
8
+
9
+ NetHttpTimeoutErrors.all.each do |e|
10
+ it "#{e} is a subclass of Exception" do
11
+ assert e < Exception
12
+ end
13
+ end
8
14
  end
9
15
 
10
16
  describe NetHttpTimeoutErrors, ".conflate" do
@@ -25,13 +31,11 @@ describe NetHttpTimeoutErrors, ".conflate" do
25
31
  end
26
32
 
27
33
  it "keeps the original error" do
28
- begin
29
- NetHttpTimeoutErrors.conflate do
30
- raise some_timeout_error
31
- end
32
- rescue => e
33
- assert_instance_of some_timeout_error, e.original_error
34
+ NetHttpTimeoutErrors.conflate do
35
+ raise some_timeout_error
34
36
  end
37
+ rescue => e
38
+ assert_instance_of some_timeout_error, e.original_error
35
39
  end
36
40
  end
37
41
 
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net_http_timeout_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description:
14
42
  email:
15
43
  - henrik@nyh.se
@@ -17,8 +45,12 @@ executables: []
17
45
  extensions: []
18
46
  extra_rdoc_files: []
19
47
  files:
20
- - .gitignore
48
+ - ".github/workflows/ci.yml"
49
+ - ".gitignore"
50
+ - ".rubocop.yml"
51
+ - CHANGELOG.md
21
52
  - Gemfile
53
+ - LICENSE.txt
22
54
  - README.md
23
55
  - Rakefile
24
56
  - lib/net_http_timeout_errors.rb
@@ -26,27 +58,27 @@ files:
26
58
  - net_http_timeout_errors.gemspec
27
59
  - spec/net_http_timeout_errors_spec.rb
28
60
  homepage: https://github.com/barsoom/net_http_timeout_errors
29
- licenses: []
30
- metadata: {}
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ rubygems_mfa_required: 'true'
31
65
  post_install_message:
32
66
  rdoc_options: []
33
67
  require_paths:
34
68
  - lib
35
69
  required_ruby_version: !ruby/object:Gem::Requirement
36
70
  requirements:
37
- - - ! '>='
71
+ - - ">="
38
72
  - !ruby/object:Gem::Version
39
73
  version: '0'
40
74
  required_rubygems_version: !ruby/object:Gem::Requirement
41
75
  requirements:
42
- - - ! '>='
76
+ - - ">="
43
77
  - !ruby/object:Gem::Version
44
78
  version: '0'
45
79
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.4
80
+ rubygems_version: 3.2.31
48
81
  signing_key:
49
82
  specification_version: 4
50
83
  summary: Provides a list of Net::HTTP timeout errors.
51
- test_files:
52
- - spec/net_http_timeout_errors_spec.rb
84
+ test_files: []