1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

dynect: nicer filter api for records

This commit is contained in:
Michael Hale 2011-06-19 01:22:42 -07:00 committed by geemus
parent f47e4c8af0
commit a772360de7
2 changed files with 4 additions and 4 deletions

View file

@ -11,11 +11,11 @@ module Fog
model Fog::Dynect::DNS::Record
def all(attributes={})
def all(filter=nil)
selected_nodes = nodes
selected_nodes = nodes.select do |node|
Array(attributes[:nodes]).include?(node)
end if attributes[:nodes]
node =~ /#{Regexp.escape(filter)}$/
end if filter
data = selected_nodes.inject([]) do |m, node|
m += connection.list_any_records(zone.id, node).map(&:body)

View file

@ -41,7 +41,7 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
end
tests "model" do
records = Fog::DNS.new(:provider => "Dynect").zones.get(zone).records.all(:nodes => fqdn)
records = Fog::DNS.new(:provider => "Dynect").zones.get(zone).records.all(fqdn)
returns("127.0.0.2") { records.last.value }
end