Exception: RestClient::ExceptionWithResponse

Inherits:
Exception
  • Object
show all
Defined in:
lib/restclient/exceptions.rb

Overview

Base RestClient exception when there's a response available

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Exception

#message

Constructor Details

#initialize(response = nil) ⇒ ExceptionWithResponse



14
15
16
# File 'lib/restclient/exceptions.rb', line 14

def initialize(response=nil)
	@response = response
end

Instance Attribute Details

#responseObject

Returns the value of attribute response



12
13
14
# File 'lib/restclient/exceptions.rb', line 12

def response
  @response
end

Instance Method Details

#http_bodyObject



22
23
24
# File 'lib/restclient/exceptions.rb', line 22

def http_body
	RestClient::Request.decode(@response['content-encoding'], @response.body) if @response
end

#http_codeObject



18
19
20
# File 'lib/restclient/exceptions.rb', line 18

def http_code
	@response.code.to_i if @response
end