class OpenBuildServiceAPI::RemoteAPIError

remote API network errors

Attributes

error_code[RW]
error_summary[RW]
message[RW]
response[RW]

Public Class Methods

new(response, message=nil) click to toggle source
# File lib/exception.rb, line 6
def initialize(response, message=nil)
  response_body = response.body

  @response = response
  @message = message ? message : response_body

  response_xml = Nokogiri::XML(response_body)
  status = response_xml.xpath('./status')[0]

  if status
    @error_code = status.attr('code')

    summary = status.xpath('./summary')
    @error_summary = summary.text if summary[0]
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/exception.rb, line 23
def to_s
  @message
end