Sha256: 0c04bf10650c4e0056a4dd25c70f0c278a4dc2c31112454cee6d053533dd88a9

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

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


require 'whois/record/parser/base_icann_compliant'


module Whois
  class Record
    class Parser

      # Parser for the whois.donuts.com server.
      #
      # @see Whois::Record::Parser::Example
      #   The Example parser for the list of all available methods.
      #
      class WhoisUniregistryNet < BaseIcannCompliant
        self.scanner = Scanners::BaseIcannCompliant, {
            pattern_available: />>> Domain \".+\" is available/
        }


        property_supported :domain_id do
          node('Domain ID')
        end


        property_supported :expires_on do
          node('Registry Expiry Date') do |value|
            parse_time(value)
          end
        end


        property_supported :registrar do
          return unless node('Sponsoring Registrar')
          Record::Registrar.new(
              id:           node('Sponsoring Registrar IANA ID'),
              name:         node('Sponsoring Registrar'),
              organization: node('Sponsoring Registrar')
          )
        end


        private

        def build_contact(element, type)
          if (contact = super)
            contact.id = node("#{element} ID")
          end
          contact
        end

        def parse_time(value)
          Time.parse(value).change(usec: 0)
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-3.6.3 lib/whois/record/parser/whois.uniregistry.net.rb