Parent

Files

Class/Module Index [+]

Quicksearch

Whois::Record::Parser::WhoisUa::Epp

Attributes

content[R]
parent[R]

Public Class Methods

new(parent, content) click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 23
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 60
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" }
    
    Record::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:   Time.parse(textblock.slice(/created:\s+(.+)\n/, 1))
    )
  end
end
created_on() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 41
def created_on
  if content =~ /created:\s+(.+)\n/
    Time.parse($1)
  end
end
expires_on() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 53
def expires_on
  if content =~ /expires:\s+(.+)\n/
    Time.parse($1)
  end
end
status() click to toggle source
# File lib/whois/record/parser/whois.ua.rb, line 28
def status
  if content =~ /status:\s+(.+?)\n/
    case (s = $1.downcase)
    when "ok"
      :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 47
def updated_on
  if content =~ /modified:\s+(.+)\n/
    Time.parse($1)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.