class Sophos::SG::REST::Error

Copyright 2016 Sophos Technology GmbH. All rights reserved. See the LICENSE.txt file for details. Authors: Vincent Landgraf

Attributes

body[R]
request[R]
response[R]

Public Class Methods

new(request, response, body) click to toggle source
Calls superclass method
# File lib/sophos/sg/rest/error.rb, line 8
def initialize(request, response, body)
  @request = request
  @response = response
  @body = body

  message = response.message
  message << ": #{errors.first.name}" if errors.any?
  reqdesc = "#{request.method} #{request.path} -> #{response.code}"

  super "UTM: #{message} (#{reqdesc})"
end

Public Instance Methods

errors() click to toggle source
# File lib/sophos/sg/rest/error.rb, line 20
def errors
  body.is_a?(Array) ? body : []
end