Sha256: df108fdc89c26303a0b2e542a1d4de50fe297a8422f554515f72cf54a67b15f7

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

require 'fog/core/model'

module Fog
  module Bluebox
    class DNS

      class Record < Fog::Model

        identity :id

        attribute :name
        attribute :domain_id,   :aliases => 'domain-id'
        attribute :domain
        attribute :type
        attribute :ip,          :aliases => 'content'

        def initialize(attributes={})
          super
        end

        def destroy
          requires :identity
          connection.delete_record(@zone.identity, identity)
          true
        end

        def zone
          @zone
        end

        def save
          requires :zone, :type, :name, :ip
          data = unless identity
            connection.create_record(zone.identity, type, name, ip)
          else
            connection.update_record(zone.identity, identity, {:type => type, :name => name, :content => ip})
          end
          merge_attributes(data.body)
          true
        end

        private

        def zone=(new_zone)
          @zone = new_zone
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/dns/models/bluebox/record.rb
fog-0.8.1 lib/fog/dns/models/bluebox/record.rb
fog-0.8.0 lib/fog/dns/models/bluebox/record.rb
fog-0.7.2 lib/fog/dns/models/bluebox/record.rb
fog-0.7.1 lib/fog/dns/models/bluebox/record.rb
fog-0.7.0 lib/fog/dns/models/bluebox/record.rb
fog-0.6.0 lib/fog/dns/models/bluebox/record.rb