class Whois::Parsers::WhoisCiraCa

Parser for the whois.cira.ca server.

@see Whois::Parsers::Example

The Example parser for the list of all available methods.

Public Instance Methods

invalid?() click to toggle source

NEWPROPERTY

# File lib/whois/parsers/whois.cira.ca.rb, line 161
def invalid?
  cached_properties_fetch(:invalid?) do
    status == :invalid
  end
end
valid?() click to toggle source

NEWPROPERTY

# File lib/whois/parsers/whois.cira.ca.rb, line 154
def valid?
  cached_properties_fetch(:valid?) do
    !invalid?
  end
end
version() click to toggle source

Attempts to detect and returns the version.

TODO: This is very empiric.

Use the available status in combination with the creation date label.

NEWPROPERTY

# File lib/whois/parsers/whois.cira.ca.rb, line 141
def version
  cached_properties_fetch :version do
    version = if content_for_scanner =~ /^% \(c\) (.+?) Canadian Internet Registration Authority/
      case $1
      when "2007" then "1"
      when "2010" then "2"
      end
    end
    version || Whois::Parser.bug!(ParserError, "Unable to detect version.")
  end
end

Private Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/whois.cira.ca.rb, line 170
def build_contact(element, type)
  node(element) do |hash|
    Parser::Contact.new(
      :type         => type,
      :id           => nil,
      :name         => hash["Name"],
      :organization => nil,
      :address      => hash["Postal address"],
      :city         => nil,
      :zip          => nil,
      :state        => nil,
      :country      => nil,
      :phone        => hash["Phone"],
      :fax          => hash["Fax"],
      :email        => hash["Email"]
    )
  end
end