Sha256: 66ccc207af49fa44392a3896a424076d1b0599d13c0c83ca7682ed39eeafad21

Contents?: true

Size: 1.95 KB

Versions: 2

Compression:

Stored size: 1.95 KB

Contents

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


require_relative 'base'


module Whois
  class Parsers

    # Parser for the kero.yachay.pe 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 Whois::Parsers::Example
    #   The Example parser for the list of all available methods.
    #
    class KeroYachayPe < Base

      property_supported :status do
        if content_for_scanner =~ /Status:\s+(.+?)\n/
          case $1.downcase
          when "active"
            :registered
          # NEWSTATUS suspended (https://github.com/weppos/whois/issues/5)
          when "suspended"
            :registered
          when "not registered"
            :available
          when "inactive"
            :inactive
          else
            Whois::Parser.bug!(ParserError, "Unknown status `#{$1}'.")
          end
        else
          Whois::Parser.bug!(ParserError, "Unable to parse status.")
        end
      end

      property_supported :available? do
        status == :available
      end

      property_supported :registered? do
        !available?
      end


      property_not_supported :created_on

      property_not_supported :updated_on

      property_not_supported :expires_on


      property_supported :nameservers do
        if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
          $1.split("\n").map do |name|
            Parser::Nameserver.new(:name => name.strip)
          end
        end
      end


      # Checks whether the response has been throttled.
      #
      # @return [Boolean]
      #
      # @example
      #   Looup quota exceeded.
      #
      def response_throttled?
        !content_for_scanner.match(/Looup quota exceeded./).nil?
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whois-parser-1.2.0 lib/whois/parsers/kero.yachay.pe.rb
whois-parser-1.1.0 lib/whois/parsers/kero.yachay.pe.rb