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-1.2.0 lib/fog/dynect/models/dns/zone.rb
ktheory-fog-1.1.2 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
fog-1.1.2 lib/fog/dynect/models/dns/zone.rb
fog_tractical-1.1.4 lib/fog/dynect/models/dns/zone.rb
fog_tractical-1.1.3 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
fog-1.1.1 lib/fog/dynect/models/dns/zone.rb
fog-1.1.0 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
tag-fog-1.0.1 lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/models/dns/zone.rb
fog-1.0.0 lib/fog/dynect/models/dns/zone.rb