Sha256: 048aa87f94c37bc7768e7df26e9916b588cd25e5cec5c3c35eda081da7e6bef0

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 KB

Contents

#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2013 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

13 entries across 13 versions & 1 rubygems

Version Path
whois-3.4.3 lib/whois/server/adapters/verisign.rb
whois-3.4.2 lib/whois/server/adapters/verisign.rb
whois-3.4.1 lib/whois/server/adapters/verisign.rb
whois-3.4.0 lib/whois/server/adapters/verisign.rb
whois-3.3.1 lib/whois/server/adapters/verisign.rb
whois-3.3.0 lib/whois/server/adapters/verisign.rb
whois-3.2.1 lib/whois/server/adapters/verisign.rb
whois-3.2.0 lib/whois/server/adapters/verisign.rb
whois-3.1.3 lib/whois/server/adapters/verisign.rb
whois-3.1.2 lib/whois/server/adapters/verisign.rb
whois-3.1.1 lib/whois/server/adapters/verisign.rb
whois-3.1.0 lib/whois/server/adapters/verisign.rb
whois-3.0.0 lib/whois/server/adapters/verisign.rb