forked from weppos/whois
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple .gd, vg, tc TLD parser (whois.adamsnames.tc).
- Loading branch information
Showing
11 changed files
with
291 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# = Ruby Whois | ||
# | ||
# An intelligent pure Ruby WHOIS client and parser. | ||
# | ||
# | ||
# Category:: Net | ||
# Package:: Whois | ||
# Author:: Simone Carletti <weppos@weppos.net> | ||
# License:: MIT License | ||
# | ||
#-- | ||
# | ||
#++ | ||
|
||
|
||
require 'whois/answer/parser/base' | ||
|
||
|
||
module Whois | ||
class Answer | ||
class Parser | ||
|
||
# | ||
# = whois.adamsnames.tc | ||
# | ||
# Parser for the whois.adamsnames.tc 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. | ||
# | ||
class WhoisAdamsnamesTc < Base | ||
|
||
property_supported :status do | ||
@status ||= if available? | ||
:available | ||
else | ||
:registered | ||
end | ||
end | ||
|
||
property_supported :available? do | ||
@available ||= !!(content.to_s =~ /is not registered/) | ||
end | ||
|
||
property_supported :registered? do | ||
!available? | ||
end | ||
|
||
|
||
property_not_supported :created_on | ||
|
||
property_not_supported :updated_on | ||
|
||
property_not_supported :expires_on | ||
|
||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
require 'test_helper' | ||
require 'whois/answer/parser/whois.adamsnames.tc.rb' | ||
|
||
class AnswerParserWhoisAdamsnamesTcTest < Whois::Answer::Parser::TestCase | ||
|
||
def setup | ||
@klass = Whois::Answer::Parser::WhoisAdamsnamesTc | ||
@host = "whois.adamsnames.tc" | ||
end | ||
|
||
end | ||
|
||
class AnswerParserWhoisAdamsnamesTcGdTest < AnswerParserWhoisAdamsnamesTcTest | ||
|
||
def test_status | ||
assert_equal :registered, | ||
@klass.new(load_part('/gd/registered.txt')).status | ||
assert_equal :available, | ||
@klass.new(load_part('/gd/available.txt')).status | ||
end | ||
|
||
def test_available? | ||
assert !@klass.new(load_part('/gd/registered.txt')).available? | ||
assert @klass.new(load_part('/gd/available.txt')).available? | ||
end | ||
|
||
def test_registered? | ||
assert @klass.new(load_part('/gd/registered.txt')).registered? | ||
assert !@klass.new(load_part('/gd/available.txt')).registered? | ||
end | ||
|
||
|
||
def test_created_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/registered.txt')).created_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/available.txt')).created_on } | ||
end | ||
|
||
def test_updated_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/registered.txt')).updated_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/available.txt')).updated_on } | ||
end | ||
|
||
def test_expires_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/registered.txt')).expires_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/gd/available.txt')).expires_on } | ||
end | ||
|
||
end | ||
|
||
class AnswerParserWhoisAdamsnamesTcTcTest < AnswerParserWhoisAdamsnamesTcTest | ||
|
||
def test_status | ||
assert_equal :registered, | ||
@klass.new(load_part('/tc/registered.txt')).status | ||
assert_equal :available, | ||
@klass.new(load_part('/tc/available.txt')).status | ||
end | ||
|
||
def test_available? | ||
assert !@klass.new(load_part('/tc/registered.txt')).available? | ||
assert @klass.new(load_part('/tc/available.txt')).available? | ||
end | ||
|
||
def test_registered? | ||
assert @klass.new(load_part('/tc/registered.txt')).registered? | ||
assert !@klass.new(load_part('/tc/available.txt')).registered? | ||
end | ||
|
||
|
||
def test_created_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/registered.txt')).created_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/available.txt')).created_on } | ||
end | ||
|
||
def test_updated_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/registered.txt')).updated_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/available.txt')).updated_on } | ||
end | ||
|
||
def test_expires_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/registered.txt')).expires_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/tc/available.txt')).expires_on } | ||
end | ||
|
||
end | ||
|
||
class AnswerParserWhoisAdamsnamesTcVgTest < AnswerParserWhoisAdamsnamesTcTest | ||
|
||
def test_status | ||
assert_equal :registered, | ||
@klass.new(load_part('/vg/registered.txt')).status | ||
assert_equal :available, | ||
@klass.new(load_part('/vg/available.txt')).status | ||
end | ||
|
||
def test_available? | ||
assert !@klass.new(load_part('/vg/registered.txt')).available? | ||
assert @klass.new(load_part('/vg/available.txt')).available? | ||
end | ||
|
||
def test_registered? | ||
assert @klass.new(load_part('/vg/registered.txt')).registered? | ||
assert !@klass.new(load_part('/vg/available.txt')).registered? | ||
end | ||
|
||
|
||
def test_created_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/registered.txt')).created_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/available.txt')).created_on } | ||
end | ||
|
||
def test_updated_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/registered.txt')).updated_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/available.txt')).updated_on } | ||
end | ||
|
||
def test_expires_on | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/registered.txt')).expires_on } | ||
assert_raise(Whois::PropertyNotSupported) { @klass.new(load_part('/vg/available.txt')).expires_on } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/testcases/responses/whois.adamsnames.tc/gd/available.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
No | ||
u34jedzcq.gd is not registered. |
26 changes: 26 additions & 0 deletions
26
test/testcases/responses/whois.adamsnames.tc/gd/registered.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Yes | ||
google.gd is registered. | ||
|
||
Domain Name: google.gd | ||
|
||
Registrant, Technical Contact, Admin. Contact | ||
Google, Inc. | ||
1600 Amphitheatre Parkway, Mountain View, CA, 94043 | ||
United States | ||
E-mail: dns-admin@google.com | ||
Phone: +1 650 330 0100 x1005 | ||
Fax: +1 650 618 1499 | ||
|
||
Billing Contact | ||
MarkMonitor | ||
PMB 155, 10400 Overland Road, Boise, Idaho 83709 | ||
United States | ||
E-mail: ccops@markmonitor.com | ||
Phone: +1.2083895740 | ||
Fax: +1.208389 5771 | ||
|
||
Resource Records (2): | ||
ns ns1.google.com | ||
ns ns2.google.com | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
test/testcases/responses/whois.adamsnames.tc/tc/available.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
No | ||
u34jedzcq.tc is not registered. |
28 changes: 28 additions & 0 deletions
28
test/testcases/responses/whois.adamsnames.tc/tc/registered.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Yes | ||
google.tc is registered. | ||
|
||
Domain Name: google.tc | ||
|
||
Registrant, Technical Contact, Admin. Contact | ||
Google, Inc. | ||
1600 Amphitheatre Parkway, Mountain View, CA, 94043 | ||
United States | ||
E-mail: dns-admin@google.com | ||
Phone: +1 650 330 0100 x1005 | ||
Fax: +1 650 618 1499 | ||
|
||
Billing Contact | ||
MarkMonitor | ||
PMB 155, 10400 Overland Road, Boise, Idaho 83709 | ||
United States | ||
E-mail: ccops@markmonitor.com | ||
Phone: +1.2083895740 | ||
Fax: +1.208389 5771 | ||
|
||
Resource Records (4): | ||
ns ns1.google.com | ||
ns ns2.google.com | ||
ns ns3.google.com | ||
ns ns4.google.com | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
test/testcases/responses/whois.adamsnames.tc/vg/available.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
No | ||
u34jedzcq.vg is not registered. |
28 changes: 28 additions & 0 deletions
28
test/testcases/responses/whois.adamsnames.tc/vg/registered.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Yes | ||
google.vg is registered. | ||
|
||
Domain Name: google.vg | ||
|
||
Registrant, Technical Contact, Admin. Contact | ||
Google, Inc. | ||
1600 Amphitheatre Parkway, Mountain View, CA, 94043 | ||
United States | ||
E-mail: dns-admin@google.com | ||
Phone: +1 650 330 0100 x1005 | ||
Fax: +1 650 618 1499 | ||
|
||
Billing Contact | ||
MarkMonitor | ||
PMB 155, 10400 Overland Road, Boise, Idaho 83709 | ||
United States | ||
E-mail: ccops@markmonitor.com | ||
Phone: +1.2083895740 | ||
Fax: +1.208389 5771 | ||
|
||
Resource Records (4): | ||
ns ns1.google.com | ||
ns ns2.google.com | ||
ns ns3.google.com | ||
ns ns4.google.com | ||
|
||
|