Permalink
Browse files

whois.coza.net.za became whois.registry.net.za (closes GH-191). [Thanks

  • Loading branch information...
2 parents 2132242 + a03472d commit 1ba3858876051857d145da709f18b65fa22a1e8f @weppos committed Dec 9, 2012
View
@@ -5,7 +5,7 @@
- SERVER: Added .AX TLD definition.
-- SERVER: Updated .AZ, .FM, .MC, .HN, .PH, .PW, .RW, .TD, .COM.UY, .VN TLD definitions.
+- SERVER: Updated .AZ, .CO.ZA, .FM, .MC, .HN, .PH, .PW, .RW, .TD, .COM.UY, .VN TLD definitions.
- SERVER: Added .XN--MGBX4CD0AB (.مليسيا, Malaysia) IDN TLD definition.
@@ -71,6 +71,8 @@
- CHANGED: Updated whois.thnic.co.th parser to the new response format (GH-194). [Thanks @ATimofeev]
+- CHANGED: whois.coza.net.za became whois.registry.net.za (GH-191). [Thanks @rorymckinley]
+
- FIXED: whois.domainregistry.ie should support status `Active - LOCKED`.
- FIXED: whois.nic.uk fails to parse registrars without URL (GH-188).
@@ -325,7 +325,7 @@
Whois::Server.define :tld, ".ye", nil, { :adapter => :none }
Whois::Server.define :tld, ".yt", "whois.nic.fr"
Whois::Server.define :tld, ".ac.za", "whois.ac.za"
-Whois::Server.define :tld, ".co.za", "whois.coza.net.za"
+Whois::Server.define :tld, ".co.za", "whois.registry.net.za"
Whois::Server.define :tld, ".gov.za", "whois.gov.za"
Whois::Server.define :tld, ".org.za", "whois.org.za"
Whois::Server.define :tld, ".za", nil, { :adapter => :none }
@@ -1,71 +0,0 @@
-#--
-# Ruby Whois
-#
-# An intelligent pure Ruby WHOIS client and parser.
-#
-# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
-#++
-
-
-require 'whois/record/parser/base'
-
-
-module Whois
- class Record
- class Parser
-
- #
- # = whois.coza.net.za parser
- #
- # Parser for the whois.coza.net.za server.
- #
- class WhoisCozaNetZa < Base
-
- property_not_supported :disclaimer
-
-
- property_not_supported :domain
-
- property_not_supported :domain_id
-
-
- property_supported :status do
- if available?
- :available
- else
- :registered
- end
- end
-
- property_supported :available? do
- content_for_scanner.strip == "Available"
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_not_supported :created_on
-
- property_not_supported :updated_on
-
- property_not_supported :expires_on
-
-
- property_not_supported :registrar
-
- property_not_supported :registrant_contacts
-
- property_not_supported :admin_contacts
-
- property_not_supported :technical_contacts
-
-
- property_not_supported :nameservers
-
- end
-
- end
- end
-end
@@ -0,0 +1,121 @@
+require 'whois/record/parser/base'
+require 'whois/record/scanners/whois.registry.net.za'
+
+
+module Whois
+ class Record
+ class Parser
+ # Parser for the whois.registry.za.net 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 Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
+ #
+ class WhoisRegistryNetZa < Base
+ include Scanners::Nodable
+
+ property_supported :disclaimer do
+ node("field:disclaimer")
+ end
+
+ property_supported :domain do
+ node("field:domain_name")
+ end
+
+ property_not_supported :domain_id
+
+ property_not_supported :referral_whois
+
+ property_not_supported :referral_url
+
+ property_supported :status do
+ node("field:status")
+ end
+
+ property_supported :available? do
+ node("status:available") ? true : false
+ end
+
+ property_supported :registered? do
+ !available?
+ end
+
+ property_supported :created_on do
+ node("field:dates") do
+ node("field:dates") =~ /Registration Date:\s*(\d{4}-\d{2}-\d{2})/
+ parse_date($1)
+ end
+ end
+
+ property_not_supported :updated_on
+
+ property_supported :expires_on do
+ node("field:dates") do
+ node("field:dates") =~ /Renewal Date:\s*(\d{4}-\d{2}-\d{2})/
+ parse_date($1)
+ end
+ end
+
+ property_supported :registrar do
+ node("field:registrar") do
+ node("field:registrar") =~ /(.+) \[ ID = (.+) \]/
+ Whois::Record::Registrar.new(:name => $1.strip, :id => $2.strip)
+ end
+ end
+
+ # The response for this property gets wrapped in an array by Whois::Record::Parser::Base#handle_property
+ property_supported :registrant_contacts do
+ node("field:registrant_details") do
+ build_registrant_contacts
+ end
+ end
+
+ property_not_supported :admin_contacts
+
+ property_not_supported :technical_contacts
+
+ property_supported :nameservers do
+ node("field:nameservers") do
+ nameservers = node("field:nameservers").gsub(/\n\s+/, ",").split(",")
+ Array.wrap(nameservers).map do |nameserver|
+ Record::Nameserver.new(:name => nameserver)
+ end
+ end
+ end
+
+ def parse
+ Scanners::WhoisRegistryNetZa.new(content_for_scanner).parse
+ end
+
+ private
+
+ def build_registrant_contacts
+ Whois::Record::Contact.new(
+ {:type => Whois::Record::Contact::TYPE_REGISTRANT}.merge(registrant_details).merge(registrant_address_details)
+ )
+ end
+
+ def registrant_details
+ registrant_lines = node("field:registrant_details").split("\n")
+ details = { :name => registrant_lines.shift }
+ [:email, :phone, :fax].each do |contact_method|
+ details[contact_method] = registrant_lines.shift.split(":").last.strip
+ end
+ details
+ end
+
+ def registrant_address_details
+ { :address => node("field:registrant_address").gsub(/\n\s+/, " ") }
+ end
+
+ def parse_date(date_string)
+ Time.parse(date_string) if date_string
+ end
+
+ end
+ end
+ end
+end
@@ -0,0 +1,101 @@
+#--
+# Ruby Whois
+#
+# An intelligent pure Ruby WHOIS client and parser.
+#
+# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
+#++
+
+require 'whois/record/scanners/base'
+
+module Whois
+ class Record
+ module Scanners
+
+ class WhoisRegistryNetZa < Base
+ self.tokenizers += [
+ :get_availability,
+ :get_domain_name,
+ :get_registrant_details,
+ :get_registrant_address,
+ :get_registrar_details,
+ :get_dates,
+ :get_status,
+ :get_pending_timer_events,
+ :get_nameservers,
+ :get_disclaimer
+ ]
+
+ tokenizer :get_availability do
+ if @input.scan_until(/^Available\n$/m)
+ @ast["status:available"] = true
+ end
+ end
+
+ tokenizer :get_domain_name do
+ if find_heading("Domain Name")
+ @ast["field:domain_name"] = content_in_category
+ end
+ end
+
+ tokenizer :get_registrant_details do
+ if find_heading("Registrant")
+ @ast["field:registrant_details"] = content_in_category
+ end
+ end
+
+ tokenizer :get_registrant_address do
+ if find_heading("Registrant's Address")
+ @ast["field:registrant_address"] = content_in_category
+ end
+ end
+
+ tokenizer :get_registrar_details do
+ if find_heading("Registrar")
+ @ast["field:registrar"] = content_in_category
+ end
+ end
+
+ tokenizer :get_dates do
+ if find_heading("Relevant Dates")
+ @ast["field:dates"] = content_in_category
+ end
+ end
+
+ tokenizer :get_status do
+ if find_heading("Domain Status")
+ statuses = content_in_category
+ @ast["field:status"] = statuses.split(", ")
+ end
+ end
+
+ tokenizer :get_pending_timer_events do
+ if find_heading("Pending Timer Events")
+ @ast["field:pending_timer_events"] = content_in_category
+ end
+ end
+
+ tokenizer :get_nameservers do
+ if find_heading("Name Servers")
+ @ast["field:nameservers"] = content_in_category
+ end
+ end
+
+ tokenizer :get_disclaimer do
+ @input.skip_until(/\n--\n/m)
+ @ast["field:disclaimer"] = @input.scan_until(/.*$/m)
+ end
+
+ private
+
+ def content_in_category
+ @input.scan_until(/(?=\n [A-Z])/).strip
+ end
+
+ def find_heading(heading_name)
+ @input.skip_until(/ #{heading_name}:\n/)
+ end
+ end
+ end
+ end
+end
@@ -1,46 +0,0 @@
-#disclaimer
- should: %s raise_error(Whois::PropertyNotSupported)
-
-
-#domain
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#domain_id
- should: %s raise_error(Whois::PropertyNotSupported)
-
-
-#status
- should: %s == :available
-
-#available?
- should: %s == true
-
-#registered?
- should: %s == false
-
-
-#created_on
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#updated_on
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#expires_on
- should: %s raise_error(Whois::PropertyNotSupported)
-
-
-#registrar
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#registrant_contacts
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#admin_contacts
- should: %s raise_error(Whois::PropertyNotSupported)
-
-#technical_contacts
- should: %s raise_error(Whois::PropertyNotSupported)
-
-
-#nameservers
- should: %s raise_error(Whois::PropertyNotSupported)
Oops, something went wrong.

0 comments on commit 1ba3858

Please sign in to comment.