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

Add TTL on save rather than initialize.

Move the TTL default assignment to the #save method instead of applying
it on object initialization.
This commit is contained in:
Eric Hankins 2013-05-14 16:45:42 -05:00
parent ef3bec5ade
commit 226a935fba
12 changed files with 9 additions and 15 deletions

View file

@ -23,7 +23,6 @@ module Fog
attribute :set_identifier,:aliases => ['SetIdentifier']
def initialize(attributes={})
self.ttl ||= 3600
super
end
@ -38,6 +37,7 @@ module Fog
end
def save
self.ttl ||= 3600
options = attributes_to_options('CREATE')
data = service.change_resource_record_sets(zone.id, [options]).body
merge_attributes(data)

View file

@ -19,7 +19,6 @@ module Fog
attribute :minimum
def initialize(attributes = {})
self.ttl ||= 3600
super(attributes)
end
@ -51,6 +50,7 @@ module Fog
end
def save
self.ttl ||= 3600
requires :domain, :ttl
options = attributes.dup
options[:name] = options.delete(:domain)

View file

@ -21,7 +21,6 @@ module Fog
attribute :priority, :aliases => "prio"
def initialize(attributes={})
self.ttl ||= 3600
super
end

View file

@ -25,7 +25,6 @@ module Fog
attribute :value, :aliases => "data"
def initialize(attributes={})
self.ttl ||= 1800
super
end
@ -39,6 +38,7 @@ module Fog
end
def save
self.ttl ||= 1800
requires :name, :type, :value, :ttl
options = {}
options[:ttl] = ttl if ttl

View file

@ -17,7 +17,6 @@ module Fog
attribute :type, :aliases => 'zone_type'
def initialize(attributes={})
self.ttl ||= 3600
super
end
@ -47,6 +46,7 @@ module Fog
end
def save
self.ttl ||= 3600
requires :domain, :email, :ttl
data = service.post_zone(email, ttl, domain).body['data']
merge_attributes(data)

View file

@ -23,7 +23,6 @@ module Fog
# "PORT":0,
def initialize(attributes={})
self.ttl ||= 3600
super
end

View file

@ -24,7 +24,6 @@ module Fog
def initialize(attributes={})
self.type ||= 'master'
self.ttl ||= 3600
super
end

View file

@ -56,6 +56,7 @@ module Fog
end
def save
self.ttl ||= 3600
requires :domain, :type, :ttl
options = {}
# * options<~Hash> - optional paramaters

View file

@ -27,8 +27,7 @@ for provider, config in dns_providers
if !Fog.mocking? || config[:mocked]
zone_attributes = {
:domain => domain_name,
:ttl => 3600
:domain => domain_name
}.merge(config[:zone_attributes] || {})
@zone = Fog::DNS[provider].zones.create(zone_attributes)

View file

@ -15,8 +15,7 @@ for provider, config in dns_providers
if !Fog.mocking? || config[:mocked]
zone_attributes = {
:domain => domain_name,
:ttl => 3600
:domain => domain_name
}.merge(config[:zone_attributes] || {})
@zone = Fog::DNS[provider].zones.create(zone_attributes)

View file

@ -8,8 +8,7 @@ for provider, config in dns_providers
Shindo.tests("Fog::DNS[:#{provider}] | zone", [provider.to_s]) do
zone_attributes = {
:domain => domain_name,
:ttl => 3600
:domain => domain_name
}.merge!(config[:zone_attributes] || {})
model_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked])

View file

@ -8,8 +8,7 @@ for provider, config in dns_providers
Shindo.tests("Fog::DNS[:#{provider}] | zones", [provider.to_s]) do
zone_attributes = {
:domain => domain_name,
:ttl => 3600
:domain => domain_name
}.merge!(config[:zone_attributes] || {})
collection_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked])