2011-02-25 01:14:50 +00:00
|
|
|
require 'fog/core/collection'
|
2011-08-25 00:56:22 +00:00
|
|
|
require 'fog/dnsimple/models/dns/zone'
|
2011-02-25 01:14:50 +00:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 00:25:01 +00:00
|
|
|
module DNS
|
|
|
|
class DNSimple
|
2011-02-25 01:14:50 +00:00
|
|
|
class Zones < Fog::Collection
|
2011-06-16 00:25:01 +00:00
|
|
|
model Fog::DNS::DNSimple::Zone
|
2011-02-25 01:14:50 +00:00
|
|
|
|
|
|
|
def all
|
2011-03-09 23:52:59 +00:00
|
|
|
clear
|
2012-12-22 23:28:30 +00:00
|
|
|
data = service.list_domains.body.map {|zone| zone['domain']}
|
2011-03-10 20:24:41 +00:00
|
|
|
load(data)
|
2011-02-25 01:14:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2012-12-22 23:28:30 +00:00
|
|
|
data = service.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
|