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

Merge branch 'master' of github.com:fog/fog into purge_objects

This commit is contained in:
Kyle Rames 2013-02-01 16:16:55 -06:00
commit 4dbdd58387

View file

@ -8,9 +8,9 @@ module Fog
model Fog::DNS::Rackspace::Zone
def all
def all(options={})
clear
data = service.list_domains.body['domains']
data = service.list_domains(options).body['domains']
load(data)
end
@ -22,6 +22,30 @@ module Fog
data = service.list_domains(:name => substring).body['domains']
load(data)
end
alias :each_zone_this_page :each
def each
if !block_given?
self
else
body = service.list_domains.body
subset = dup.all
subset.each_zone_this_page {|f| yield f}
if body.has_key?('links')
while !body['links'].select{|l| l['rel'] == 'next'}.empty?
url = body['links'].select{|l| l['rel'] == 'next'}.first['href']
query = url.match(/\?(.+)/)
parsed = CGI.parse($1)
body = service.list_domains(:offset => parsed['offset'], :limit => parsed['limit']).body
subset = dup.all(:offset => parsed['offset'], :limit => parsed['limit'])
subset.each_zone_this_page {|f| yield f}
end
end
self
end
end
def get(zone_id)
if zone_id.nil? or zone_id.to_s.empty?