2011-06-16 17:51:13 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 20:52:11 -04:00
|
|
|
require 'fog/dynect/models/dns/zone'
|
2011-06-16 17:51:13 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-07-14 20:22:43 -04:00
|
|
|
module DNS
|
|
|
|
class Dynect
|
2011-06-16 17:51:13 -04:00
|
|
|
|
|
|
|
class Zones < Fog::Collection
|
|
|
|
|
2011-07-14 20:22:43 -04:00
|
|
|
model Fog::DNS::Dynect::Zone
|
2011-06-16 17:51:13 -04:00
|
|
|
|
|
|
|
def all
|
2012-12-22 18:27:58 -05:00
|
|
|
data = service.get_zone.body['data'].map do |zone|
|
2011-07-14 20:22:43 -04:00
|
|
|
{ :domain => zone }
|
|
|
|
end
|
|
|
|
load(data)
|
2011-06-16 17:51:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2012-12-22 18:27:58 -05:00
|
|
|
new(service.get_zone('zone' => zone_id).body['data'])
|
2011-07-14 20:22:43 -04:00
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
2011-06-16 17:51:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|