class SterlingApi::RemoteActions::Response

Attributes

body[RW]
raw_response[RW]
status[RW]

Public Class Methods

new(ret_val, resp) click to toggle source
# File lib/sterling_api/remote_actions.rb, line 13
def initialize(ret_val, resp)
  self.status = ret_val
  self.raw_response = resp
  self.body = resp.body
end

Public Instance Methods

errors() click to toggle source
# File lib/sterling_api/remote_actions.rb, line 27
def errors
  error_code = self.body.match(%r{<ErrorCode>(.+)</ErrorCode>})[1] rescue '???'
  error_description = self.body.match(%r{<ErrorDescription>(.+)</ErrorDescription>})[1] rescue '???'
  {
    :error_code => error_code,
    :error_description => error_description
  }
end
failure?() click to toggle source
# File lib/sterling_api/remote_actions.rb, line 19
def failure?
  !success?
end
success?() click to toggle source
# File lib/sterling_api/remote_actions.rb, line 23
def success?
  (self.body =~ %r{<Error(Report)?>}m).nil?
end