Exception: Sophos::SG::REST::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Sophos::SG::REST::Error
- Defined in:
- lib/sophos/sg/rest/error.rb
Overview
Copyright 2016 Sophos Technology GmbH. All rights reserved. See the LICENSE.txt file for details. Authors: Vincent Landgraf
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(request, response, body) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(request, response, body) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sophos/sg/rest/error.rb', line 8 def initialize(request, response, body) @request = request @response = response @body = body = response. << ": #{errors.first.name}" if errors.any? reqdesc = "#{request.method} #{request.path} -> #{response.code}" super "UTM: #{message} (#{reqdesc})" end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/sophos/sg/rest/error.rb', line 6 def body @body end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/sophos/sg/rest/error.rb', line 6 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/sophos/sg/rest/error.rb', line 6 def response @response end |
Instance Method Details
#errors ⇒ Object
20 21 22 |
# File 'lib/sophos/sg/rest/error.rb', line 20 def errors body.is_a?(Array) ? body : [] end |