highwinds-api 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -19,18 +19,28 @@ Or install it yourself as:
19
19
  ## Usage
20
20
 
21
21
  In order to use this gem follow the installation instructions and properly set your credentials:
22
+
22
23
  username = "<Your username>"
23
24
  password = "<Your password>"
24
25
  HighwindsAPI.set_credentials(username, password)
25
26
 
26
- Purge by path:
27
+ Purge by url:
27
28
 
28
29
  HighwindsAPI::Content.purge_url("http://path.to.folder/or_a_file")
29
30
 
30
- Purge recursivly:
31
+ Purge by url recursively:
31
32
 
32
33
  HighwindsAPI::Content.purge_url("http://path.to.folder/", true)
33
34
 
35
+ Purge folder by path (recursively):
36
+
37
+ HighwindsAPI::Content.purge_path("a1b2c3d4", "folder/")
38
+
39
+ Purge file by path:
40
+
41
+ HighwindsAPI::Content.purge_path("a1b2c3d4", "folder/file")
42
+
43
+
34
44
  ## Contributing
35
45
 
36
46
  1. Fork it
@@ -19,7 +19,15 @@ module HighwindsAPI
19
19
  :headers => { 'Content-Type' => 'application/xml',
20
20
  'Accept' => 'application/xml' },
21
21
  :basic_auth => HighwindsAPI.credentials }
22
- self.delete("/#{host_hash}/cds/#{path}", options)
22
+ res = nil
23
+ if path.is_a? Array
24
+ path.each do |url|
25
+ res = self.delete("/#{host_hash}/cds/#{url.chomp('*')}", options)
26
+ end
27
+ else
28
+ res = self.delete("/#{host_hash}/cds/#{path.chomp('*')}", options)
29
+ end
30
+ res
23
31
  end
24
32
 
25
33
  end
@@ -1,5 +1,5 @@
1
1
  module Highwinds
2
2
  module Api
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
data/spec/content_spec.rb CHANGED
@@ -3,8 +3,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'highwin
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'highwinds-api/content'))
4
4
 
5
5
  describe 'HighwindsAPI::Content' do
6
- username = "<YouUserName>"
7
- password = "<YourPassword>"
6
+ username = "<YourUserHere>"
7
+ password = "<YourPasswordHere>"
8
8
  it "should not purge content, if username and password are not correct." do
9
9
  HighwindsAPI.set_credentials("bad username", "bad password")
10
10
  r = HighwindsAPI::Content.purge_url("http://staging.crossrider.com/kerker/", true).response
@@ -29,4 +29,17 @@ describe 'HighwindsAPI::Content' do
29
29
  r.code.should eq("200"), "response was: #{r}"
30
30
  end
31
31
 
32
+ it "should purge folders by array of pathes" do
33
+ HighwindsAPI.set_credentials(username, password)
34
+ arr = ["kerker/akamai.txt", "kerker/akamai.htm", "kerker/akamai.gif"]
35
+ r = HighwindsAPI::Content.purge_path("y2s9x4y9", arr).response
36
+ r.code.should eq("200"), "response was: #{r}"
37
+ end
38
+
39
+ it "should ignore pathes ending with * (purge by path is allways recuresive)" do
40
+ HighwindsAPI.set_credentials(username, password)
41
+ r = HighwindsAPI::Content.purge_path("y2s9x4y9", "kerker/*").response
42
+ r.code.should eq("200"), "response was: #{r}"
43
+ end
44
+
32
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highwinds-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2013-02-10 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty