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