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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3beaf4719e1ec4e1f2a053b9ee679ca2e1c23ff
4
- data.tar.gz: 6c0a38d503a341dc62e89d2f96f334af5042e6a1
3
+ metadata.gz: 3e33c21fae5fbe9d055fd7f568da9016b1cee5ae
4
+ data.tar.gz: 290a2d74d309c0393d532743599eb170e9711031
5
5
  SHA512:
6
- metadata.gz: d1a9899414bb0532e30df7458931ae229cc1dab04c0b52b1d5750c15e2af1f37cabd66a3b7af961ea943fe7c0abfa6e7f96d2999390646d0ed06db33e87a1ef1
7
- data.tar.gz: ffb93b85874da5e6810704300864f2e61302045aae59db50d9fd5a30a1071c69c1082ea63d1a51f81d2b06822c974f6177985b49269e88701ed6ca25d2951ed5
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
@@ -1,3 +1,3 @@
1
1
  module Rest
2
- VERSION = "2.6.3"
2
+ VERSION = "2.6.4"
3
3
  end
@@ -16,10 +16,16 @@ module Rest
16
16
 
17
17
  if response.header['content-encoding'].eql?('gzip')
18
18
  Rest.logger.debug 'GZIPPED'
19
- sio = StringIO.new(response.body)
20
- gz = Zlib::GzipReader.new(sio)
21
- page = gz.read()
22
- @body = page
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.3
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-06-12 00:00:00.000000000 Z
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.0.3
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.