class Whois::Parsers::WhoisNicTr

Parser for the whois.nic.tr server.

@see Whois::Parsers::Example

The Example parser for the list of all available methods.

Public Instance Methods

invalid?() click to toggle source

NEWPROPERTY invalid?

# File lib/whois/parsers/whois.nic.tr.rb, line 122
def invalid?
  cached_properties_fetch :invalid? do
    response_error?
  end
end
response_error?() click to toggle source
# File lib/whois/parsers/whois.nic.tr.rb, line 116
def response_error?
  content_for_scanner =~ /Invalid input/
end

Private Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/whois.nic.tr.rb, line 131
def build_contact(element, type)
  textblock = content_for_scanner.slice(/^\*\* #{element}:\n((?:.+\n)+)\n/, 1)
  return unless textblock

  lines = []
  textblock.lines.each do |line|
    if line =~ /^\s+.+/
      lines.last.last << "\n" << line.strip
    else
      lines << line.match(/([^\t]+)\t+:\s+(.+)/).to_a[1..2]
    end
  end
  lines = Hash[lines]

  Parser::Contact.new(
      type:         type,
      id:           lines["NIC Handle"],
      name:         lines["Person"],
      organization: lines["Organization Name"],
      address:      lines["Address"],
      phone:        lines["Phone"],
      fax:          lines["Fax"]
    )
end