netdnarws 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,12 +13,18 @@ api.get("/account.json")
13
13
  ```
14
14
 
15
15
  ## Methods
16
- It has support for GET, POST, PUT and DELETE ouath signed requests.
16
+ It has support for `GET`, `POST`, `PUT` and `DELETE` OAuth 1.0a signed requests.
17
17
 
18
- Every request can take an optional debug parameter.
19
18
  ```ruby
20
- api.get("/account.json", :debug => true)
21
- # Will output
22
- # Making GET request to http://rws.netdna.com/myalias/account.json
23
- #{... API Returned Stuff ...}
19
+ # To create a new Pull Zone
20
+ api.post("/zones/pull.json", {'name' => 'test_zone', 'url' => 'http://my-test-site.com'})
21
+
22
+ # To update an existing zone
23
+ api.put("/zones/pull.json/1234", {'name' => 'i_didnt_like_test'})
24
+
25
+ # To delete a zone
26
+ api.delete("/zones/pull.json/1234")
27
+
28
+ # To purge a file (robots.txt) from cache
29
+ api.delete("/zones/pull.json/1234/cache", {"file" => "/robots.txt"})
24
30
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -1,3 +1,3 @@
1
1
  module NetDNARWS
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/netdnarws.rb CHANGED
@@ -100,5 +100,30 @@ module NetDNARWS
100
100
  options[:body] = false
101
101
  self._response_as_json 'delete', uri, options, data
102
102
  end
103
+
104
+ def purge zone_id, file_or_files=nil
105
+ if file_or_files.respond_to? :each
106
+ responses = Hash.new
107
+
108
+ file_or_files.each { |e|
109
+ responses[e] = self.delete(
110
+ "/zones/pull.json/#{zone_id}/cache",
111
+ {'file' => e},
112
+ :debug_json => true
113
+ )
114
+ }
115
+ return responses
116
+ end
117
+
118
+
119
+ unless file_or_files.nil?
120
+ return self.delete(
121
+ "/zones/pull.json/#{zone_id}/cache",
122
+ {'file' => file_or_files}
123
+ )
124
+ end
125
+
126
+ self.delete("/zones/pull.json/#{zone_id}/cache")
127
+ end
103
128
  end
104
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netdnarws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable