class Agris::ProcessMessageResponse::ErrorInfo

Public Class Methods

new(hash) click to toggle source
# File lib/agris/process_message_response.rb, line 29
def initialize(hash)
  @hash = hash
end

Public Instance Methods

payload() click to toggle source
# File lib/agris/process_message_response.rb, line 33
def payload
  if @hash.key?('xml')
    @hash['xml']['errors']['errorinfo']
  elsif @hash['errorinfo'].is_a?(Hash)
    @hash['errorinfo']
  elsif @hash['errorinfo'].is_a?(String)
    @hash['errorinfo'].strip
  else
    @hash
  end
end
type() click to toggle source
# File lib/agris/process_message_response.rb, line 45
def type
  @type ||= if @hash.key?('xml')
              :message
            elsif @hash['errorinfo'].is_a?(Hash)
              :system
            elsif @hash['errorinfo'].is_a?(String)
              :api
            else
              :unknown
            end
end