def get_result(args)
      xml = case args
            when Hash
              args.delete(:xml)
            else
              xml = args
              args = {}
              xml
            end

      args[:range] ||= 1000..1999

      if !(mq = xml.xpath('epp:epp/epp:response/epp:msgQ', EPPClient::SCHEMAS_URL)).empty?
        @msgQ_count = mq.attribute('count').value.to_i
        @msgQ_id = mq.attribute('id').value
        puts "DEBUG: MSGQ : count=#{@msgQ_count}, id=#{@msgQ_id}\n" if debug
      else
        @msgQ_count = 0
        @msgQ_id = nil
      end

      unless (trID = xml.xpath('epp:epp/epp:response/epp:trID', EPPClient::SCHEMAS_URL)).empty?
        @trID = get_trid(trID)
      end

      res = xml.xpath('epp:epp/epp:response/epp:result', EPPClient::SCHEMAS_URL)
      code = res.attribute('code').value.to_i

      raise EPPClient::EPPErrorResponse.new(:xml => xml, :code => code, :message => res.xpath('epp:msg', EPPClient::SCHEMAS_URL).text) unless args[:range].include?(code)

      return true unless args.key?(:callback)

      case cb = args[:callback]
      when Symbol
        return send(cb, xml.xpath('epp:epp/epp:response', EPPClient::SCHEMAS_URL))
      else
        raise ArgumentError, 'Invalid callback type'
      end
    end
def get_result(args)
      xml = case args
            when Hash
              args.delete(:xml)
            else
              xml = args
              args = {}
              xml
            end

      args[:range] ||= 1000..1999

      if !(mq = xml.xpath('epp:epp/epp:response/epp:msgQ', EPPClient::SCHEMAS_URL)).empty?
        @msgQ_count = mq.attribute('count').value.to_i
        @msgQ_id = mq.attribute('id').value
        puts "DEBUG: MSGQ : count=#{@msgQ_count}, id=#{@msgQ_id}\n" if debug
      else
        @msgQ_count = 0
        @msgQ_id = nil
      end

      unless (trID = xml.xpath('epp:epp/epp:response/epp:trID', EPPClient::SCHEMAS_URL)).empty?
        @trID = get_trid(trID)
      end

      res = xml.xpath('epp:epp/epp:response/epp:result', EPPClient::SCHEMAS_URL)
      code = res.attribute('code').value.to_i

      raise EPPClient::EPPErrorResponse.new(:xml => xml, :code => code, :message => res.xpath('epp:msg', EPPClient::SCHEMAS_URL).text) unless args[:range].include?(code)

      return true unless args.key?(:callback)

      case cb = args[:callback]
      when Symbol
        return send(cb, xml.xpath('epp:epp/epp:response', EPPClient::SCHEMAS_URL))
      else
        raise ArgumentError, 'Invalid callback type'
      end
    end
Takes a xml response and checks that the result is in the right range of
 results, that is, between 1000 and 1999, which are results meaning all
 went well.

 In case all went well, it either calls the callback if given, or returns
 true.

 In case there was a problem, an EPPErrorResponse exception is raised.