1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/dynect/models/dns/zone.rb

61 lines
1.3 KiB
Ruby
Raw Normal View History

2011-06-16 17:51:13 -04:00
require 'fog/core/model'
require 'fog/dynect/models/dns/records'
2011-06-16 17:51:13 -04:00
module Fog
module DNS
class Dynect
2011-06-16 17:51:13 -04:00
class Zone < Fog::Model
identity :domain
attribute :domain, :aliases => 'zone'
attribute :email, :aliases => 'rname'
2011-06-17 06:51:37 -04:00
attribute :serial
attribute :serial_style
attribute :ttl
attribute :type, :aliases => 'zone_type'
def initialize(attributes={})
self.ttl ||= 3600
super
end
2011-06-16 17:51:13 -04:00
def destroy
requires :domain
connection.delete_zone(domain)
true
end
undef_method :domain=
def domain=(new_domain)
attributes[:domain] = new_domain.split('/').last
end
def publish
requires :identity
data = connection.put_zone(identity, :publish => true)
true
2011-06-16 17:51:13 -04:00
end
def records
@records ||= Fog::DNS::Dynect::Records.new(:zone => self, :connection => connection)
2011-06-16 17:51:13 -04:00
end
def nameservers
raise 'nameservers Not Implemented'
2011-06-16 17:51:13 -04:00
end
def save
requires :domain, :email, :ttl
data = connection.post_zone(email, ttl, domain).body['data']
merge_attributes(data)
true
2011-06-16 17:51:13 -04:00
end
end
end
end
end