Skip to content
Browse files

WhoisTldEe now extends BaseWhoisd

  • Loading branch information...
1 parent e292ce1 commit 9ee0fda9ea3f47eee63b01fc7d1addf1680ce033 @weppos committed Jul 3, 2012
View
1 lib/whois/record/parser/NOTES.txt
@@ -77,7 +77,6 @@ whois.nic.wf (CNAME whois.nic.fr)
whois.nic.tf (CNAME whois.nic.fr)
whois.nic.yt (CNAME whois.nic.fr)
-whois.tld.ee
whois.pandi.or.id
whois.nic.ir
ripe.net
View
10 lib/whois/record/parser/base_whoisd.rb
@@ -77,8 +77,14 @@ class BaseWhoisd < Base
property_supported :nameservers do
- content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |name|
- Record::Nameserver.new(:name => name.strip)
+ content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
+ if line =~ /(.+) \((.+)\)/
+ name = $1
+ ipv4, ipv6 = $2.split(', ')
+ Record::Nameserver.new(:name => name, :ipv4 => ipv4, :ipv6 => ipv6)
+ else
+ Record::Nameserver.new(:name => line.strip)
+ end
end
end
View
13 lib/whois/record/parser/whois.nic.cz.rb
@@ -24,19 +24,6 @@ class Parser
# The Example parser for the list of all available methods.
#
class WhoisNicCz < BaseWhoisd
-
- property_supported :nameservers do
- content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
- if line =~ /(.+) \((.+)\)/
- name = $1
- ipv4, ipv6 = $2.split(", ")
- Record::Nameserver.new(:name => name, :ipv4 => ipv4, :ipv6 => ipv6)
- else
- Record::Nameserver.new(:name => line.strip)
- end
- end
- end
-
end
end
View
77 lib/whois/record/parser/whois.tld.ee.rb
@@ -7,7 +7,7 @@
#++
-require 'whois/record/parser/base'
+require 'whois/record/parser/base_whoisd'
require 'whois/record/scanners/whois.tld.ee.rb'
@@ -17,66 +17,16 @@ class Parser
# Parser for the whois.tld.ee 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.
- # See WhoisNicIt parser for an explanation of all available methods
- # and examples.
+ # @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.
+ #
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
- class WhoisTldEe < Base
+ class WhoisTldEe < BaseWhoisd
include Scanners::Ast
- property_supported :status do
- if content_for_scanner =~ /status:\s+(.+)\n/
- case $1.downcase
- when "paid and in zone" then :registered
- # NEWSTATUS (redemption?)
- when "expired" then :expired
- else
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
- end
- else
- :available
- end
- end
-
- property_supported :available? do
- !!(content_for_scanner =~ /^%ERROR:101: no entries found/)
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_supported :created_on do
- if content_for_scanner =~ /registered:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :updated_on do
- if content_for_scanner =~ /changed:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :expires_on do
- if content_for_scanner =~ /expire:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
-
- property_supported :registrar do
- if content_for_scanner =~ /registrar:\s+(.+)\n/
- Whois::Record::Registrar.new(
- :id => $1,
- :name => $1
- )
- end
- end
-
property_supported :admin_contacts do
if content_for_scanner =~ /admin-c:\s+(.+)\n/
build_contact($1, Whois::Record::Contact::TYPE_ADMIN)
@@ -92,17 +42,6 @@ class WhoisTldEe < Base
property_not_supported :technical_contacts
- property_supported :nameservers do
- content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
- if line =~ /(.+) \((.+)\)/
- Record::Nameserver.new(:name => $1, :ipv4 => $2)
- else
- Record::Nameserver.new(:name => line)
- end
- end
- end
-
-
# Initializes a new {Scanners::WhoisTldEe} instance
# passing the {#content_for_scanner}
# and calls +parse+ on it.

0 comments on commit 9ee0fda

Please sign in to comment.
Something went wrong with that request. Please try again.