1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/dnsimple/models/dns/zones.rb

30 lines
528 B
Ruby
Raw Normal View History

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