Sha256: a74d303b744fdfba35a536f3ef02ffc5418777b1d9f0886f92d7192a22bc2733

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

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

module Fog
  module Bluebox
    class DNS

      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 = {})
          super(attributes)
        end

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

        def records
          @records ||= begin
            Fog::Bluebox::DNS::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

3 entries across 3 versions & 1 rubygems

Version Path
fog-0.7.1 lib/fog/dns/models/bluebox/zone.rb
fog-0.7.0 lib/fog/dns/models/bluebox/zone.rb
fog-0.6.0 lib/fog/dns/models/bluebox/zone.rb