Exception: RestfulResource::HttpClient::HttpError
- Inherits:
-
StandardError
- Object
- StandardError
- RestfulResource::HttpClient::HttpError
- Defined in:
- lib/restful_resource/http_client.rb
Direct Known Subclasses
Conflict, OtherHttpError, ResourceNotFound, RetryableError, UnprocessableEntity
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #assign_response(response = nil) ⇒ Object
-
#initialize(request, response = nil) ⇒ HttpError
constructor
A new instance of HttpError.
Constructor Details
#initialize(request, response = nil) ⇒ HttpError
Returns a new instance of HttpError.
9 10 11 |
# File 'lib/restful_resource/http_client.rb', line 9 def initialize(request, response = nil) @request, @response = request, assign_response(response) end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'lib/restful_resource/http_client.rb', line 7 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/restful_resource/http_client.rb', line 7 def response @response end |
Instance Method Details
#assign_response(response = nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/restful_resource/http_client.rb', line 13 def assign_response(response = nil) if response @response = Response.new(body: response[:body], headers: response[:headers], status: response[:status]) else @response = Response.new end end |