class Whois::Parsers::WhoisUa::Uanic
Attributes
content[R]
parent[R]
Public Class Methods
new(parent, content)
click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 93 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 133 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/ Parser::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: (Base.parse_time($1.split(" ").last) if textblock =~ /changed:\s+(.+)\n/) ) end end
created_on()
click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 111 def created_on if content =~ /created:\s+(.+)\n/ time = $1.split(" ").last Base.parse_time(time) end end
expires_on()
click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 125 def expires_on if content =~ /status:\s+(.+)\n/ time = $1.split(" ").last Base.parse_time(time) end end
status()
click to toggle source
# File lib/whois/parsers/whois.ua.rb, line 98 def status if content =~ /status:\s+(.+?)\n/ case (s = $1.downcase) when /^ok-until/ :registered 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 118 def updated_on if content =~ /changed:\s+(.+)\n/ time = $1.split(" ").last Base.parse_time(time) end end