Skip to content

Loading…

Whois.nic.uk Registrar property support #82

Closed
wants to merge 6 commits into from

2 participants

@geoffgarside

Adds support for whois.nic.uk registrar property support. Extracts the Nominet Tag as the ID. Also supports differentiating name and organisation fields if the Registrar name includes a trading as separator.

Resubmission of #81 against master branch.

The tests I've added pass when running the testunit rake task.

@weppos
Owner

Thank you very much, I merged the changes. Your contribution is very appreciated.

@weppos
Owner

whois.nic.uk now supports #registrar (closed by c4ce4f7, closed by c4ce4f7).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 22, 2011
  1. @geoffgarside

    Add support for extracting Registrar information from whois.nic.uk.

    geoffgarside committed
    Extracts the name, Nominet tag and URL from the Registrar section of the whois.nic.uk response.
  2. @geoffgarside
  3. @geoffgarside

    Change whois.nic.uk registrar parsing to separate the name and organi…

    geoffgarside committed
    …sation if there is a t/a separator
  4. @geoffgarside
  5. @geoffgarside

    Copy response fixture whois.nic.uk/property_{nameservers_with_ip => r…

    geoffgarside committed
    …egistrar_without_trading_name}.txt
    
    This is to avoid reusing files with a specific name target for other properties.
  6. @geoffgarside

    Update whois.nic.uk_test.rb to use new registered.txt fixture name, c…

    geoffgarside committed
    …opy fixture for property_registrar_without_trading_name
View
13 lib/whois/answer/parser/whois.nic.uk.rb
@@ -88,6 +88,19 @@ class WhoisNicUk < Base
end || []
end
+ property_supported :registrar do
+ if content_for_scanner =~ /Registrar:\n(.+) \[Tag = (.+)\]\n\s*URL: (.+)\n/
+ name, id, url = $1.strip, $2.strip, $3.strip
+ org, name = name.split(" t/a ")
+
+ Answer::Registrar.new(
+ :id => id,
+ :url => url,
+ :name => (name || org),
+ :organization => org
+ )
+ end
+ end
# NEWPROPERTY
def valid?
View
48 spec/fixtures/responses/whois.nic.uk/property_registrar_without_trading_name.txt
@@ -0,0 +1,48 @@
+
+ Domain name:
+ netbenefit.co.uk
+
+ Registrant:
+ Netbenefit (UK) Ltd
+
+ Registrant type:
+ UK Limited Company, (Company number: 3365497)
+
+ Registrant's address:
+ 3rd Floor Prospero House
+ 241 Borough High Street
+ London
+ SE1 1GB
+ United Kingdom
+
+ Registrar:
+ NetNames Limited [Tag = NETNAMES]
+ URL: http://www.netnames.co.uk
+
+ Relevant dates:
+ Registered on: before Aug-1996
+ Renewal date: 20-Aug-2012
+ Last updated: 30-Jul-2010
+
+ Registration status:
+ Registered until renewal date.
+
+ Name servers:
+ ns0.netbenefit.co.uk 212.53.64.30
+ ns1.netbenefit.co.uk 212.53.77.30
+
+ WHOIS lookup made at 21:49:35 30-Oct-2010
+
+--
+This WHOIS information is provided for free by Nominet UK the central registry
+for .uk domain names. This information and the .uk WHOIS are:
+
+ Copyright Nominet UK 1996 - 2010.
+
+You may not access the .uk WHOIS or use any data from it except as permitted
+by the terms of use available in full at http://www.nominet.org.uk/whois, which
+includes restrictions on: (A) use of the data for advertising, or its
+repackaging, recompilation, redistribution or reuse (B) obscuring, removing
+or hiding any or all of this notice and (C) exceeding query rate or volume
+limits. The data is provided on an 'as-is' basis and may lag behind the
+register. Access may be withdrawn or restricted at any time.
View
48 test/fixtures/responses/whois.nic.uk/property_registrar_without_trading_name.txt
@@ -0,0 +1,48 @@
+
+ Domain name:
+ netbenefit.co.uk
+
+ Registrant:
+ Netbenefit (UK) Ltd
+
+ Registrant type:
+ UK Limited Company, (Company number: 3365497)
+
+ Registrant's address:
+ 3rd Floor Prospero House
+ 241 Borough High Street
+ London
+ SE1 1GB
+ United Kingdom
+
+ Registrar:
+ NetNames Limited [Tag = NETNAMES]
+ URL: http://www.netnames.co.uk
+
+ Relevant dates:
+ Registered on: before Aug-1996
+ Renewal date: 20-Aug-2012
+ Last updated: 30-Jul-2010
+
+ Registration status:
+ Registered until renewal date.
+
+ Name servers:
+ ns0.netbenefit.co.uk 212.53.64.30
+ ns1.netbenefit.co.uk 212.53.77.30
+
+ WHOIS lookup made at 21:49:35 30-Oct-2010
+
+--
+This WHOIS information is provided for free by Nominet UK the central registry
+for .uk domain names. This information and the .uk WHOIS are:
+
+ Copyright Nominet UK 1996 - 2010.
+
+You may not access the .uk WHOIS or use any data from it except as permitted
+by the terms of use available in full at http://www.nominet.org.uk/whois, which
+includes restrictions on: (A) use of the data for advertising, or its
+repackaging, recompilation, redistribution or reuse (B) obscuring, removing
+or hiding any or all of this notice and (C) exceeding query rate or volume
+limits. The data is provided on an 'as-is' basis and may lag behind the
+register. Access may be withdrawn or restricted at any time.
View
22 test/whois/answer/parser/whois.nic.uk_test.rb
@@ -160,4 +160,26 @@ def test_nameservers_with_ip
assert_equal_and_cached expected, parser, :nameservers
end
+ def test_registrar
+ parser = @klass.new(load_part('status_registered.txt'))
+ result = parser.registrar
+
+ assert_instance_of Whois::Answer::Registrar, result
+ assert_equal "MARKMONITOR", result.id
+ assert_equal "Markmonitor", result.name
+ assert_equal "Markmonitor Inc.", result.organization
+ assert_equal "http://www.markmonitor.com", result.url
+ end
+
+ def test_registrar_without_trading_name
+ parser = @klass.new(load_part('property_registrar_without_trading_name.txt'))
+ result = parser.registrar
+
+ assert_instance_of Whois::Answer::Registrar, result
+ assert_equal "NETNAMES", result.id
+ assert_equal "NetNames Limited", result.name
+ assert_equal "NetNames Limited", result.organization
+ assert_equal "http://www.netnames.co.uk", result.url
+ end
+
end
Something went wrong with that request. Please try again.