Exception: ResoTransport::RequestError

Inherits:
ResourceError show all
Defined in:
lib/reso_transport/errors.rb

Direct Known Subclasses

AccessDenied, NoResponse, ResponseError

Instance Attribute Summary collapse

Attributes inherited from ResourceError

#resource

Instance Method Summary collapse

Methods inherited from ResourceError

#resource_name

Constructor Details

#initialize(request, response, resource = nil) ⇒ RequestError

Returns a new instance of RequestError.



41
42
43
44
45
# File 'lib/reso_transport/errors.rb', line 41

def initialize(request, response, resource = nil)
  @response = response.respond_to?(:to_hash) ? response.to_hash : response
  @request = request
  super resource
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



39
40
41
# File 'lib/reso_transport/errors.rb', line 39

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



39
40
41
# File 'lib/reso_transport/errors.rb', line 39

def response
  @response
end

Instance Method Details

#messageObject



47
48
49
# File 'lib/reso_transport/errors.rb', line 47

def message
  "Received #{response[:status]} for #{resource_name}"
end