Sha256: c7de000754ad9029642cd999bb09ec2cd63ecbe74a7c0d1919d721c5ff390ee6

Contents?: true

Size: 975 Bytes

Versions: 24

Compression:

Stored size: 975 Bytes

Contents

#
# = Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
#
# 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)
          append_to_buffer response, "whois.publicinterestregistry.net"

          if endpoint = extract_referral(response)
            response = ask_the_socket(qstring, endpoint, DEFAULT_WHOIS_PORT)
            append_to_buffer response, endpoint
          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

24 entries across 24 versions & 1 rubygems

Version Path
whois-1.0.1 lib/whois/server/adapters/pir.rb
whois-1.0.0 lib/whois/server/adapters/pir.rb
whois-0.9.0 lib/whois/server/adapters/pir.rb
whois-0.8.1 lib/whois/server/adapters/pir.rb