NicAr::Client¶ ↑
<img src=“https://travis-ci.org/vivaserver/nic_ar.png” /> <img src=“https://codeclimate.com/badge.png” />
The NicAr::Client class allows to you programatically extract information about any “.ar” (Argentina) domain name.
It uses the public information as is made available at the Dirección Nacional del Registro de Dominios de Internet (NIC.ar) website using the third-party nic!alert API webservice.
Usage¶ ↑
The client initialization is pretty straigt-forward, and the only argument is optional.
nic_ar = NicAr::Client.new
The optional argument is an API token that can be obtained to by-pass the CAPTCHA challenge that the NIC.ar website sometimes requests you to solve before answering your domain lookup. Please refer to the nic!alert API official documentation for more details.
nic_ar = NicAr::Client.new("234d3cdf979e04db3d709ed8")
The NicAr::Client class supports lookups for domain names. First, find out what kind of domain names you are allowed to looup.
nic_ar.whois => [".com.ar", ".gob.ar", ".int.ar", ".mil.ar", ".net.ar", ".org.ar", ".tur.ar"]
All the following lookups will raise a NicAr::NotFound exception if the requested resource could not be found.
nic_ar.whois("vivaserver.com.ar") => { "status"=> { "available"=>false, "delegated"=>true, "expiring"=>false, "pending"=>false, "registered"=>true}, "name"=>"vivaserver.com.ar", "created_on"=>"2004-11-18", "expires_on"=>"2012-11-18", "contacts"=> { "registrant"=>{ "name"=>"Cristian Renato Arroyo", "activity"=>"Diseno de Paginas Web", "addresss" =>{ "local" =>{ "address"=>"Pje. Vucetich 676. Ciudad De Nieva", "city"=>"S. S. de Jujuy", "province"=>"Jujuy", "zip_code"=>"4600", "country"=>"Argentina", "phone"=>"(0388)155827713", "fax"=>"(0388)155827713" } } } }, "name_servers"=>[ {"id"=>0,"host"=>"ns1.mydyndns.org", "ip"=>nil}, {"id"=>1,"host"=>"ns2.mydyndns.org", "ip"=>nil}, {"id"=>2,"host"=>"ns3.mydyndns.org", "ip"=>nil}, {"id"=>4,"host"=>"ns4.mydyndns.org", "ip"=>nil}, ] }
Please note that this output conforms to the latest update of the Nic.ar website (late 2013), which significantly reduces the contacts data details exposed, as opposed to the previous version.
Check a domain status¶ ↑
You can also check if a given domain name resolves OK to it’s DNS servers, thus effectively know if it’s available online or not.
nic_ar.status("www.nic.ar") => { "status" => { "domain"=>"www.nic.ar", "online"=>true, "offline"=>false, "ip"=>"200.16.109.19", "host"=>"firpo.nic.ar" } }
But also note that a domain name without the “www.” may or may not resolve in the same way.
nic_ar.status("nic.ar") => { "status" => { "domain"=>"nic.ar", "online"=>true, "offline"=>false, "ip"=>"200.16.109.25", "host"=>"roldan.nic.ar" } }
Lastly, status checking only works for “.ar” (Argentina) domain names.
Full API reference¶ ↑
The full documentation of the public nic!alert API is available at api.nicalert.me/docs if you want to write your own client, use any other language, or just use CURL in a RESTful way.
Contributing¶ ↑
-
Fork it
-
Create your feature branch (‘git checkout -b my-new-feature`)
-
Commit your changes (‘git commit -am ’Add some feature’‘)
-
Push to the branch (‘git push origin my-new-feature`)
-
Create new Pull Request
License¶ ↑
NicAr::Client is released under the MIT License.
Copyright¶ ↑
Copyright ©2014 Cristian R. Arroyo