Permalink
Browse files

Added full whois.nic.us, whois.nic.travel, and whois.nic.tel parsers.

  • Loading branch information...
weppos committed Feb 24, 2013
1 parent 784eda9 commit d88c2d7fa5ceb412fd948525f2cb98458e529e2c
Showing with 717 additions and 235 deletions.
  1. +6 −0 CHANGELOG.md
  2. +4 −53 lib/whois/record/parser/whois.nic.tel.rb
  3. +4 −49 lib/whois/record/parser/whois.nic.travel.rb
  4. +4 −49 lib/whois/record/parser/whois.nic.us.rb
  5. +24 −1 spec/fixtures/responses/whois.nic.tel/status_available.expected
  6. +1 −1 spec/fixtures/responses/whois.nic.tel/status_available.txt
  7. +71 −4 spec/fixtures/responses/whois.nic.tel/status_registered.expected
  8. +63 −49 spec/fixtures/responses/whois.nic.tel/status_registered.txt
  9. +1 −1 spec/fixtures/responses/whois.nic.travel/property_status_single.expected
  10. +24 −1 spec/fixtures/responses/whois.nic.travel/status_available.expected
  11. +1 −1 spec/fixtures/responses/whois.nic.travel/status_available.txt
  12. +73 −6 spec/fixtures/responses/whois.nic.travel/status_registered.expected
  13. +6 −5 spec/fixtures/responses/whois.nic.travel/status_registered.txt
  14. +24 −1 spec/fixtures/responses/whois.nic.us/status_available.expected
  15. +67 −0 spec/fixtures/responses/whois.nic.us/status_registered.expected
  16. +34 −1 spec/whois/record/parser/responses/whois.nic.tel/status_available_spec.rb
  17. +81 −4 spec/whois/record/parser/responses/whois.nic.tel/status_registered_spec.rb
  18. +1 −1 spec/whois/record/parser/responses/whois.nic.travel/property_status_single_spec.rb
  19. +34 −1 spec/whois/record/parser/responses/whois.nic.travel/status_available_spec.rb
  20. +83 −6 spec/whois/record/parser/responses/whois.nic.travel/status_registered_spec.rb
  21. +34 −1 spec/whois/record/parser/responses/whois.nic.us/status_available_spec.rb
  22. +77 −0 spec/whois/record/parser/responses/whois.nic.us/status_registered_spec.rb
View
@@ -27,6 +27,12 @@
- NEW: whois.eu parser now recognizes throttled responses.
+- NEW: Added full whois.nic.us parser.
+
+- NEW: Added full whois.nic.travel parser.
+
+- NEW: Added full whois.nic.tel parser.
+
- CHANGED: Dropped support for Ruby 1.8
- CHANGED: Renamed Whois::Record::Scanners::Ast to Renamed Whois::Record::Scanners::Nodable
@@ -7,68 +7,19 @@
#++
-require 'whois/record/parser/base'
+require 'whois/record/parser/base_shared2'
module Whois
class Record
class Parser
- #
- # = whois.nic.tel parser
- #
# Parser for the whois.nic.tel 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.
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
- class WhoisNicTel < Base
-
- property_supported :status do
- if available?
- :available
- else
- :registered
- end
- end
-
- property_supported :available? do
- !!(content_for_scanner =~ /Not found:/)
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_supported :created_on do
- if content_for_scanner =~ /Domain Registration Date:\s+(.*)\n/
- Time.parse($1)
- end
- end
-
- property_supported :updated_on do
- if content_for_scanner =~ /Domain Last Updated Date:\s+(.*)\n/
- Time.parse($1)
- end
- end
-
- property_supported :expires_on do
- if content_for_scanner =~ /Domain Expiration Date:\s+(.*)\n/
- Time.parse($1)
- end
- end
-
-
- property_supported :nameservers do
- content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
- Record::Nameserver.new(:name => name.downcase)
- end
- end
-
+ class WhoisNicTel < BaseShared2
end
end
@@ -7,64 +7,19 @@
#++
-require 'whois/record/parser/base'
+require 'whois/record/parser/base_shared2'
module Whois
class Record
class Parser
- #
- # = whois.nic.travel parser
- #
# Parser for the whois.nic.travel 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.
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
- class WhoisNicTravel < Base
-
- property_supported :status do
- content_for_scanner.scan(/Domain Status:\s+(.+?)\n/).flatten
- end
-
- property_supported :available? do
- !!(content_for_scanner =~ /Not found:/)
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_supported :created_on do
- if content_for_scanner =~ /Domain Registration Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :updated_on do
- if content_for_scanner =~ /Domain Last Updated Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :expires_on do
- if content_for_scanner =~ /Domain Expiration Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
-
- property_supported :nameservers do
- content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
- Record::Nameserver.new(:name => name.downcase)
- end
- end
-
+ class WhoisNicTravel < BaseShared2
end
end
@@ -7,64 +7,19 @@
#++
-require 'whois/record/parser/base'
+require 'whois/record/parser/base_shared2'
module Whois
class Record
class Parser
- #
- # = whois.nic.us parser
- #
# Parser for the whois.nic.us 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.
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
#
- class WhoisNicUs < Base
-
- property_supported :status do
- content_for_scanner.scan(/Domain Status:\s+(.+?)\n/).flatten
- end
-
- property_supported :available? do
- !!(content_for_scanner =~ /Not found:/)
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_supported :created_on do
- if content_for_scanner =~ /Domain Registration Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :updated_on do
- if content_for_scanner =~ /Domain Last Updated Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :expires_on do
- if content_for_scanner =~ /Domain Expiration Date:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
-
- property_supported :nameservers do
- content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
- Record::Nameserver.new(:name => name.downcase)
- end
- end
-
+ class WhoisNicUs < BaseShared2
end
end
@@ -1,5 +1,12 @@
+#domain
+ should: %s == "u34jedzcq.tel"
+
+#domain_id
+ should: %s == nil
+
+
#status
- should: %s == :available
+ should: %s == nil
#available?
should: %s == true
@@ -18,6 +25,22 @@
should: %s == nil
+#registrar
+ should: %s == nil
+
+#registrant_contacts
+ should: %s CLASS(array)
+ should: %s == []
+
+#admin_contacts
+ should: %s CLASS(array)
+ should: %s == []
+
+#technical_contacts
+ should: %s CLASS(array)
+ should: %s == []
+
+
#nameservers
should: %s CLASS(array)
should: %s == []
@@ -1,6 +1,6 @@
Not found: u34jedzcq.tel
->>>> Whois database was last updated on: Wed Dec 23 18:30:16 GMT 2009 <<<<
+>>>> Whois database was last updated on: Sun Feb 24 18:30:38 GMT 2013 <<<<
Telnic, Ltd., the Registry Operator for .TEL, has collected this information
for the WHOIS database through an ICANN-Accredited Registrar. This information
@@ -1,5 +1,12 @@
+#domain
+ should: %s == "google.tel"
+
+#domain_id
+ should: %s == "D587349-TEL"
+
+
#status
- should: %s == :registered
+ should: %s == ["clientDeleteProhibited", "clientTransferProhibited", "clientUpdateProhibited"]
#available?
should: %s == false
@@ -10,15 +17,75 @@
#created_on
should: %s CLASS(time)
- should: %s == Time.parse("2009-04-19 12:36:25 UTC")
+ should: %s == Time.parse("2009-03-23 23:59:59 GMT")
#updated_on
should: %s CLASS(time)
- should: %s == Time.parse("2009-04-20 12:39:49 UTC")
+ should: %s == Time.parse("2013-02-19 10:23:33 GMT")
#expires_on
should: %s CLASS(time)
- should: %s == Time.parse("2010-04-18 23:59:59 UTC")
+ should: %s == Time.parse("2014-03-22 23:59:59 GMT")
+
+
+#registrar
+ should: %s CLASS(registrar)
+ should: %s.id == "292"
+ should: %s.name == "MARKMONITOR, INC."
+
+#registrant_contacts
+ should: %s CLASS(array)
+ should: %s SIZE(1)
+ should: %s[0] CLASS(contact)
+ should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
+ should: %s[0].id == "MMR-2383"
+ should: %s[0].name == "DNS Admin"
+ should: %s[0].organization == "Google Inc."
+ should: %s[0].address == "1600 Amphitheatre Parkway"
+ should: %s[0].city == "Mountain View"
+ should: %s[0].zip == "94043"
+ should: %s[0].state == "CA"
+ should: %s[0].country == "United States"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.6502530000"
+ should: %s[0].fax == "+1.6506188571"
+ should: %s[0].email == "dns-admin@google.com"
+
+#admin_contacts
+ should: %s CLASS(array)
+ should: %s SIZE(1)
+ should: %s[0] CLASS(contact)
+ should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
+ should: %s[0].id == "MMR-2383"
+ should: %s[0].name == "DNS Admin"
+ should: %s[0].organization == "Google Inc."
+ should: %s[0].address == "1600 Amphitheatre Parkway"
+ should: %s[0].city == "Mountain View"
+ should: %s[0].zip == "94043"
+ should: %s[0].state == "CA"
+ should: %s[0].country == "United States"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.6502530000"
+ should: %s[0].fax == "+1.6506188571"
+ should: %s[0].email == "dns-admin@google.com"
+
+#technical_contacts
+ should: %s CLASS(array)
+ should: %s SIZE(1)
+ should: %s[0] CLASS(contact)
+ should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
+ should: %s[0].id == "MMR-2383"
+ should: %s[0].name == "DNS Admin"
+ should: %s[0].organization == "Google Inc."
+ should: %s[0].address == "1600 Amphitheatre Parkway"
+ should: %s[0].city == "Mountain View"
+ should: %s[0].zip == "94043"
+ should: %s[0].state == "CA"
+ should: %s[0].country == "United States"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.6502530000"
+ should: %s[0].fax == "+1.6506188571"
+ should: %s[0].email == "dns-admin@google.com"
#nameservers
Oops, something went wrong.

0 comments on commit d88c2d7

Please sign in to comment.