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/dns/models/slicehost/records.rb

37 lines
723 B
Ruby
Raw Normal View History

2010-12-23 15:36:08 -08:00
require 'fog/core/collection'
require 'fog/dns/models/slicehost/record'
2010-12-23 15:36:08 -08:00
module Fog
module DNS
class Slicehost
2010-12-23 15:36:08 -08:00
class Records < Fog::Collection
attribute :zone
model Fog::DNS::Slicehost::Record
2010-12-23 15:36:08 -08:00
def all
requires :zone
data = connection.get_records.body['records']
load(data).reject {|record| record.zone_id != zone.id}
end
def get(record_id)
data = connection.get_record(record_id).body
new(data)
rescue Excon::Errors::Forbidden
2010-12-23 15:36:08 -08:00
nil
end
def new(attributes = {})
requires :zone
super({ :zone => zone }.merge!(attributes))
end
end
end
end
end