class Whois::Parsers::WhoisCentralnicCom

Parser for the whois.centralnic.com server.

Private Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/whois.centralnic.com.rb, line 112
def build_contact(element, type)
  node("#{element} ID") do
    address = [nil, 1, 2, 3].
        map { |i| node("#{element} Street#{i}") }.
        delete_if { |i| i.nil? || i.empty? }.
        join("\n")
    address = nil if address.empty?

    Parser::Contact.new(
        :type         => type,
        :id           => node("#{element} ID"),
        :name         => node("#{element} Name"),
        :organization => node("#{element} Organization"),
        :address      => address,
        :city         => node("#{element} City"),
        :zip          => node("#{element} Postal Code"),
        :state        => node("#{element} State/Province"),
        :country_code => node("#{element} Country"),
        :phone        => node("#{element} Phone"),
        :fax          => node("#{element} FAX") || node("#{element} Fax"),
        :email        => node("#{element} Email")
    )
  end
end