Parent

Files

Class/Module Index [+]

Quicksearch

Whois::Record::Parser::WhoisUa::Uanic

Attributes

content[R]
parent[R]

Public Class Methods

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

Public Instance Methods

build_contact(element, type) click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 132
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(/nic-handle:\s+#{contact_id}\n((?:.+\n)+)\n/, 1)

    address = textblock.scan(/address:\s+(.+)\n/).flatten
    zip = nil
    zip = address[1].slice!(/\s+\d{5}/).strip if address[1] =~ /\s+\d{5}/
    zip = address[1].slice!(/\d{5}\s+/).strip if address[1] =~ /\d{5}\s+/
    state = nil
    state = address[1].slice!(/\s+[A-Z]{2}\z/).strip if address[1] =~ /\s+[A-Z]{2}\z/
    
    Record::Contact.new(
      type:         type,
      id:           contact_id,
      name:         nil,
      organization: textblock.scan(/organization:\s+(.+)\n/).join("\n"),
      address:      address[0],
      zip:          zip,
      state:        state,
      city:         address[1],
      country:      address[2],
      phone:        textblock.slice(/phone:\s+(.+)\n/, 1),
      fax:          textblock.slice(/fax-no:\s+(.+)\n/, 1),
      email:        textblock.slice(/e-mail:\s+(.+)\n/, 1),
      updated_on:   (Time.parse($1.split(" ").last) if textblock =~ /changed:\s+(.+)\n/)
    )
  end
end
created_on() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 110
def created_on
  if content =~ /created:\s+(.+)\n/
    time = $1.split(" ").last
    Time.parse(time)
  end
end
expires_on() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 124
def expires_on
  if content =~ /status:\s+(.+)\n/
    time = $1.split(" ").last
    Time.parse(time)
  end
end
status() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 97
def status
  if content =~ /status:\s+(.+?)\n/
    case (s = $1.downcase)
    when /^ok-until/
      :registered
    else
      Whois.bug!(ParserError, "Unknown status `#{s}'.")
    end
  else
    :available
  end
end
updated_on() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 117
def updated_on
  if content =~ /changed:\s+(.+)\n/
    time = $1.split(" ").last
    Time.parse(time)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.