2011-05-29 19:41:27 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 20:54:20 -04:00
|
|
|
require 'fog/dnsmadeeasy/models/dns/zone'
|
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 Zones < Fog::Collection
|
|
|
|
|
2011-06-15 20:25:01 -04:00
|
|
|
model Fog::DNS::DNSMadeEasy::Zone
|
2011-05-29 19:41:27 -04:00
|
|
|
|
|
|
|
def all
|
|
|
|
clear
|
2012-12-22 18:28:14 -05:00
|
|
|
data = service.list_domains.body['list'].collect{|domain| {:id => domain}}
|
2011-05-29 19:41:27 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2012-12-22 18:28:14 -05:00
|
|
|
data = service.get_domain(zone_id).body
|
2011-05-29 19:41:27 -04:00
|
|
|
data.merge!(:id => data['name'])
|
|
|
|
new(data)
|
2011-06-21 18:43:52 -04:00
|
|
|
rescue Fog::Service::NotFound
|
2011-05-29 19:41:27 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|