Sha256: 637feedfa754ca6c290eee25a6f1b3d44ece760b4ce370544575deb60dec3131

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 Bytes

Contents

#
# = Ruby Whois
#
# An intelligent pure Ruby WHOIS client.
#
#
# Category::    Net
# Package::     Whois
# Author::      Simone Carletti <weppos@weppos.net>
# License::     MIT License
#
#--
#
#++


module Whois
  class Server
    module Adapters

      class Pir < Base

        def request(qstring)
          response = ask_the_socket("FULL #{qstring}", "whois.publicinterestregistry.net", DEFAULT_WHOIS_PORT)
          endpoint = extract_referral(response)
          if endpoint
            response + "\n" + ask_the_socket(qstring, endpoint, DEFAULT_WHOIS_PORT)
          else
            response
          end
        end

        private

          def extract_referral(response)
            if response =~ /Registrant Name:SEE SPONSORING REGISTRAR/ && 
               response =~ /Registrant Street1:Whois Server:(\S+)/
              $1
            end
          end

      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whois-0.5.3 lib/whois/server/adapters/pir.rb
whois-0.5.2 lib/whois/server/adapters/pir.rb
whois-0.5.1 lib/whois/server/adapters/pir.rb