class GlobalSign::Response

Constants

SUCCESS_CODE
WARNING_CODE

Public Class Methods

new(body) click to toggle source
# File lib/global_sign/response.rb, line 8
def initialize(body)
  @xml = Nokogiri::XML(body)
end

Public Instance Methods

error?() click to toggle source
# File lib/global_sign/response.rb, line 28
def error?
  !success? && !warning?
end
error_code() click to toggle source
# File lib/global_sign/response.rb, line 32
def error_code
  errors.at('ErrorCode').try(:text)
end
error_field() click to toggle source
# File lib/global_sign/response.rb, line 36
def error_field
  errors.at('ErrorField').try(:text)
end
error_message() click to toggle source
# File lib/global_sign/response.rb, line 40
def error_message
  errors.at('ErrorMessage').try(:text)
end
success?() click to toggle source
# File lib/global_sign/response.rb, line 20
def success?
  @xml.xpath(xpath_result).text == SUCCESS_CODE
end
warning?() click to toggle source
# File lib/global_sign/response.rb, line 24
def warning?
  @xml.xpath(xpath_result).text == WARNING_CODE
end
xpath_errors() click to toggle source
# File lib/global_sign/response.rb, line 16
def xpath_errors
  "//Response/#{response_header}/Errors"
end
xpath_result() click to toggle source
# File lib/global_sign/response.rb, line 12
def xpath_result
  "//Response/#{response_header}/SuccessCode"
end

Private Instance Methods

errors() click to toggle source
# File lib/global_sign/response.rb, line 46
def errors
  @xml.xpath(xpath_errors)
end