Skip to content

Commit

Permalink
Merge branch 'master' into whois.networksolutions.com-throttle-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
justincampbell committed Aug 27, 2012
2 parents 47b08ca + dcb657f commit 0bc7ee4
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 6 deletions.
54 changes: 48 additions & 6 deletions lib/whois/record/parser/whois.register.com.rb
Expand Up @@ -33,15 +33,15 @@ class WhoisRegisterCom < Base




property_supported :created_on do property_supported :created_on do
if content_for_scanner =~ /Created on\.+: (.+)\n/ if content_for_scanner =~ /(?:Created on\.+|Creation date): (.+)\n/
Time.parse($1) Time.parse($1)
end end
end end


property_not_supported :updated_on property_not_supported :updated_on


property_supported :expires_on do property_supported :expires_on do
if content_for_scanner =~ /Expires on\.+: (.+)\n/ if content_for_scanner =~ /(?:Expires on\.+|Expiration date): (.+)\n/
Time.parse($1) Time.parse($1)
end end
end end
Expand All @@ -56,20 +56,20 @@ class WhoisRegisterCom < Base
end end


property_supported :registrant_contacts do property_supported :registrant_contacts do
build_contact('Registrant:', Record::Contact::TYPE_REGISTRANT) build_contact(/Registrant(?: Contact)?:/, Record::Contact::TYPE_REGISTRANT)
end end


property_supported :admin_contacts do property_supported :admin_contacts do
build_contact('Administrative Contact:', Record::Contact::TYPE_ADMIN) build_contact(/Administrative Contact:/, Record::Contact::TYPE_ADMIN)
end end


property_supported :technical_contacts do property_supported :technical_contacts do
build_contact('Technical Contact:', Record::Contact::TYPE_TECHNICAL) build_contact(/Technical\s+Contact:/, Record::Contact::TYPE_TECHNICAL)
end end




property_supported :nameservers do property_supported :nameservers do
if content_for_scanner =~ /DNS Servers:\n((.+\n)+)\n/ if content_for_scanner =~ /(?:DNS|Name) Servers:\n((.+\n)+)\n/
$1.split("\n").map do |line| $1.split("\n").map do |line|
Record::Nameserver.new(:name => line.strip) Record::Nameserver.new(:name => line.strip)
end end
Expand All @@ -80,6 +80,14 @@ class WhoisRegisterCom < Base
private private


def build_contact(element, type) def build_contact(element, type)
if content_for_scanner.match /DNS Servers/
build_register_contact(element, type)
else
build_enom_contact(element, type)
end
end

def build_register_contact(element, type)
match = content_for_scanner.slice(/#{element}\n((.+\n){7})/, 1) match = content_for_scanner.slice(/#{element}\n((.+\n){7})/, 1)
return unless match return unless match


Expand Down Expand Up @@ -109,6 +117,40 @@ def build_contact(element, type)
) )
end end


