class Whois::Record::Parser::WhoisNicFr
Parser for the whois.nic.fr server.
NOTE: This parser is just a stub and provides only a few basic methods to check for domain availability and get domain status. Please consider to contribute implementing missing methods. See WhoisNicIt parser for an explanation of all available methods and examples.
Constants
- MULTIVALUE_KEYS
Public Instance Methods
response_throttled?()
click to toggle source
Checks whether the response has been throttled.
@return [Boolean]
# File lib/whois/record/parser/whois.nic.fr.rb, line 107 def response_throttled? !!(content_for_scanner =~ /^%% Too many requests\.{3}/) end
Private Instance Methods
build_hash(tokens)
click to toggle source
# File lib/whois/record/parser/whois.nic.fr.rb, line 158 def build_hash(tokens) {}.tap do |hash| tokens.each do |key, value| if MULTIVALUE_KEYS.include?(key) hash[key] ||= [] hash[key] << value else hash[key] = value end end end end
parse_contact(element, type)
click to toggle source
# File lib/whois/record/parser/whois.nic.fr.rb, line 116 def parse_contact(element, type) return unless content_for_scanner =~ /#{element}:\s+(.+)\n/ id = $1 content_for_scanner.scan(/nic-hdl:\s+#{id}\n((.+\n)+)\n/).any? || Whois.bug!(ParserError, "Unable to parse contact block for nic-hdl: #{id}") values = build_hash($1.scan(/(.+?):\s+(.+?)\n/)) if values["type"] == "ORGANIZATION" name = nil organization = values["contact"] address = values["address"].join("\n") else name = values["contact"] if values["address"].nil? organization = nil address = nil elsif values["address"].size > 2 organization = values["address"][0] address = values["address"][1..-1].join("\n") else organization = nil address = values["address"].join("\n") end end updated_on = values["changed"] ? Time.utc(*values["changed"].split(" ").first.split("/").reverse) : nil Record::Contact.new({ :type => type, :id => id, :name => name, :organization => organization, :address => address, :country_code => values["country"], :phone => values["phone"], :fax => values["fax-no"], :email => values["e-mail"], :updated_on => updated_on, }) end