class Whois::Parsers::WhoisRegistroBr
Parser
for the whois.registro.br server.
@note This parser is just a stub and provides only a few basic methods
to check for domain availability and get domain status. Please consider to contribute implementing missing methods.
The Example parser for the list of all available methods.
Private Instance Methods
build_hash(tokens)
click to toggle source
# File lib/whois/parsers/whois.registro.br.rb, line 107 def build_hash(tokens) {}.tap do |hash| tokens.each do |key, value| hash[key] = value end end end
parse_contact(element, type)
click to toggle source
# File lib/whois/parsers/whois.registro.br.rb, line 86 def parse_contact(element, type) return unless content_for_scanner =~ /#{element}:\s+(.+)\n/ id = $1 content_for_scanner.scan(/nic-hdl-br:\s+#{id}\n((.+\n)+)\n/).any? || Whois.bug!(ParserError, "Unable to parse contact block for nic-hdl-br: #{id}") values = build_hash($1.scan(/(.+?):\s+(.+?)\n/)) created_on = values["created"] ? Time.utc(*values["created"][0..3],*values["created"][4..5],*values["created"][6..7]) : nil updated_on = values["changed"] ? Time.utc(*values["changed"][0..3],*values["changed"][4..5],*values["changed"][6..7]) : nil Parser::Contact.new({ type: type, id: id, name: values["person"], email: values["e-mail"], created_on: created_on, updated_on: updated_on }) end