class Whois::Parsers::WhoisUa::Uaepp

Attributes

content[R]
parent[R]

Public Class Methods

new(parent, content) click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 22
def initialize(parent, content)
  @parent  = parent
  @content = content
end

Public Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 61
def build_contact(element, type)
  contact_ids = content.scan(/#{element}:\s+(.+)\n/).flatten
  return if contact_ids.empty?

  contact_ids.map do |contact_id|
    textblock = content.slice(/contact-id:\s+#{contact_id}\n((?:.+\n)+)\n/, 1)

    address = textblock.scan(/address:\s+(.+)\n/).flatten
    address = address.reject { |a| a == "n/a" }

    Parser::Contact.new(
      type:         type,
      id:           contact_id,
      name:         textblock.slice(/person:\s+(.+)\n/, 1),
      organization: textblock.slice(/organization:\s+(.+)\n/, 1),
      address:      address.join("\n"),
      zip:          nil,
      state:        nil,
      city:         nil,
      country:      textblock.slice(/country:\s+(.+)\n/, 1),
      phone:        textblock.slice(/phone:\s+(.+)\n/, 1),
      fax:          textblock.slice(/fax:\s+(.+)\n/, 1),
      email:        textblock.slice(/e-mail:\s+(.+)\n/, 1),
      created_on:   Base.parse_time(textblock.slice(/created:\s+(.+)\n/, 1))
    )
  end
end
created_on() click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 42
def created_on
  if content =~ /created:\s+(.+)\n/
    Base.parse_time($1)
  end
end
expires_on() click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 54
def expires_on
  if content =~ /expires:\s+(.+)\n/
    Base.parse_time($1)
  end
end
status() click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 27
def status
  if content =~ /status:\s+(.+?)\n/
    case (s = $1.downcase)
    when "ok", "clienthold", "autorenewgraceperiod", "clienttransferprohibited"
      :registered
    when "redemptionperiod", "pendingdelete"
      :redemption
    else
      Whois::Parser.bug!(ParserError, "Unknown status `#{s}'.")
    end
  else
    :available
  end
end
updated_on() click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 48
def updated_on
  if content =~ /modified:\s+(.+)\n/
    Base.parse_time($1)
  end
end