net_http_timeout_errors 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in net_http_timeout_errors.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Net::HTTP::TIMEOUT\_ERRORS
2
+
3
+ Tired of having to rescue an ever-growing list of Net::HTTP timeout error types?
4
+
5
+ Just include this gem and then do:
6
+
7
+ ```
8
+ begin
9
+ uri = URI.parse("http://google.com/")
10
+ response = Net::HTTP.get_response(uri)
11
+ rescue *Net::HTTP::TIMEOUT_ERRORS
12
+ puts "It timed out some way or other!"
13
+ rescue AnotherError, *Net::HTTP::TIMEOUT_ERRORS
14
+ puts "This works too."
15
+ end
16
+ ```
17
+
18
+ Did we miss an exception? Please add it!
19
+
20
+
21
+ ## Installation
22
+
23
+ Add this line to your application's Gemfile:
24
+
25
+ gem 'net_http_timeout_errors'
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install net_http_timeout_errors
34
+
35
+
36
+ ## License
37
+
38
+ Copyright (c) 2012 [Barsoom AB](http://barsoom.se)
39
+
40
+ MIT License
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining
43
+ a copy of this software and associated documentation files (the
44
+ "Software"), to deal in the Software without restriction, including
45
+ without limitation the rights to use, copy, modify, merge, publish,
46
+ distribute, sublicense, and/or sell copies of the Software, and to
47
+ permit persons to whom the Software is furnished to do so, subject to
48
+ the following conditions:
49
+
50
+ The above copyright notice and this permission notice shall be
51
+ included in all copies or substantial portions of the Software.
52
+
53
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
54
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
55
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
56
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
57
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
58
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
59
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.pattern = "spec/*_spec.rb"
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,15 @@
1
+ require "net_http_timeout_errors/version"
2
+ require "net/http"
3
+
4
+ module Net
5
+ class HTTP
6
+ TIMEOUT_ERRORS = [
7
+ Errno::ECONNREFUSED,
8
+ Errno::ECONNRESET,
9
+ Errno::EHOSTUNREACH,
10
+ Errno::EPIPE,
11
+ SocketError,
12
+ Timeout::Error,
13
+ ]
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module NetHttpTimeoutErrors
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/net_http_timeout_errors/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Henrik Nyh"]
6
+ gem.email = ["henrik@nyh.se"]
7
+ gem.summary = %q{Provides a list of Net::HTTP timeout errors.}
8
+ gem.homepage = "https://github.com/barsoom/net_http_timeout_errors"
9
+
10
+ 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
+ gem.name = "net_http_timeout_errors"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = NetHttpTimeoutErrors::VERSION
16
+
17
+ if RUBY_VERSION < "1.9.3"
18
+ gem.add_development_dependency "minitest"
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ require "minitest/autorun"
2
+ require "net_http_timeout_errors"
3
+
4
+ describe Net::HTTP, "TIMEOUT_ERRORS" do
5
+ it "has some" do
6
+ Net::HTTP::TIMEOUT_ERRORS.wont_be_empty
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: net_http_timeout_errors
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Henrik Nyh
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description:
15
+ email:
16
+ - henrik@nyh.se
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - README.md
24
+ - Rakefile
25
+ - lib/net_http_timeout_errors.rb
26
+ - lib/net_http_timeout_errors/version.rb
27
+ - net_http_timeout_errors.gemspec
28
+ - spec/net_http_timeout_errors_spec.rb
29
+ homepage: https://github.com/barsoom/net_http_timeout_errors
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.5
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: Provides a list of Net::HTTP timeout errors.
53
+ test_files:
54
+ - spec/net_http_timeout_errors_spec.rb
55
+ has_rdoc: