Skip to content
Browse files

whois.je changed response format (closes GH-123)

  • Loading branch information...
1 parent 90ad1b4 commit 62bc57af374aabf27e9dc73aaf469a58a801bf12 @weppos committed Oct 26, 2011
View
2 CHANGELOG.md
@@ -2,6 +2,8 @@
## master
+* CHANGED: whois.je changed response format (GH-123).
+
* FIXED: whois.nic.ht parser must support `Delegated' status.
* FIXED: whois.nic.mu parser must support `Delegated' status.
View
24 lib/whois/record/parser/whois.je.rb
@@ -28,10 +28,12 @@ class Parser
class WhoisJe < Base
property_supported :status do
- if content_for_scanner =~ /status:(.+?)\n/
+ if content_for_scanner =~ /Status:\s+(.+?)\n/
case $1.downcase
- when "0" then :available
- when "1" then :registered
+ when "active"
+ :registered
+ when "not registered"
+ :available
else
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
end
@@ -49,17 +51,25 @@ class WhoisJe < Base
end
- property_not_supported :created_on
+ property_supported :created_on do
+ if content_for_scanner =~ /Created:\s+(.+?)\n/
+ Time.parse($1)
+ end
+ end
- property_not_supported :updated_on
+ property_supported :updated_on do
+ if content_for_scanner =~ /Modified:\s+(.+?)\n/
+ Time.parse($1)
+ end
+ end
property_not_supported :expires_on
property_supported :nameservers do
- if content_for_scanner =~ /Registered Nameservers\n[-]+\n((.+\n)+)\n/
+ if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
$1.split("\n").map do |name|
- Record::Nameserver.new(name.chomp("."))
+ Record::Nameserver.new(name.strip)
end
end
end
View
4 spec/fixtures/responses/whois.je/status_available.expected
@@ -9,10 +9,10 @@
#created_on
- should: %s raise_error(Whois::PropertyNotSupported)
+ should: %s == nil
#updated_on
- should: %s raise_error(Whois::PropertyNotSupported)
+ should: %s == nil
#expires_on
should: %s raise_error(Whois::PropertyNotSupported)
View
53 spec/fixtures/responses/whois.je/status_available.txt
@@ -1,26 +1,33 @@
-status:0
+This information is provided free of charge from the Channel Islands'
+Register of Internet Names. The copyright and database rights in this
+information and in the contents are owned by Island Networks (Jersey) Ltd.
+whose registered office is at 10 Hilgrove St, St Helier JE4 8SU
+
+WHOIS query results shown may lag behind the Register.
+
+You may not access this server or use any data obtained from it
+without written licence except for private, non-commercial use for the
+purpose(s) of determining availability of, or confirming registration of
+a domain name on the Register.
+
+Any other use constitutes unauthorised access to a computer,
+which is a statutory offence under the Computer Misuse
+(Jersey) Law 1995, and/or similar legislation
+in other parts of the British Islands and elsewhere.
+
+Furthermore, you may never do any of the following
+
+(a) use data obtained from this server for advertising;
+(b) repackage, reuse or redistribute the data;
+(c) obscure, remove or hide any or all of this notice; or
+(d) make excessive queries.
+
+Access may be withdrawn or restricted at any time
+without notice.
+
+Domain Information
+Query: u34jedzcq.je
+Status: Not Registered
-** No information found in WHOIS **
-
-
-This information is provided free of charge from the Channel Islands' Register
-of Internet Names. This information and the contents of the Register are:
-
- Copyright (c) & database right
- Island Networks & Island Networks (Jersey), 1996-2010
-
-You may not access this server or use any data from it except for
-private, non-commercial use in order to determine availability of, or
-confirm registration of a domain name on the Register. Any other use will
-constitute unauthorised access to a computer system, which is an offence
-under the Computer Misuse (Bailiwick of Guernsey) Law 1991, and/or
-similar legislation in other jurisdictions.
-
-In particular, you may not (a) use the data for advertising, (b) repackage,
-reuse or redistribute the data, (c) obscure, remove or hide any or all of
-this notice or (d) make excessive queries.
-
-The data is provided on an 'as-is' basis and results given may lag behind
-the Register. Access may be withdrawn or restricted at any time without notice.
View
12 spec/fixtures/responses/whois.je/status_registered.expected
@@ -9,10 +9,12 @@
#created_on
- should: %s raise_error(Whois::PropertyNotSupported)
+ should: %s be_a(Time)
+ should: %s == Time.parse("2002-10-31 00:00:00 UTC")
#updated_on
- should: %s raise_error(Whois::PropertyNotSupported)
+ should: %s be_a(Time)
+ should: %s == Time.parse("2011-10-05 14:28:00 UTC")
#expires_on
should: %s raise_error(Whois::PropertyNotSupported)
@@ -24,8 +26,8 @@
should: %s[0] be_a(_nameserver)
should: %s[0].name == "ns1.google.com"
should: %s[1] be_a(_nameserver)
- should: %s[1].name == "ns3.google.com"
+ should: %s[1].name == "ns2.google.com"
should: %s[2] be_a(_nameserver)
- should: %s[2].name == "ns2.google.com"
+ should: %s[2].name == "ns4.google.com"
should: %s[3] be_a(_nameserver)
- should: %s[3].name == "ns4.google.com"
+ should: %s[3].name == "ns3.google.com"
View
83 spec/fixtures/responses/whois.je/status_registered.txt
@@ -1,32 +1,53 @@
-status:1
+This information is provided free of charge from the Channel Islands'
+Register of Internet Names. The copyright and database rights in this
+information and in the contents are owned by Island Networks (Jersey) Ltd.
+whose registered office is at 10 Hilgrove St, St Helier JE4 8SU
+
+WHOIS query results shown may lag behind the Register.
+
+You may not access this server or use any data obtained from it
+without written licence except for private, non-commercial use for the
+purpose(s) of determining availability of, or confirming registration of
+a domain name on the Register.
+
+Any other use constitutes unauthorised access to a computer,
+which is a statutory offence under the Computer Misuse
+(Jersey) Law 1995, and/or similar legislation
+in other parts of the British Islands and elsewhere.
+
+Furthermore, you may never do any of the following
+
+(a) use data obtained from this server for advertising;
+(b) repackage, reuse or redistribute the data;
+(c) obscure, remove or hide any or all of this notice; or
+(d) make excessive queries.
+
+Access may be withdrawn or restricted at any time
+without notice.
+
+Domain Information
+Query: google.je
+Status: Active
+Created: 31 Oct 2002 00:00 UTC
+Modified: 05 Oct 2011 14:28 UTC
+Name Servers:
+ ns1.google.com
+ ns2.google.com
+ ns4.google.com
+ ns3.google.com
+
+Registrar Information
+Registrar Name: Markmonitor
+Registration URL: http://www.markmonitor.com
+
+
+
+
+Registrant:
+Name: Google Inc.
+Organisation: Google Inc.
+Address:
+ 1600 Amphitheatre Parkway
+ Mountain View, CA 94043
+ US
-Domain is Registered.
-
-Registered Nameservers
-----------------------
-ns1.google.com.
-ns3.google.com.
-ns2.google.com.
-ns4.google.com.
-
-
-
-This information is provided free of charge from the Channel Islands' Register
-of Internet Names. This information and the contents of the Register are:
-
- Copyright (c) & database right
- Island Networks & Island Networks (Jersey), 1996-2010
-
-You may not access this server or use any data from it except for
-private, non-commercial use in order to determine availability of, or
-confirm registration of a domain name on the Register. Any other use will
-constitute unauthorised access to a computer system, which is an offence
-under the Computer Misuse (Bailiwick of Guernsey) Law 1991, and/or
-similar legislation in other jurisdictions.
-
-In particular, you may not (a) use the data for advertising, (b) repackage,
-reuse or redistribute the data, (c) obscure, remove or hide any or all of
-this notice or (d) make excessive queries.
-
-The data is provided on an 'as-is' basis and results given may lag behind
-the Register. Access may be withdrawn or restricted at any time without notice.
View
4 spec/whois/record/parser/responses/whois.je/status_available_spec.rb
@@ -38,12 +38,12 @@
end
describe "#created_on" do
it do
- lambda { @parser.created_on }.should raise_error(Whois::PropertyNotSupported)
+ @parser.created_on.should == nil
end
end
describe "#updated_on" do
it do
- lambda { @parser.updated_on }.should raise_error(Whois::PropertyNotSupported)
+ @parser.updated_on.should == nil
end
end
describe "#expires_on" do
View
12 spec/whois/record/parser/responses/whois.je/status_registered_spec.rb
@@ -38,12 +38,14 @@
end
describe "#created_on" do
it do
- lambda { @parser.created_on }.should raise_error(Whois::PropertyNotSupported)
+ @parser.created_on.should be_a(Time)
+ @parser.created_on.should == Time.parse("2002-10-31 00:00:00 UTC")
end
end
describe "#updated_on" do
it do
- lambda { @parser.updated_on }.should raise_error(Whois::PropertyNotSupported)
+ @parser.updated_on.should be_a(Time)
+ @parser.updated_on.should == Time.parse("2011-10-05 14:28:00 UTC")
end
end
describe "#expires_on" do
@@ -58,11 +60,11 @@
@parser.nameservers[0].should be_a(_nameserver)
@parser.nameservers[0].name.should == "ns1.google.com"
@parser.nameservers[1].should be_a(_nameserver)
- @parser.nameservers[1].name.should == "ns3.google.com"
+ @parser.nameservers[1].name.should == "ns2.google.com"
@parser.nameservers[2].should be_a(_nameserver)
- @parser.nameservers[2].name.should == "ns2.google.com"
+ @parser.nameservers[2].name.should == "ns4.google.com"
@parser.nameservers[3].should be_a(_nameserver)
- @parser.nameservers[3].name.should == "ns4.google.com"
+ @parser.nameservers[3].name.should == "ns3.google.com"
end
end
end

0 comments on commit 62bc57a

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