2018-05-30 12:04:07 +02:00
|
|
|
require "null_logger"
|
|
|
|
require "whois/errors"
|
2018-06-05 16:42:04 +02:00
|
|
|
require "whois/parser/afnic"
|
2018-06-05 16:39:08 +02:00
|
|
|
require "whois/parser/verisign"
|
2018-05-30 12:04:07 +02:00
|
|
|
|
|
|
|
module Whois
|
|
|
|
module Parser
|
2018-06-05 16:42:04 +02:00
|
|
|
PARSERS = [AFNIC, Verisign].freeze
|
2018-05-30 12:04:07 +02:00
|
|
|
|
|
|
|
class << self
|
|
|
|
def for(domain, logger: NullLogger.new)
|
|
|
|
parser_class = PARSERS.find { |k| k.supports?(domain) }
|
|
|
|
|
|
|
|
fail UnsupportedDomainError, "Unsupported domain '#{domain}'" if parser_class.nil?
|
|
|
|
|
|
|
|
parser_class.new(domain, logger: logger)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|