yt-support 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/yt/connection_error.rb +5 -0
- data/lib/yt/http_request.rb +12 -0
- data/lib/yt/support/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a662f825d0c472754909155714397c84cf600c
|
4
|
+
data.tar.gz: 4999e00a754f796f8b9d5a00fed15fa538dc69bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91e68dea4b16beb241f28eb8808f56bd35536988c7e2565d463badf90d0568c5c4b9a64e2ee0d11dd90dc1240c1c22968e9afa8274e1189b63d26691c6c7ca1
|
7
|
+
data.tar.gz: 45245e9ec74c83598d767d472df76e88c2a375ab34d92f770b5e5e7e52890d848f061cf39288bbc8b7b75c498554c5e9062fcfdb063f3812b755defdf0047dff
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.1.2 - 2017-04-02
|
10
|
+
|
11
|
+
* [FEATURE] Add Yt::ConnectionError to deal with connection/server errors
|
12
|
+
|
9
13
|
## 0.1.1 - 2017-03-29
|
10
14
|
|
11
15
|
* [FEATURE] Extracted Yt::HTTPRequest and Yt::HTTPError from Yt::Auth
|
data/README.md
CHANGED
@@ -19,6 +19,7 @@ Yt::Support provides:
|
|
19
19
|
* [Yt::Configuration](http://www.rubydoc.info/gems/yt-support/Yt/Configuration)
|
20
20
|
* [Yt::HTTPRequest](http://www.rubydoc.info/gems/yt-support/Yt/HTTPRequest)
|
21
21
|
* [Yt::HTTPError](http://www.rubydoc.info/gems/yt-support/Yt/HTTPError)
|
22
|
+
* [Yt::ConnectionError](http://www.rubydoc.info/gems/yt-support/Yt/ConnectionError)
|
22
23
|
|
23
24
|
How to contribute
|
24
25
|
=================
|
data/lib/yt/http_request.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'json'
|
3
|
+
require 'yt/connection_error'
|
3
4
|
require 'yt/http_error'
|
4
5
|
|
5
6
|
module Yt
|
@@ -111,6 +112,17 @@ module Yt
|
|
111
112
|
@response ||= Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
112
113
|
http.request http_request
|
113
114
|
end
|
115
|
+
rescue *server_errors => e
|
116
|
+
raise Yt::ConnectionError, e.message
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returns the list of server errors worth retrying the request once.
|
120
|
+
def server_errors
|
121
|
+
[
|
122
|
+
Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ENETUNREACH,
|
123
|
+
Errno::ETIMEDOUT, Net::HTTPServerError, Net::OpenTimeout,
|
124
|
+
OpenSSL::SSL::SSLError, OpenSSL::SSL::SSLErrorWaitReadable, SocketError,
|
125
|
+
]
|
114
126
|
end
|
115
127
|
|
116
128
|
# Replaces the body of the response with the parsed version of the body,
|
data/lib/yt/support/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- bin/setup
|
118
118
|
- lib/yt/config.rb
|
119
119
|
- lib/yt/configuration.rb
|
120
|
+
- lib/yt/connection_error.rb
|
120
121
|
- lib/yt/http_error.rb
|
121
122
|
- lib/yt/http_request.rb
|
122
123
|
- lib/yt/support.rb
|