Sha256: 75d9e0eec62e0471a4967a46978e91389e8ebdc90ffaa0f3b4aa0704211bf66e

Contents?: true

Size: 1.3 KB

Versions: 38

Compression:

Stored size: 1.3 KB

Contents

require 'fog/core/model'
require 'fog/dynect/models/dns/records'

module Fog
  module DNS
    class Dynect

      class Zone < Fog::Model

        identity  :domain

        attribute :domain,        :aliases => 'zone'
        attribute :email,         :aliases => 'rname'
        attribute :serial
        attribute :serial_style
        attribute :ttl
        attribute :type,          :aliases => 'zone_type'

        def initialize(attributes={})
          self.ttl  ||= 3600
          super
        end

        def destroy
          requires :domain
          connection.delete_zone(domain)
          true
        end

        undef_method :domain=
        def domain=(new_domain)
          attributes[:domain] = new_domain.split('/').last
        end

        def publish
          requires :identity
          data = connection.put_zone(identity, 'publish' => true)
          true
        end

        def records
          @records ||= Fog::DNS::Dynect::Records.new(:zone => self, :connection => connection)
        end

        def nameservers
          raise 'nameservers Not Implemented'
        end

        def save
          requires :domain, :email, :ttl
          data = connection.post_zone(email, ttl, domain).body['data']
          merge_attributes(data)
          true
        end

      end

    end
  end
end

Version data entries

38 entries across 38 versions & 13 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/dynect/models/dns/zone.rb
fog-nirvanix-1.8.1 lib/fog/dynect/models/dns/zone.rb
fog-parser-fix-1.6.1 lib/fog/dynect/models/dns/zone.rb
fog-test-again-1.6.0 lib/fog/dynect/models/dns/zone.rb
fog-parser-fix-1.6.0 lib/fog/dynect/models/dns/zone.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/dynect/models/dns/zone.rb
fog-sgonyea-1.8.1 lib/fog/dynect/models/dns/zone.rb
fog-1.8.0 lib/fog/dynect/models/dns/zone.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/dynect/models/dns/zone.rb
fog-1.7.0 lib/fog/dynect/models/dns/zone.rb
fog-1.6.0 lib/fog/dynect/models/dns/zone.rb
fog-1.5.0 lib/fog/dynect/models/dns/zone.rb
fog-1.4.0 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
michiels-fog-1.3.1 lib/fog/dynect/models/dns/zone.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
fog-1.3.1 lib/fog/dynect/models/dns/zone.rb
fog-1.3.0 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb