Sha256: 340501e06c7945ae5b5abe838a598243759af6fb9ebbc42e9740130b7bc90481

Contents?: true

Size: 926 Bytes

Versions: 3

Compression:

Stored size: 926 Bytes

Contents

class ZerigoDNS::Zone < ZerigoDNS::Base
  class <<self
    # Get count of all zones
    # @return [Fixnum] Count of all zones
    def count
      get(:count).to_i
    end
    
    # Find zone by domain name
    # @param [String, #read] domain the domain to retrieve
    # @raise ActiveResource::ResourceNotFound if the domain is not present.
    # @return [Zone] the domain retrieved.
    def find_by_domain(domain)
      find(domain)
    end
    
    # Find or Create Zone
    # @param [String, #read] domain name of domain to create
    # @return [Zone] the zone found or created.
    def find_or_create(domain)
      find_by_domain(domain)
    rescue ActiveResource::ResourceNotFound
      create(:domain=> domain, :ns_type=>'pri_sec')
    end
  end
  
  # Get count of all hosts belonging to this zone
  # @return [Fixnum] Count of all hosts belonging to this zone.
  def count_hosts
    get('hosts/count').to_i
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zerigodns-1.0.2 lib/zerigodns/zone.rb
zerigodns-1.0.1 lib/zerigodns/zone.rb
zerigodns-1.0.0 lib/zerigodns/zone.rb