2011-02-24 20:14:50 -05:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/dns/models/dnsimple/zone'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module DNSimple
|
|
|
|
class DNS
|
|
|
|
|
|
|
|
class Zones < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::DNSimple::DNS::Zone
|
|
|
|
|
|
|
|
def all
|
2011-03-09 18:52:59 -05:00
|
|
|
clear
|
2011-03-10 15:24:41 -05:00
|
|
|
data = connection.list_domains.body.map {|zone| zone['domain']}
|
|
|
|
load(data)
|
2011-02-24 20:14:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2011-02-25 14:25:59 -05:00
|
|
|
data = connection.get_domain(zone_id).body['domain']
|
2011-02-25 00:13:16 -05:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
2011-02-24 20:14:50 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|