Sha256: 3c07a0f43ae9c8fc1b225f2ede2acf4ca38ccf399bc87d7c2d0bcdb726675809

Contents?: true

Size: 1.87 KB

Versions: 14

Compression:

Stored size: 1.87 KB

Contents

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


require 'whois/answer/parser/base'


module Whois
  class Answer
    class Parser

      #
      # = whois.co.ca parser
      #
      # Parser for the whois.co.ca server.
      #
      # NOTE: This parser is just a stub and provides only a few basic methods
      # to check for domain availability and get domain status.
      # Please consider to contribute implementing missing methods.
      # See WhoisNicIt parser for an explanation of all available methods
      # and examples.
      #
      class WhoisCoCa < Base

        property_supported :status do
          @status ||= case
            when available? then :available
            when reserved?  then :reserved
            else                 :registered
          end
        end

        property_supported :available? do
          @available  ||= !!(content_for_scanner =~ /^(.+) is available/)
        end

        property_supported :registered? do
          @registered ||= !(available? || reserved?)
        end


        property_supported :created_on do
          @created_on ||= if content_for_scanner =~ /date_approved:\s+(.+)\n/
            Time.parse($1)
          end
        end

        property_not_supported :updated_on

        property_supported :expires_on do
          @expires_on ||= if content_for_scanner =~ /date_renewal:\s+(.+)\n/
            Time.parse($1)
          end
        end


        property_supported :nameservers do
          @nameservers ||= content_for_scanner.scan(/ns[\d]_hostname:\s+(.+)\n/).flatten
        end


        # NEWPROPERTY
        def reserved?
          !!(content_for_scanner =~ /^Domain is not available or is reserved by the registry/)
        end

      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
whois-1.6.6 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.5 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.4 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.3 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.2 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.1 lib/whois/answer/parser/whois.co.ca.rb
whois-1.6.0 lib/whois/answer/parser/whois.co.ca.rb
whois-1.5.1 lib/whois/answer/parser/whois.co.ca.rb
whois-1.5.0 lib/whois/answer/parser/whois.co.ca.rb
whois-1.3.11 lib/whois/answer/parser/whois.co.ca.rb
whois-1.3.10 lib/whois/answer/parser/whois.co.ca.rb
whois-1.3.9 lib/whois/answer/parser/whois.co.ca.rb
whois-1.3.8 lib/whois/answer/parser/whois.co.ca.rb
whois-1.3.7 lib/whois/answer/parser/whois.co.ca.rb