def build_enom_contact(element, type)
match = content_for_scanner.slice(/#{element}\n(((\s{3}+.*)\n)+)/, 1)
return unless match

# 0 AdBrite, Inc.
# 1 Host Master (hostmaster@adbrite.com)
# 2 4159750916
# 3 Fax:
# 4 731 Market Street, Suite 500
# 5 San Francisco, CA 94103
# 6 US

lines = match.split("\n").map(&:lstrip)
name, email = lines[1].match(/(.*)\((.*)\)/)[1..2].map(&:strip)
fax_match = lines[3].match(/Fax: (.*)/)
fax = fax_match[1] if fax_match
city, state, zip = lines[-2].match(/(.*),(.+?)(\d*)$/)[1..3].map(&:strip)

Record::Contact.new(
:type => type,
:id => nil,
:name => name,
:organization => lines[0],
:address => lines[4..-3].join("\n"),
:city => city,
:zip => zip,
:state => state,
:country_code => lines[-1],
:phone => lines[2] == "" ? nil : lines[2],
:fax => fax,
:email => email == "" ? nil : email
)
end

end end


end end
Expand Down
@@ -0,0 +1,91 @@
#status
should: %s raise_error(Whois::PropertyNotSupported)

#available?
should: %s == false

#registered?
should: %s == true


#created_on
should: %s CLASS(time)
should: %s == Time.parse("2002-03-14 00:19:48")

#updated_on
should: %s raise_error(Whois::PropertyNotSupported)

#expires_on
should: %s CLASS(time)
should: %s == Time.parse("2013-03-14 00:19:00")


#registrar
should: %s CLASS(registrar)
should: %s.id == nil
should: %s.name == "Register.com"
should: %s.url == "http://www.register.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].name == "Josh Cramer"
should: %s[0].organization == "Cramer Development"
should: %s[0].address == "226 S. Clinton Street"
should: %s[0].city == "Iowa City"
should: %s[0].zip == "52240"
should: %s[0].state == "IA"
should: %s[0].country_code == "US"
should: %s[0].phone == nil
should: %s[0].fax == nil
should: %s[0].email == nil

#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].name == "Host Master"
should: %s[0].organization == "Cramer Development Incorporated"
should: %s[0].address == "226 S Clinton St"
should: %s[0].city == "Iowa City"
should: %s[0].zip == "52245"
should: %s[0].state == "IA"
should: %s[0].country_code == "US"
should: %s[0].phone == "+1.5152920050"
should: %s[0].fax == nil
should: %s[0].email == "domains@cramerdev.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].name == "Host Master"
should: %s[0].organization == "Cramer Development Incorporated"
should: %s[0].address == "226 S Clinton St"
should: %s[0].city == "Iowa City"
should: %s[0].zip == "52245"
should: %s[0].state == "IA"
should: %s[0].country_code == "US"
should: %s[0].phone == "+1.5152920050"
should: %s[0].fax == nil
should: %s[0].email == "domains@cramerdev.com"


#nameservers
should: %s CLASS(array)
should: %s SIZE(5)
should: %s[0] CLASS(nameserver)
should: %s[0].name == "dns01.gpn.register.com"
should: %s[1] CLASS(nameserver)
should: %s[1].name == "dns02.gpn.register.com"
should: %s[2] CLASS(nameserver)
should: %s[2].name == "dns03.gpn.register.com"
should: %s[3] CLASS(nameserver)
should: %s[3].name == "dns04.gpn.register.com"
should: %s[4] CLASS(nameserver)
should: %s[4].name == "dns05.gpn.register.com"
91 changes: 91 additions & 0 deletions spec/fixtures/responses/whois.register.com/status_registered_2.txt
@@ -0,0 +1,91 @@

The data in Register.com's WHOIS database is provided to you by
Register.com for information purposes only, that is, to assist you in
obtaining information about or related to a domain name registration
record. Register.com makes this information available "as is," and
does 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) allow, enable,
or otherwise support the transmission of mass unsolicited, commercial
advertising or solicitations via direct mail, electronic mail, or by
telephone; or (2) enable high volume, automated, electronic processes
that apply to Register.com (or its systems). The compilation,
repackaging, dissemination or other use of this data is expressly
prohibited without the prior written consent of Register.com.
Register.com reserves the right to modify these terms at any time.
By submitting this query, you agree to abide by these terms.


=-=-=-=


Domain name: cramerdev.com
Is the domain you want taken? Make an offer: http://www.afternic.com/rcom.php?ref_id=2987&name=cramerdev.com

Registrant Contact:
Cramer Development
Josh Cramer ()

Fax:
226 S. Clinton Street
Iowa City, IA 52240
US

Administrative Contact:
Cramer Development Incorporated
Host Master (domains@cramerdev.com)
+1.5152920050
Fax:
226 S Clinton St
Iowa City, IA 52245
US

Technical Contact:
Cramer Development Incorporated
Host Master (domains@cramerdev.com)
+1.5152920050
Fax:
226 S Clinton St
Iowa City, IA 52245
US

Status: Locked

Name Servers:
dns01.gpn.register.com
dns02.gpn.register.com
dns03.gpn.register.com
dns04.gpn.register.com
dns05.gpn.register.com

Creation date: 14 Mar 2002 00:19:48
Expiration date: 14 Mar 2013 00:19:00




=-=-=-=
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.

We reserve the right to modify these terms at any time. By submitting
this query, you agree to abide by these terms.
Version 6.3 4/3/2002


Visit AboutUs.org for more information about cramerdev.com

<A HREF="http://www.aboutus.org/cramerdev.com">AboutUs: cramerdev.com</A>

Register your domain name at http://www.register.com

0 comments on commit 0bc7ee4

Please sign in to comment.