class Whois::Parsers::WhoisDnsPl

Parser for the whois.dns.pl server.

@see Whois::Parsers::Example

The Example parser for the list of all available methods.

Public Instance Methods

response_throttled?() click to toggle source

Checks whether the response has been throttled.

@return [Boolean]

@example

Looup quota exceeded.
# File lib/whois/parsers/whois.dns.pl.rb, line 105
def response_throttled?
  !!(content_for_scanner =~ /^request limit exceeded for/)
end

Private Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/whois.dns.pl.rb, line 112
def build_contact(element, type)
  match = content_for_scanner.slice(/#{element}:\n((.+\n)+)\n/, 1)
  return unless match

  values = parse_contact_block(match.split("\n"))
  zip, city = values["city"].match(/(.+?) (.+)/)[1..2]

  Parser::Contact.new(
    :type         => type,
    :id           => values["handle"],
    :name         => nil,
    :organization => values["company"],
    :address      => values["street"],
    :city         => city,
    :zip          => zip,
    :state        => nil,
    :country_code => values["location"],
    :phone        => values["phone"],
    :fax          => values["fax"],
    :email        => nil
  )
end
parse_contact_block(lines) click to toggle source
# File lib/whois/parsers/whois.dns.pl.rb, line 135
def parse_contact_block(lines)
  key  = nil
  hash = {}
  lines.each do |line|
    if line =~ /(.+):(.+)/
      hash[key = $1] = $2.strip
    else
      hash[key] += "\n#{line.strip}"
    end
  end
  hash
end