README.md in whois-4.1.0 vs README.md in whois-5.0.0
- old
+ new
@@ -31,55 +31,55 @@
This repository contains the core whois library, that includes the WHOIS client, the server definitions and all the features required to perform WHOIS queries and obtain the WHOIS record.
## Requirements
-* Ruby >= 2.0.0
+- Ruby >= 2.4
For older versions of Ruby, see the [CHANGELOG](CHANGELOG.md).
## Installation
You can install the gem manually:
-```shell
+~~~shell
gem install whois
-```
+~~~
Or use [Bundler](http://bundler.io/) and define it as a dependency in your `Gemfile`:
-```ruby
+~~~ruby
gem 'whois'
-```
+~~~
To use the WHOIS parser component you need to install the `whois-parser` gem:
-```shell
+~~~shell
gem install whois-parser
-```
+~~~
-```ruby
+~~~ruby
gem 'whois-parser'
-```
+~~~
The `whois-parser` gem already depends on the `whois` gem. If you install `whois-parser`, `whois` will be installed as well and it will also be automatically required when you `require 'whois-parser'`.
If you are upgrading to 4.0, see [4.0-Upgrade.md](4.0-Upgrade.md).
## Getting Started
-Note. This section covers only the essentials for getting started with the Whois library. The [documentation](https://whoisrb.org/docs/) provides a more accurate explanation including tutorials, more examples and technical details about the client/server/record/parser architecture.
+This section covers only the essentials for getting started with the Whois library. The [documentation](https://whoisrb.org/docs/) provides a more accurate explanation including tutorials, more examples and technical details about the client/server/record/parser architecture.
### Querying a WHOIS
<tt>Whois</tt> provides the ability to get WHOIS information for TLD, domain names, IPv4 and IPv6 addresses. The client is smart enough to guess the best WHOIS server according to given query, send the request and return the response.
Check out the following examples:
-```ruby
+~~~ruby
# Domain WHOIS
whois = Whois::Client.new
whois.lookup("google.com")
# => #<Whois::Record>
@@ -95,49 +95,49 @@
# IPv6 WHOIS
whois = Whois::Client.new
whois.lookup("2001:db8::1428:57ab")
# => #<Whois::Record>
-```
+~~~
The query method is stateless. For this reason, you can safely re-use the same client instance for multiple queries.
-```ruby
+~~~ruby
whois = Whois::Client.new
whois.lookup("google.com")
whois.lookup(".com")
whois.lookup("74.125.67.100")
whois.lookup("2001:db8::1428:57ab")
whois.lookup("google.it")
-```
+~~~
If you just need a WHOIS response and you don't care about a full control of the WHOIS client, the `Whois` module provides an all-in-one method called `Whois.whois`. This is the simplest way to send a WHOIS request.
-```ruby
+~~~ruby
Whois.whois("google.com")
# => #<Whois::Record>
-```
+~~~
Did I mention you can even use blocks?
-```ruby
+~~~ruby
Whois::Client.new do |w|
w.lookup("google.com")
w.lookup(".com")
w.lookup("74.125.67.100")
w.lookup("2001:db8::1428:57ab")
w.lookup("google.it")
end
-```
+~~~
### Consuming the Record
Any WHOIS query returns a `Whois::Record`. This object looks like a String, but it's way more powerful.
`Whois::Record` encapsulates a WHOIS record and provides the ability to parse the WHOIS response programmatically, when the `whois-parser` gem is installed and loaded.
-```ruby
+~~~ruby
require 'whois-parser'
record = Whois.whois("google.it")
# => #<Whois::Record>
@@ -160,11 +160,11 @@
# => "Technical Services"
parser.nameservers.each do |nameserver|
puts nameserver
end
-```
+~~~
This feature is made possible by the <tt>Whois</tt> record parsers. Unfortunately, due to the lack of a global standard, each WHOIS server requires a specific parser. For this reason, the library doesn't support all existing WHOIS servers.
If you create a new parser, please consider releasing it to the public so that it can be included in a next version.
@@ -172,17 +172,17 @@
By default, each query run though the client has a timeout value of 5 seconds. If the execution exceeds the timeout limit, the client raises a `Timeout::Error` exception.
Of course, you can customize the timeout value setting a different value. If timeout is `nil`, the client will wait until the response is sent back from the server or the process is killed. Don't disable the timeout unless you really know what you are doing!
-```ruby
+~~~ruby
whois = Whois::Client.new(:timeout => 10)
whois.timeout # => 10
whois.timeout = 5
whois.timeout # => 5
whois.lookup("google.com")
-```
+~~~
## Credits
<tt>Whois</tt> was created and is maintained by [Simone Carletti](https://simonecarletti.com/). Many improvements and bugfixes were contributed by the [open source community](https://github.com/weppos/whois/graphs/contributors).