Permalink
Browse files

Merge pull request #10 from cramerdev/publicdomainregistry

Create whois.publicdomainregistry.com and whois.resellerclub.com parsers
  • Loading branch information...
2 parents 173ad53 + d0081f6 commit 760eaa0559e819e6641d8fb5382c2a3ae7ffefed Travis Palmer committed Jun 20, 2012
@@ -0,0 +1,102 @@
+#--
+# 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
+ # Parser for the whois.publicdomainregistry.com server.
+ #
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
+ #
+ # @author Justin Campbell <justin@cramerdev.me>
+ #
+ class WhoisPublicdomainregistryCom < Base
+ property_supported(:status) { :registered }
+ property_supported(:available?) { false }
+ property_supported(:registered?) { true }
+
+ property_supported(:updated_on) { nil }
+
+ property_supported :created_on do
+ if content_for_scanner =~ /Creation Date: (.+)$/
+ Time.parse($1)
+ end
+ end
+
+ property_supported :expires_on do
+ if content_for_scanner =~ /Expiration Date: (.+)$/
+ Time.parse($1)
+ end
+ end
+
+ property_supported :registrar do
+ Record::Registrar.new(
+ :name => "PublicDomainRegistry.com",
+ :organization => "Directi Internet Solutions Pvt. Ltd.",
+ :url => "http://publicdomainregistry.com"
+ )
+ end
+
+ property_supported :registrant_contacts do
+ build_contact('Registrant', Record::Contact::TYPE_REGISTRANT)
+ end
+
+ property_supported :admin_contacts do
+ build_contact('Administrative Contact', Record::Contact::TYPE_ADMIN)
+ end
+
+ property_supported :technical_contacts do
+ build_contact('Technical Contact', Record::Contact::TYPE_TECHNICAL)
+ end
+
+ property_supported :nameservers do
+ if content_for_scanner =~ /Domain servers in listed order:\n((?:[^\n]+\n)+)/
+ $1.split("\n").map do |line|
+ Record::Nameserver.new(:name => line.strip.downcase)
+ end
+ end
+ end
+
+ private
+
+ def build_contact(element, type)
+ content_match = content_for_scanner.match(/#{element}\:\n((\s+.*){4,9})/)
+ return unless content_match
+ contact = content_match[1]
+ return unless contact
+
+ contact = contact.lines.map(&:strip).join("\n")
+
+ match = contact.match(/
+ (?<organization>.+)\n
+ (?<name>.+)\s+\((?<email>.+@.+)\)\n
+ (?<address>(.|\n)+)\n
+ (?<city>.+)\n
+ (?<state>.+),(?<zip>.+)\n
+ (?<country_code>.+)\n?
+ (Tel\. (?<phone>.+)\n?)?
+ (Fax\. (?<fax>.+)\n?)?
+ /x)
+
+ return unless match
+
+ attributes = { :type => type }
+
+ match.names.each do |name|
+ attributes[name.to_sym] = match[name].strip if match[name]
+ end
+
+ Record::Contact.new attributes
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,32 @@
+#--
+# Ruby Whois
+#
+# An intelligent pure Ruby WHOIS client and parser.
+#
+# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
+#++
+
+require 'whois/record/parser/whois.publicdomainregistry.com.rb'
+
+module Whois
+ class Record
+ class Parser
+ # Parser for the whois.resellerclub.com server.
+ #
+ # @see Whois::Record::Parser::Example
+ # The Example parser for the list of all available methods.
+ #
+ # @author Justin Campbell <justin@cramerdev.me>
+ #
+ class WhoisResellerclubCom < WhoisPublicdomainregistryCom
+ property_supported :registrar do
+ Record::Registrar.new(
+ :name => "ResellerClub.com",
+ :organization => "Directi Internet Solutions Pvt. Ltd.",
+ :url => "http://resellerclub.com"
+ )
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,108 @@
+#status
+ should: %s == :registered
+
+#available?
+ should: %s == false
+
+#registered?
+ should: %s == true
+
+
+#updated_on
+ should: %s == nil
+
+#created_on
+ should: %s CLASS(time)
+ should: %s == Time.parse("2003-12-28")
+
+#expires_on
+ should: %s CLASS(time)
+ should: %s == Time.parse("2018-12-28")
+
+
+#registrar
+ should: %s CLASS(registrar)
+ should: %s.id == nil
+ should: %s.name == "PublicDomainRegistry.com"
+ should: %s.organization == "Directi Internet Solutions Pvt. Ltd."
+ should: %s.url == "http://publicdomainregistry.com"
+
+#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 == "Domain Manager"
+ should: %s[0].organization == "PublicDomainRegistry.com"
+ should: %s[0].address == "15500 SW Jay St. #48732"
+ should: %s[0].city == "Beaverton"
+ should: %s[0].state == "Oregon"
+ should: %s[0].zip == "97006"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.2013775952"
+ should: %s[0].fax == "+1.3202105146"
+ should: %s[0].email == "domain.manager@publicdomainregistry.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 == nil
+ should: %s[0].name == "Domain Manager"
+ should: %s[0].organization == "PublicDomainRegistry.com"
+ should: %s[0].address == "15500 SW Jay St. #48732"
+ should: %s[0].city == "Beaverton"
+ should: %s[0].state == "Oregon"
+ should: %s[0].zip == "97006"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.2013775952"
+ should: %s[0].fax == "+1.3202105146"
+ should: %s[0].email == "domain.manager@publicdomainregistry.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 == nil
+ should: %s[0].name == "Domain Manager"
+ should: %s[0].organization == "PublicDomainRegistry.com"
+ should: %s[0].address == "15500 SW Jay St. #48732"
+ should: %s[0].city == "Beaverton"
+ should: %s[0].state == "Oregon"
+ should: %s[0].zip == "97006"
+ should: %s[0].country_code == "US"
+ should: %s[0].phone == "+1.2013775952"
+ should: %s[0].fax == "+1.3202105146"
+ should: %s[0].email == "domain.manager@publicdomainregistry.com"
+
+
+#nameservers
+ should: %s CLASS(array)
+ should: %s SIZE(8)
+ should: %s[0] CLASS(nameserver)
+ should: %s[0].name == "asia1.akam.net"
+ should: %s[0].ipv4 == nil
+ should: %s[1] CLASS(nameserver)
+ should: %s[1].name == "eur2.akam.net"
+ should: %s[1].ipv4 == nil
+ should: %s[2] CLASS(nameserver)
+ should: %s[2].name == "eur4.akam.net"
+ should: %s[2].ipv4 == nil
+ should: %s[3] CLASS(nameserver)
+ should: %s[3].name == "eur6.akam.net"
+ should: %s[3].ipv4 == nil
+ should: %s[4] CLASS(nameserver)
+ should: %s[4].name == "ns1-106.akam.net"
+ should: %s[4].ipv4 == nil
+ should: %s[5] CLASS(nameserver)
+ should: %s[5].name == "ns1-109.akam.net"
+ should: %s[5].ipv4 == nil
+ should: %s[6] CLASS(nameserver)
+ should: %s[6].name == "usc4.akam.net"
+ should: %s[6].ipv4 == nil
+ should: %s[7] CLASS(nameserver)
+ should: %s[7].name == "usc5.akam.net"
+ should: %s[7].ipv4 == nil
@@ -0,0 +1,76 @@
+Domain Name: PUBLICDOMAINREGISTRY.COM
+
+Registrant:
+ PublicDomainRegistry.com
+ Domain Manager (domain.manager@publicdomainregistry.com)
+ 15500 SW Jay St. #48732
+ Beaverton
+ Oregon,97006
+ US
+ Tel. +1.2013775952
+ Fax. +1.3202105146
+
+Creation Date: 28-Dec-2003
+Expiration Date: 28-Dec-2018
+
+Domain servers in listed order:
+ asia1.akam.net
+ eur2.akam.net
+ eur4.akam.net
+ eur6.akam.net
+ ns1-106.akam.net
+ ns1-109.akam.net
+ usc4.akam.net
+ usc5.akam.net
+
+
+Administrative Contact:
+ PublicDomainRegistry.com
+ Domain Manager (domain.manager@publicdomainregistry.com)
+ 15500 SW Jay St. #48732
+ Beaverton
+ Oregon,97006
+ US
+ Tel. +1.2013775952
+ Fax. +1.3202105146
+
+Technical Contact:
+ PublicDomainRegistry.com
+ Domain Manager (domain.manager@publicdomainregistry.com)
+ 15500 SW Jay St. #48732
+ Beaverton
+ Oregon,97006
+ US
+ Tel. +1.2013775952
+ Fax. +1.3202105146
+
+Billing Contact:
+ PublicDomainRegistry.com
+ Domain Manager (domain.manager@publicdomainregistry.com)
+ 15500 SW Jay St. #48732
+ Beaverton
+ Oregon,97006
+ US
+ Tel. +1.2013775952
+ Fax. +1.3202105146
+
+Status:LOCKED
+ Note: This Domain Name is currently Locked. In this status the domain
+ name cannot be transferred, hijacked, or modified. The Owner of this
+ domain name can easily change this status from their control panel.
+ This feature is provided as a security measure against fraudulent domain name hijacking.
+
+The data in this whois database is provided to you for information purposes only,
+that is, to assist you in obtaining information about or related
+to a domain name registration record. We make this information available "as is",
+and do not guarantee its accuracy. By submitting a whois query, you agree that you will
+use this data only for lawful purposes and that, under no circumstances will you use this data to:
+(1) enable high volume, automated, electronic processes that stress
+or load this whois database system providing you this information; or
+(2) allow, enable, or otherwise support the transmission of mass unsolicited,
+commercial advertising or solicitations via direct mail, electronic mail, or by telephone.
+The compilation, repackaging, dissemination or other use of this data is expressly prohibited without
+prior written consent from us. The Registrar of record is Directi Internet Solutions Pvt. Ltd. d/b/a PublicDomainRegistry.com.
+We reserve the right to modify these terms at any time.
+By submitting this query, you agree to abide by these terms.
+
Oops, something went wrong.

0 comments on commit 760eaa0

Please sign in to comment.