Sha256: 669fe3f7f7685d88de2aa577a609c490dd4d307c7f9566efd75ca606b2006873
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require 'fog/core/model' module Fog module DNS class Dynect class Record < Fog::Model extend Fog::Deprecation identity :id attribute :name, :aliases => [:fqdn, 'fqdn'] attribute :rdata attribute :serial_style attribute :ttl attribute :type, :aliases => 'record_type' attribute :value def destroy requires :identity, :name, :type, :zone connection.delete_record(type, zone.identity, name, identity) true end def save requires :name, :type, :value, :zone options = { :ttl => ttl } options.delete_if {|key, value| value.nil?} data = connection.post_record(type, zone.identity, name, {'address' => value}, options).body['data'] # avoid overwriting zone object with zone string data = data.reject {|key, value| key == 'zone'} merge_attributes(data) zone.publish records = connection.get_record(type, zone.identity, name).body['data'] # data in format ['/REST/xRecord/domain/fqdn/identity] records.map! do |record| tokens = record.split('/') { :identity => tokens.last, :type => tokens[2][0...-6] # everything before 'Record' } end record = records.detect {|record| record[:type] == type} merge_attributes(record) true end def zone @zone end private def zone=(new_zone) @zone = new_zone end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems