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
|
2011-07-14 20:22:43 -04:00
|
|
|
data = connection.get_zone.body['data'].map do |zone|
|
|
|
|
{ :domain => zone }
|
|
|
|
end
|
|
|
|
load(data)
|
2011-06-16 17:51:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(zone_id)
|
2011-07-14 20:22:43 -04:00
|
|
|
new(connection.get_zone('zone' => zone_id).body['data'])
|
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
2011-06-16 17:51:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|