From 8dcb5244196a047e3d5f214803a0763780ff25ea Mon Sep 17 00:00:00 2001 From: David Litvak Bruno Date: Thu, 7 Mar 2013 16:12:02 -0300 Subject: [PATCH] purge api --- VERSION | 2 +- lib/netdnarws.rb | 25 +++++++++++++++++++++++++ lib/netdnarws/version.rb | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index abd4105..3a4036f 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.4 +0.2.5 diff --git a/lib/netdnarws.rb b/lib/netdnarws.rb index 0ed1cf9..6af1cd9 100644 --- a/lib/netdnarws.rb +++ b/lib/netdnarws.rb @@ -100,5 +100,30 @@ def delete uri, data={}, options={} options[:body] = false self._response_as_json 'delete', uri, options, data end + + def purge zone_id, file_or_files=nil + if file_or_files.respond_to? :each + responses = Hash.new + + file_or_files.each { |e| + responses[e] = self.delete( + "/zones/pull.json/#{zone_id}/cache", + {'file' => e}, + :debug_json => true + ) + } + return responses + end + + + unless file_or_files.nil? + return self.delete( + "/zones/pull.json/#{zone_id}/cache", + {'file' => file_or_files} + ) + end + + self.delete("/zones/pull.json/#{zone_id}/cache") + end end end diff --git a/lib/netdnarws/version.rb b/lib/netdnarws/version.rb index 82d15e7..5564ea8 100644 --- a/lib/netdnarws/version.rb +++ b/lib/netdnarws/version.rb @@ -1,3 +1,3 @@ module NetDNARWS - VERSION = "0.2.4" + VERSION = "0.2.5" end