class Whois::Parsers::BaseIcannCompliant

Base parser for ICANN Compliant servers.

@abstract @see www.icann.org/en/resources/registrars/raa/approved-with-specs-27jun13-en.htm#whois

Protected Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/base_icann_compliant.rb, line 106
def build_contact(element, type)
  node("#{element} Name") do
    Parser::Contact.new(
        type:         type,
        id:           node("Registry #{element} ID").presence,
        name:         value_for_property(element, 'Name'),
        organization: contact_organization_attribute(element),
        address:      contact_address_attribute(element),
        city:         value_for_property(element, 'City'),
        zip:          value_for_property(element, 'Postal Code'),
        state:        value_for_property(element, 'State/Province'),
        country_code: value_for_property(element, 'Country'),
        phone:        value_for_phone_property(element, 'Phone'),
        fax:          value_for_phone_property(element, 'Fax'),
        email:        value_for_property(element, 'Email')
    )
  end
end
contact_address_attribute(element) click to toggle source
# File lib/whois/parsers/base_icann_compliant.rb, line 129
def contact_address_attribute(element)
  value_for_property(element, 'Street')
end
contact_organization_attribute(element) click to toggle source
# File lib/whois/parsers/base_icann_compliant.rb, line 125
def contact_organization_attribute(element)
  value_for_property(element, 'Organization')
end

Private Instance Methods

value_for_phone_property(element, property) click to toggle source
# File lib/whois/parsers/base_icann_compliant.rb, line 136
def value_for_phone_property(element, property)
  [
    value_for_property(element, "#{property}"),
    value_for_property(element, "#{property} Ext")
  ].reject(&:empty?).join(' ext: ')
end
value_for_property(element, property) click to toggle source
# File lib/whois/parsers/base_icann_compliant.rb, line 143
def value_for_property(element, property)
  Array.wrap(node("#{element} #{property}")).reject(&:empty?).join(', ')
end