lib/whois/server/adapters/standard.rb in whois-1.6.6 vs lib/whois/server/adapters/standard.rb in whois-2.0.0
- old
+ new
@@ -1,18 +1,11 @@
+#--
+# Ruby Whois
#
-# = Ruby Whois
-#
# An intelligent pure Ruby WHOIS client and parser.
#
-#
-# Category:: Net
-# Package:: Whois
-# Author:: Simone Carletti <weppos@weppos.net>
-# License:: MIT License
-#
-#--
-#
+# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
#++
module Whois
class Server
@@ -20,20 +13,44 @@
#
# = Standard Adapter
#
# Provides ability to query standard WHOIS interfaces.
- # A standard WHOIS interface accepts socket requests containing the name of the domain
- # and returns a single response containing the answer for given query.
+ # A standard WHOIS interface accepts socket requests
+ # containing the name of the domain and returns a single response
+ # containing the record for given query.
#
- # By default the interface should listen on port 43.
+ # a = Standard.new(:tld, ".it", "whois.nic.it")
+ # a.request("example.it")
+ #
+ # By default, WHOIS interfaces listen on port 43.
# This adapter also supports an optional port number.
#
+ # a = Standard.new(:tld, ".it", "whois.nic.it", :port => 20)
+ # a.request("example.it")"
+ #
+ # == Options
+ #
+ # The following options can be supplied to customize the creation
+ # of a new instance:
+ #
+ # * +:port+ - Specifies a port number different than 43
+ #
class Standard < Base
- def request(qstring)
- response = query_the_socket(qstring, host)
- append_to_buffer response, host
+ # Executes a WHOIS query to the WHOIS interface
+ # listening at +host+ and appends the response
+ # to the client buffer.
+ #
+ # The standard port of a WHOIS request is 43.
+ # You can customize it by passing a +:port+ option.
+ #
+ # @param [String] string
+ # @return [void]
+ #
+ def request(string)
+ response = query_the_socket(string, host)
+ buffer_append response, host
end
end
end
\ No newline at end of file