Sha256: 09ff45a477828ce023a69772ccc18003a6b85de4e24323f2c1fa935c63fea004

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
#++


module Whois
  class Server
    module Adapters

      #
      # = Verisign Adapter
      #
      # Provides ability to query Verisign WHOIS interfaces.
      #
      class Verisign < Base

        # Executes a WHOIS query to the Verisign WHOIS interface,
        # resolving any intermediate referral,
        # and appends the response to the client buffer.
        #
        # @param  [String] string
        # @return [void]
        #
        def request(string)
          response = query_the_socket("=#{string}", host)
          buffer_append response, host

          if options[:referral] != false && referral = extract_referral(response)
            response = query_the_socket(string, referral)
            buffer_append(response, referral)
          end
        end


        private

        def extract_referral(response)
          if response =~ /Domain Name:/
            server = response.scan(/Whois Server: (.+?)$/).flatten.last
            server.strip! if server != nil
            server = nil  if server == "not defined"
            server
          end
        end

      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whois-4.0.0.pre.beta2 lib/whois/server/adapters/verisign.rb
whois-4.0.0.pre.beta1 lib/whois/server/adapters/verisign.rb
whois-3.6.5 lib/whois/server/adapters/verisign.rb
whois-3.6.4 lib/whois/server/adapters/verisign.rb
whois-3.6.3 lib/whois/server/adapters/verisign.rb