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

36 lines
723 B
Ruby

require 'fog/core/collection'
require 'fog/slicehost/models/dns/record'
module Fog
module DNS
class Slicehost
class Records < Fog::Collection
attribute :zone
model Fog::DNS::Slicehost::Record
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
nil
end
def new(attributes = {})
requires :zone
super({ :zone => zone }.merge!(attributes))
end
end
end
end
end