21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-27 14:30:49 +02:00
chexpire/app/services/whois/parser.rb

27 lines
587 B
Ruby
Raw Normal View History

# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
2018-05-30 12:04:07 +02:00
module Whois
module Parser
2019-02-28 21:54:57 +01:00
PARSERS = [
Afilias,
AFNIC,
CIRA,
2019-02-28 23:28:29 +01:00
IO,
2019-02-28 21:54:57 +01:00
Neustar,
2019-02-28 22:33:48 +01:00
Sonic,
2019-02-28 21:54:57 +01:00
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