class Fog::DNS::Rackspace::Record
Public Instance Methods
destroy()
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 25 def destroy requires :zone, :identity wait_for_job service.remove_record(@zone.identity, identity).body['jobId'] true end
save()
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 35 def save if persisted? update else create end end
zone()
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 31 def zone @zone end
Private Instance Methods
create()
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 45 def create requires :name, :type, :value, :zone options = { :name => name, :type => type, :data => value } if ttl options[:ttl] = ttl end if priority options[:priority] = priority end response = wait_for_job service.add_records(@zone.identity, [options]).body['jobId'] matching_record = response.body['response']['records'].find do |record| if ['A', 'AAAA'].include?(self.type.upcase) # If this is an A or AAAA record, match by normalized IP address value. (record['name'] == self.name) && (record['type'] == self.type) && (IPAddr.new(record['data']) == IPAddr.new(self.value)) else # Other record types are matched by the raw value. (record['name'] == self.name) && (record['type'] == self.type) && (record['data'] == self.value) end end merge_attributes(matching_record) true end
update()
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 79 def update requires :identity, :zone options = {} options[:name] = name if name options[:type] = type if type options[:data] = value if value options[:priority] = priority if priority options[:ttl] = ttl if ttl wait_for_job service.modify_record(@zone.identity, identity, options).body['jobId'] true end
zone=(new_zone)
click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 93 def zone=(new_zone) @zone = new_zone end