Sha256: 92b992e5c41b0925d0077364996bee6c119d7e1c7a6d934c4c904491a20d8388

Contents?: true

Size: 1.43 KB

Versions: 7

Compression:

Stored size: 1.43 KB

Contents

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

module Fog
  module DNS
    class Bluebox

      class Zone < Fog::Model

        identity :id

        attribute :domain,        :aliases => 'name'
        attribute :serial
        attribute :ttl
        attribute :retry
        attribute :expires
        attribute :record_count,  :aliases => 'record-count'
        attribute :refresh
        attribute :minimum

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

        def destroy
          raise Fog::Errors::Error.new('Not implemented')
        end

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

        def nameservers
          [
            'ns1.blueblxgrid.com',
            'ns2.blueblxgrid.com',
            'ns3.blueblxgrid.com'
          ]
        end

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

        def save
          requires :domain, :ttl
          options = attributes.dup
          options[:name] = options.delete(:domain)
          data = identity.nil? ? connection.create_zone(options) : connection.update_zone(identity, options)
          merge_attributes(data.body)
          true
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/dns/models/bluebox/zone.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/dns/models/bluebox/zone.rb
fog-0.11.0 lib/fog/dns/models/bluebox/zone.rb
fog-0.10.0 lib/fog/dns/models/bluebox/zone.rb
fog4encbs-0.9.0.1 lib/fog/dns/models/bluebox/zone.rb
fog4encbs-0.9.0 lib/fog/dns/models/bluebox/zone.rb
fog-0.9.0 lib/fog/dns/models/bluebox/zone.rb