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
|
|
|
|
connection.delete_domain(identity)
|
|
|
|
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,
|
|
|
|
:connection => connection
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
|
|
|
requires :domain
|
|
|
|
data = connection.create_domain(domain).body
|
|
|
|
self.identity = data['name']
|
|
|
|
merge_attributes(data)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|