21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-08 19:48:38 +02:00
chexpire/app/services/whois/parser.rb
Jérémy Lecour 3990771767 Add 50 new TLDs (.info, .au, .asia…)
PIR is technically managed by Afilias (like many other registries).
Renaming/replacing PIR with Afilias brings support to dozens of other 
TLDs.
2019-02-27 23:37:58 +01:00

25 lines
650 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/afilias"
require "whois/parser/afnic"
require "whois/parser/verisign"
module Whois
module Parser
PARSERS = [AFNIC, Verisign, Afilias].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