2011-02-25 01:14:50 +00: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 23:52:59 +00:00
|
|
|
clear
|
2011-02-25 01:14:50 +00:00
|
|
|
data = connection.list_domains.body
|
2011-03-09 23:52:59 +00:00
|
|
|
data.each {|object| self << new(object["domain"]) }
|
2011-02-25 01:14:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2011-02-25 19:25:59 +00:00
|
|
|
data = connection.get_domain(zone_id).body['domain']
|
2011-02-25 05:13:16 +00:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
2011-02-25 01:14:50 +00:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|