1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

add ability to replace existing Dyn records

This commit is contained in:
Brett Lentz 2014-07-02 11:56:52 -04:00
parent dacd27dbda
commit 0cc7a6f3b6

View file

@ -19,7 +19,7 @@ module Fog
true
end
def save
def save(replace=false)
requires :name, :type, :rdata, :zone
options = {
@ -27,7 +27,11 @@ module Fog
}
options.delete_if {|key, value| value.nil?}
if replace
data = service.put_record(type, zone.identity, name, rdata, options).body['data']
else
data = service.post_record(type, zone.identity, name, rdata, options).body['data']
end
# avoid overwriting zone object with zone string
data = data.reject {|key, value| key == 'zone'}
merge_attributes(data)