2010-12-23 19:47:47 -05:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 20:50:12 -04:00
|
|
|
require 'fog/linode/models/dns/record'
|
2010-12-23 19:47:47 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class Linode
|
2010-12-23 19:47:47 -05:00
|
|
|
|
|
|
|
class Records < Fog::Collection
|
|
|
|
|
|
|
|
attribute :zone
|
|
|
|
|
2011-06-15 20:25:01 -04:00
|
|
|
model Fog::DNS::Linode::Record
|
2010-12-23 19:47:47 -05:00
|
|
|
|
|
|
|
def all
|
|
|
|
requires :zone
|
|
|
|
data = connection.domain_resource_list(zone.id).body['DATA']
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(record_id)
|
2011-01-03 18:39:38 -05:00
|
|
|
if data = connection.domain_resource_list(zone.id, record_id).body['DATA'].first
|
|
|
|
new(data)
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
2010-12-23 19:47:47 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def new(attributes = {})
|
|
|
|
requires :zone
|
|
|
|
super({ :zone => zone }.merge!(attributes))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|