2011-05-29 19:41:27 -04:00
|
|
|
require 'fog/core/model'
|
2011-08-24 20:54:20 -04:00
|
|
|
require 'fog/dnsmadeeasy/models/dns/records'
|
2011-05-29 19:41:27 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class DNSMadeEasy
|
2011-05-29 19:41:27 -04:00
|
|
|
|
|
|
|
class Zone < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
attribute :domain, :aliases => 'name'
|
|
|
|
attribute :gtd_enabled, :aliases => 'gtdEnabled'
|
|
|
|
attribute :nameservers, :aliases => 'nameServer'
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
requires :identity
|
2012-12-22 18:28:14 -05:00
|
|
|
service.delete_domain(identity)
|
2011-05-29 19:41:27 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def records
|
|
|
|
@records ||= begin
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::DNSMadeEasy::Records.new(
|
2011-05-29 19:41:27 -04:00
|
|
|
:zone => self,
|
2012-12-22 18:28:14 -05:00
|
|
|
:service => service
|
2011-05-29 19:41:27 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
|
|
|
requires :domain
|
2012-12-22 18:28:14 -05:00
|
|
|
data = service.create_domain(domain).body
|
2011-05-29 19:41:27 -04:00
|
|
|
self.identity = data['name']
|
|
|
|
merge_attributes(data)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|