Ruby Whois 0.8.0

In these minutes the hamsters at RubyForge.org are crunching the new Whois version and the gem should be available for download in a moment. Whois 0.8.0 is the most significant update since I announced the availability of the library, a few month ago. Don't let the CHANGELOG fool you: it is short but the changes are quite impressive.

I already talked about the new Whois::Answer object and the Whois parsers, so I won't repeat myself. Instead, I want to show you a few examples to demonstrate some of the new features and library capabilities.

How to check domain availability (the short way)
Whois.available? "google.com"
# => false
Whois.registered? "google.com"
# => true
How to check domain availability (the long way)
client = Whois.client.new
answer = client.query("google.com")
# => #<Whois::Answer>

answer.available?
=> false
answer.available?
=> true
How to query whois (the short way)
answer = Whois.query("google.com")
# => #<Whois::Answer>

puts answer
# => "..."
How to query whois (the long way)
client = Whois::Client.new
answer = client.query("google.com")
# => #<Whois::Answer>

puts answer
# => "..."
How to get whois server details
answer = Whois.query("google.com")
# => #<Whois::Answer>

server = answer.server
# => #<Whois::Server::Adapters::Verisign>
server.allocation
# => ".com"
server.host
# => "whois.crsnic.net"
How to read whois properties
answer = Whois.query("google.com")
# => #<Whois::Answer>

# Get information about record creation and expiration
answer.created_on
# => Mon Sep 15 00:00:00 +0200 1997
answer.updated_on
# => Tue Nov 18 00:00:00 +0100 2008
answer.expires_on
# =>  Wed Sep 14 00:00:00 +0200 2011

# Oops, this property is not supported in this specific answer
# Perhaps the registry didn't return it.
answer.nameservers
# => Whois::PropertyNotSupported: Unable to find a parser for `nameservers'

These are just some examples. Topics like whois parser capabilities, supported properties, response scanners and many others surely deserve many additional posts and articles and the next step is probably to integrate the library with an extensive and more detailed documentation. For any additional information about classes and methods, check out the Whois API.

If you have any feedback, question or suggestion, feel free to ask a question or open a new issue. As usual, the source code is available on GitHub waiting for patches, contributions and forks.

You can install or upgrade Whois 0.8.0 via RubyGems.

$ gem install whois