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