Skip to content

Commit

Permalink
Updated whois.nic.as to new response format
Browse files Browse the repository at this point in the history
  • Loading branch information
case committed Jun 8, 2014
1 parent f6afad0 commit 8e4f573
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 47 deletions.
52 changes: 52 additions & 0 deletions lib/whois/record/parser/whois.nic.as.rb
Expand Up @@ -20,6 +20,58 @@ class Parser
# The Example parser for the list of all available methods.
#
class WhoisNicAs < BaseCocca

class_attribute :status_mapping

self.status_mapping = {
"active" => :registered,
"ok" => :registered,
"delegated" => :registered,
"available" => :available
}

property_supported :domain do
content_for_scanner =~ /Domain Name:\s+(.+?)\n/
$1 || Whois.bug!(ParserError, "Unable to parse domain.")
end

property_supported :status do
if content_for_scanner =~ /Domain Status:\s+(.+?)\n/
status = $1.downcase
self.class.status_mapping[status] || Whois.bug!(ParserError, "Unknown status `#{status}'.")
else
Whois.bug!(ParserError, "Unable to parse status.")
end
end

property_supported :created_on do
if content_for_scanner =~ /Creation Date:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :expires_on do
if content_for_scanner =~ /Registry Expiry Date:\s+(.+?)\n/
Time.parse($1)
end
end

property_supported :registrar do
if content_for_scanner =~ /Sponsoring Registrar: (.+)\n/
Record::Registrar.new(
name: $1,
organization: nil,
url: content_for_scanner.slice(/Registration URL: (.+)\n/, 1)
)
end
end

property_supported :nameservers do
content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
Record::Nameserver.new(:name => name.downcase)
end
end

end

end
Expand Down
12 changes: 4 additions & 8 deletions spec/fixtures/responses/whois.nic.as/status_available.txt
@@ -1,10 +1,6 @@
TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of electronic processes that are high-volume and automated. THis WHOIS database is provided by as a service to the internet community.

The data is for information purposes only. We do not guarantee its accuracy. By submitting a WHOIS query, you agree to abide by the following terms of use: You agree that you may 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 e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to CoCCA it's members (or CoCCA or member computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited.

Domain Information
Query: u34jedzcq.as
Status: Not Registered

Domain Name: u34jedzcq.as
Domain Status: Available

TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of electronic processes that are high-volume and automated. THis WHOIS database is provided by as a service to the internet community.

The data is for information purposes only. We do not guarantee its accuracy. By submitting a WHOIS query, you agree to abide by the following terms of use: You agree that you may 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 e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to CoCCA it's members (or CoCCA or member computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited.
79 changes: 40 additions & 39 deletions spec/fixtures/responses/whois.nic.as/status_registered.txt
@@ -1,39 +1,40 @@
TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of electronic processes that are high-volume and automated. THis WHOIS database is provided by as a service to the internet community.

The data is for information purposes only. We do not guarantee its accuracy. By submitting a WHOIS query, you agree to abide by the following terms of use: You agree that you may 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 e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to CoCCA it's members (or CoCCA or member computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited.

Domain Information
Query: google.as
Status: Active
Created: 02 Aug 2000 00:00 UTC
Expires: 02 Aug 2014 00:00 UTC
Name Servers:
ns1.google.com
ns2.google.com
ns3.google.com
ns4.google.com

Registrar Information
Registrar Name: MarkMonitor Inc.




Registrant:
Name: Google, Inc.


Admin Contact:
Name: Google, Inc.
Organisation: DNS Admin


Technical Contact:
Name: Google, Inc.
Organisation: DNS Admin


Billing Contact:
Name: MarkMonitor
Organisation: Admin, CCOPS

Domain Name: google.as
Domain ID: 100875-CI
WHOIS Server: whois.nic.as
Referral URL:
Creation Date: 2000-08-02T00:00:00.000Z
Registry Expiry Date: 2014-08-02T00:00:00.000Z
Sponsoring Registrar: MarkMonitor Inc.
Sponsoring Registrar IANA ID:
Domain Status: ok
Domain Status: clientDeleteProhibited
Domain Status: clientUpdateProhibited
Domain Status: clientTransferProhibited

Registrant ID: 185629-CI
Registrant Name: Google, Inc.
Registrant Organization:

Admin ID: 185630-CI
Admin Name: Google, Inc.
Admin Organization: DNS Admin

Billing ID: 185631-CI
Billing Name: MarkMonitor
Billing Organization: Admin, CCOPS

Tech ID: 185630-CI
Tech Name: Google, Inc.
Tech Organization: DNS Admin

Name Server: ns1.google.com
Name Server: ns2.google.com
Name Server: ns3.google.com
Name Server: ns4.google.com

DNSSEC: unsigned


TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of electronic processes that are high-volume and automated. THis WHOIS database is provided by as a service to the internet community.

The data is for information purposes only. We do not guarantee its accuracy. By submitting a WHOIS query, you agree to abide by the following terms of use: You agree that you may 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 e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to CoCCA it's members (or CoCCA or member computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited.

0 comments on commit 8e4f573

Please sign in to comment.