fog--fog/lib/fog/dnsimple/models/dns/zones.rb

26 lines
524 B
Ruby
Raw Normal View History

2011-02-25 01:14:50 +00:00
require 'fog/core/collection'
require 'fog/dnsimple/models/dns/zone'
2011-02-25 01:14:50 +00:00
module Fog
module DNS
class DNSimple
2011-02-25 01:14:50 +00:00
class Zones < Fog::Collection
model Fog::DNS::DNSimple::Zone
2011-02-25 01:14:50 +00:00
def all
clear
data = service.list_domains.body.map {|zone| zone['domain']}
load(data)
2011-02-25 01:14:50 +00:00
end
def get(zone_id)
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