Exception: ZammadAPI::ResponseError
- Defined in:
- lib/zammad_api/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(operation:, response:, resource_class: nil) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #status ⇒ Object
Constructor Details
#initialize(operation:, response:, resource_class: nil) ⇒ ResponseError
Returns a new instance of ResponseError.
13 14 15 16 17 18 |
# File 'lib/zammad_api/errors.rb', line 13 def initialize(operation:, response:, resource_class: nil) @operation = operation @response = response @resource_class = resource_class super() end |
Instance Attribute Details
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
11 12 13 |
# File 'lib/zammad_api/errors.rb', line 11 def operation @operation end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
11 12 13 |
# File 'lib/zammad_api/errors.rb', line 11 def resource_class @resource_class end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
11 12 13 |
# File 'lib/zammad_api/errors.rb', line 11 def response @response end |
Class Method Details
.from(response, **kwargs) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/zammad_api/errors.rb', line 28 def self.from(response, **kwargs) klass = if response.nil? self elsif response.status >= 500 ServerError else ClientError end klass.new(response: response, **kwargs) end |
Instance Method Details
#body ⇒ Object
24 25 26 |
# File 'lib/zammad_api/errors.rb', line 24 def body response&.body end |
#status ⇒ Object
20 21 22 |
# File 'lib/zammad_api/errors.rb', line 20 def status response&.status end |