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/dynect/records.rb

48 lines
910 B
Ruby
Raw Normal View History

2011-06-16 17:51:13 -04:00
require 'fog/core/collection'
require 'fog/dns/models/dynect/record'
module Fog
module Dynect
class DNS
class Records < Fog::Collection
attribute :zone
model Fog::Dynect::DNS::Record
2011-06-19 04:22:42 -04:00
def all(filter=nil)
selected_nodes = nodes
selected_nodes = nodes.select do |node|
2011-06-19 04:22:42 -04:00
node =~ /#{Regexp.escape(filter)}$/
end if filter
data = selected_nodes.inject([]) do |m, node|
m += connection.list_any_records(zone.id, node).map(&:body)
m
end
load(data)
2011-06-16 17:51:13 -04:00
end
def get(record_id)
end
def new(attributes = {})
2011-06-16 18:04:01 -04:00
requires :zone
super({ :zone => zone }.merge!(attributes))
2011-06-16 17:51:13 -04:00
end
private
def nodes
requires :zone
Array(connection.node_list(zone.id).body)
end
2011-06-16 17:51:13 -04:00
end
end
end
end