Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added full whois.domainregistry.ie server.

  • Loading branch information...
commit ed0d6ffcaa08444850088aaefbc9e8e20cad9fd5 1 parent 73c88f8
@weppos authored
View
2  CHANGELOG.md
@@ -9,6 +9,8 @@
* NEW: Added full whois.cctld.by server (GH-154).
+* NEW: Added full whois.domainregistry.ie server.
+
* CHANGED: Moved scanners from Whois::Record::Parser::Scanners to Whois::Record::Scanners.
* FIXED: .IE availability checking returns incorrect results (GH-155)
View
65 lib/whois/record/parser/whois.domainregistry.ie.rb
@@ -15,20 +15,31 @@ module Whois
class Record
class Parser
- #
- # = whois.domainregistry.ie parser
- #
# Parser for the whois.domainregistry.ie 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 WhoisDomainregistryIe < Base
include Scanners::Ast
+ property_supported :disclaimer do
+ node("field:disclaimer")
+ end
+
+
+ property_supported :domain do
+ node("domain")
+ end
+
+ property_not_supported :domain_id
+
+
+ property_not_supported :referral_whois
+
+ property_not_supported :referral_url
+
+
property_supported :status do
case node("status", &:downcase)
when nil
@@ -58,6 +69,28 @@ class WhoisDomainregistryIe < Base
end
+ property_not_supported :registrar
+
+
+ property_supported :registrant_contacts do
+ node("descr") do |array|
+ Record::Contact.new(
+ :type => Whois::Record::Contact::TYPE_REGISTRANT,
+ :id => nil,
+ :name => array[0],
+ )
+ end
+ end
+
+ property_supported :admin_contacts do
+ build_contact("admin-c", Whois::Record::Contact::TYPE_ADMIN)
+ end
+
+ property_supported :technical_contacts do
+ build_contact("tech-c", Whois::Record::Contact::TYPE_TECHNICAL)
+ end
+
+
property_supported :nameservers do
Array.wrap(node("nserver")).map do |line|
name, ipv4 = line.split(/\s+/)
@@ -75,6 +108,20 @@ def parse
Scanners::WhoisDomainregistryIe.new(content_for_scanner).parse
end
+
+ private
+
+ def build_contact(element, type)
+ node(element) do |id|
+ contact = node("field:#{id}")
+ Record::Contact.new(
+ :type => type,
+ :id => id,
+ :name => contact["person"]
+ )
+ end
+ end
+
end
end
View
4 lib/whois/record/parser/whois.rnids.rs.rb
@@ -40,13 +40,13 @@ class WhoisRnidsRs < Base
property_supported :status do
- case s = node("Domain status") { |str| str.downcase }
+ case node("Domain status", &:downcase)
when nil
:available
when "active"
:registered
else
- Whois.bug!(ParserError, "Unknown status `#{s}'.")
+ Whois.bug!(ParserError, "Unknown status `#{node("Domain status")}'.")
end
end
View
13 lib/whois/record/scanners/whois.domainregistry.ie.rb
@@ -20,6 +20,7 @@ class WhoisDomainregistryIe < Base
self.tokenizers += [
:skip_empty_line,
:scan_copyright,
+ :scan_contact,
:scan_keyvalue,
:scan_available,
]
@@ -36,7 +37,17 @@ class WhoisDomainregistryIe < Base
while @input.scan(/^%(.+)\n/)
lines << @input[1].strip
end
- @ast["field:disclaimer"] = lines.join(" ")
+ @ast["field:disclaimer"] = lines.join("\n")
+ end
+ end
+
+ tokenizer :scan_contact do
+ if @input.match?(/^person:/)
+ lines = {}
+ while @input.scan(/(.+?):(.*?)\n/)
+ lines.merge! @input[1].strip => @input[2].strip
+ end
+ @ast["field:#{lines['nic-hdl']}"] = lines
end
end
View
34 spec/fixtures/responses/whois.domainregistry.ie/status_available.expected
@@ -1,3 +1,21 @@
+#disclaimer
+ should: %s == "Rights restricted by copyright; http://iedr.ie/index.php/mnudomregs/mnudnssearch/96\nDo not remove this notice"
+
+
+#domain
+ should: %s == nil
+
+#domain_id
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
+#referral_whois
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+#referral_url
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
#status
should: %s == :available
@@ -18,6 +36,22 @@
should: %s == nil
+#registrar
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+#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 == []
View
46 spec/fixtures/responses/whois.domainregistry.ie/status_registered.expected
@@ -1,3 +1,21 @@
+#disclaimer
+ should: %s == "Rights restricted by copyright; http://iedr.ie/index.php/mnudomregs/mnudnssearch/96\nDo not remove this notice"
+
+
+#domain
+ should: %s == "google.ie"
+
+#domain_id
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
+#referral_whois
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+#referral_url
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
#status
should: %s == :registered
@@ -19,6 +37,34 @@
should: %s == Time.parse("2013-03-21")
+#registrar
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+#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 == nil
+ should: %s[0].name == "Google, Inc"
+
+#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 == "KR59-IEDR"
+ should: %s[0].name == "Kulpreet Rana"
+
+#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 == "CCA7-IEDR"
+ should: %s[0].name == "eMarkmonitor Inc"
+
+
#nameservers
should: %s CLASS(array)
should: %s SIZE(3)
View
48 spec/whois/record/parser/responses/whois.domainregistry.ie/status_available_spec.rb
@@ -21,6 +21,31 @@
@parser = klass.new(part)
end
+ describe "#disclaimer" do
+ it do
+ @parser.disclaimer.should == "Rights restricted by copyright; http://iedr.ie/index.php/mnudomregs/mnudnssearch/96\nDo not remove this notice"
+ end
+ end
+ describe "#domain" do
+ it do
+ @parser.domain.should == nil
+ end
+ end
+ describe "#domain_id" do
+ it do
+ lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#referral_whois" do
+ it do
+ lambda { @parser.referral_whois }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#referral_url" do
+ it do
+ lambda { @parser.referral_url }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
describe "#status" do
it do
@parser.status.should == :available
@@ -51,6 +76,29 @@
@parser.expires_on.should == nil
end
end
+ describe "#registrar" do
+ it do
+ lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#registrant_contacts" do
+ it do
+ @parser.registrant_contacts.should be_a(Array)
+ @parser.registrant_contacts.should == []
+ end
+ end
+ describe "#admin_contacts" do
+ it do
+ @parser.admin_contacts.should be_a(Array)
+ @parser.admin_contacts.should == []
+ end
+ end
+ describe "#technical_contacts" do
+ it do
+ @parser.technical_contacts.should be_a(Array)
+ @parser.technical_contacts.should == []
+ end
+ end
describe "#nameservers" do
it do
@parser.nameservers.should be_a(Array)
View
60 spec/whois/record/parser/responses/whois.domainregistry.ie/status_registered_spec.rb
@@ -21,6 +21,31 @@
@parser = klass.new(part)
end
+ describe "#disclaimer" do
+ it do
+ @parser.disclaimer.should == "Rights restricted by copyright; http://iedr.ie/index.php/mnudomregs/mnudnssearch/96\nDo not remove this notice"
+ end
+ end
+ describe "#domain" do
+ it do
+ @parser.domain.should == "google.ie"
+ end
+ end
+ describe "#domain_id" do
+ it do
+ lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#referral_whois" do
+ it do
+ lambda { @parser.referral_whois }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#referral_url" do
+ it do
+ lambda { @parser.referral_url }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
describe "#status" do
it do
@parser.status.should == :registered
@@ -52,6 +77,41 @@
@parser.expires_on.should == Time.parse("2013-03-21")
end
end
+ describe "#registrar" do
+ it do
+ lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
+ describe "#registrant_contacts" do
+ it do
+ @parser.registrant_contacts.should be_a(Array)
+ @parser.registrant_contacts.should have(1).items
+ @parser.registrant_contacts[0].should be_a(Whois::Record::Contact)
+ @parser.registrant_contacts[0].type.should == Whois::Record::Contact::TYPE_REGISTRANT
+ @parser.registrant_contacts[0].id.should == nil
+ @parser.registrant_contacts[0].name.should == "Google, Inc"
+ end
+ end
+ describe "#admin_contacts" do
+ it do
+ @parser.admin_contacts.should be_a(Array)
+ @parser.admin_contacts.should have(1).items
+ @parser.admin_contacts[0].should be_a(Whois::Record::Contact)
+ @parser.admin_contacts[0].type.should == Whois::Record::Contact::TYPE_ADMIN
+ @parser.admin_contacts[0].id.should == "KR59-IEDR"
+ @parser.admin_contacts[0].name.should == "Kulpreet Rana"
+ end
+ end
+ describe "#technical_contacts" do
+ it do
+ @parser.technical_contacts.should be_a(Array)
+ @parser.technical_contacts.should have(1).items
+ @parser.technical_contacts[0].should be_a(Whois::Record::Contact)
+ @parser.technical_contacts[0].type.should == Whois::Record::Contact::TYPE_TECHNICAL
+ @parser.technical_contacts[0].id.should == "CCA7-IEDR"
+ @parser.technical_contacts[0].name.should == "eMarkmonitor Inc"
+ end
+ end
describe "#nameservers" do
it do
@parser.nameservers.should be_a(Array)
Please sign in to comment.
Something went wrong with that request. Please try again.