rest 2.6.3 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rest/errors.rb +14 -2
- data/lib/rest/version.rb +1 -1
- data/lib/rest/wrappers/net_http_persistent_wrapper.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e33c21fae5fbe9d055fd7f568da9016b1cee5ae
|
4
|
+
data.tar.gz: 290a2d74d309c0393d532743599eb170e9711031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2d087dee419493df11e1da1db72d0dc0a914251dd6ff6b4d12b0ff361ba0ceff48a5ee7d8d39382e0739ce7c7efa1ace0b59bc1c9b34350ea9dbb778d65892
|
7
|
+
data.tar.gz: 7f3844cab11759a9a35c84ef20c2ed2205b5cea7e169cb8ba3a66cca0a3b2a45f76a0706b01e33a5d9a8175fdeb2903c05d17b3ede4425be6f17485125ba966a
|
data/lib/rest/errors.rb
CHANGED
@@ -7,18 +7,30 @@ module Rest
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class HttpError < RestError
|
10
|
-
attr_reader :response, :code
|
10
|
+
attr_reader :response, :code, :msg
|
11
11
|
attr_accessor :options
|
12
12
|
|
13
13
|
def initialize(response, code, options={})
|
14
14
|
super("#{code} Error")
|
15
15
|
@response = response
|
16
|
+
if response && response.body
|
17
|
+
begin
|
18
|
+
bodyparsed = JSON.parse(response.body)
|
19
|
+
@msg = bodyparsed["msg"]
|
20
|
+
rescue => ex
|
21
|
+
# ignore
|
22
|
+
end
|
23
|
+
end
|
16
24
|
@code = code
|
17
25
|
@options = options
|
18
26
|
end
|
19
27
|
|
20
28
|
def to_s
|
21
|
-
"HTTP #{code} Error
|
29
|
+
s = "HTTP #{code} Error"
|
30
|
+
if @msg
|
31
|
+
s += ": #{@msg}"
|
32
|
+
end
|
33
|
+
s
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
data/lib/rest/version.rb
CHANGED
@@ -16,10 +16,16 @@ module Rest
|
|
16
16
|
|
17
17
|
if response.header['content-encoding'].eql?('gzip')
|
18
18
|
Rest.logger.debug 'GZIPPED'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
|
20
|
+
if response.body
|
21
|
+
sio = StringIO.new(response.body)
|
22
|
+
gz = Zlib::GzipReader.new(sio)
|
23
|
+
page = gz.read()
|
24
|
+
@body = page
|
25
|
+
else
|
26
|
+
@body = nil
|
27
|
+
end
|
28
|
+
|
23
29
|
end
|
24
30
|
end
|
25
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: 1.3.6
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.1.11
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Rest client wrapper that chooses best installed client.
|