mirror of
https://github.com/Evolix/chexpire.git
synced 2024-06-26 19:12:53 +02:00
25 lines
642 B
Ruby
25 lines
642 B
Ruby
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
|
|
# License: GNU AGPL-3+ (see full text in LICENSE file)
|
|
|
|
require "null_logger"
|
|
require "whois/errors"
|
|
require "whois/parser/afnic"
|
|
require "whois/parser/pir"
|
|
require "whois/parser/verisign"
|
|
|
|
module Whois
|
|
module Parser
|
|
PARSERS = [AFNIC, Verisign, PIR].freeze
|
|
|
|
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
|