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

30 lines
547 B
Ruby
Raw Normal View History

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
clear
2011-02-25 01:14:50 +00:00
data = connection.list_domains.body
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