Exception: Dolibarr::Api::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- Dolibarr::Api::ApiError
- Defined in:
- lib/dolibarr-api/api_error.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, headers: nil, body: nil, response: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message = nil, status: nil, headers: nil, body: nil, response: nil) ⇒ ApiError
Returns a new instance of ApiError.
7 8 9 10 11 12 13 |
# File 'lib/dolibarr-api/api_error.rb', line 7 def initialize( = nil, status: nil, headers: nil, body: nil, response: nil) @status = status @headers = headers @body = body @response = response super( || "HTTP #{status}") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/dolibarr-api/api_error.rb', line 5 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/dolibarr-api/api_error.rb', line 5 def headers @headers end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/dolibarr-api/api_error.rb', line 5 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/dolibarr-api/api_error.rb', line 5 def status @status end |
Class Method Details
.from(response) ⇒ Object
15 16 17 |
# File 'lib/dolibarr-api/api_error.rb', line 15 def self.from(response) new(status: response.status, headers: response.headers, body: response.body, response: response) end |