highwinds-api 0.0.1 → 0.0.2
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 +2 -0
- data/lib/highwinds-api/content.rb +14 -6
- data/lib/highwinds-api/version.rb +1 -1
- data/spec/content_spec.rb +16 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -24,9 +24,11 @@ In order to use this gem follow the installation instructions and properly set y
|
|
24
24
|
HighwindsAPI.set_credentials(username, password)
|
25
25
|
|
26
26
|
Purge by path:
|
27
|
+
|
27
28
|
HighwindsAPI::Content.purge_url("http://path.to.folder/or_a_file")
|
28
29
|
|
29
30
|
Purge recursivly:
|
31
|
+
|
30
32
|
HighwindsAPI::Content.purge_url("http://path.to.folder/", true)
|
31
33
|
|
32
34
|
## Contributing
|
@@ -2,17 +2,25 @@ module HighwindsAPI
|
|
2
2
|
require 'httparty'
|
3
3
|
class Content
|
4
4
|
include HTTParty
|
5
|
-
|
5
|
+
# debug_output $stdout # adds HTTP debugging
|
6
|
+
|
6
7
|
base_uri 'https://striketracker2.highwinds.com/webservices/content/'
|
7
|
-
|
8
|
+
|
8
9
|
def self.purge_url(url, recursive)
|
9
10
|
options = {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
11
|
+
:headers => { 'Content-Type' => 'application/xml',
|
12
|
+
'Accept' => 'application/xml' },
|
13
|
+
:basic_auth => HighwindsAPI.credentials }
|
14
14
|
self.delete("?recursive=#{recursive}&url=#{url}", options)
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.purge_path(host_hash, path)
|
18
|
+
options = {
|
19
|
+
:headers => { 'Content-Type' => 'application/xml',
|
20
|
+
'Accept' => 'application/xml' },
|
21
|
+
:basic_auth => HighwindsAPI.credentials }
|
22
|
+
self.delete("/#{host_hash}/cds/#{path}", options)
|
23
|
+
end
|
24
|
+
|
17
25
|
end
|
18
26
|
end
|
data/spec/content_spec.rb
CHANGED
@@ -3,18 +3,30 @@ 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 = "<
|
7
|
-
password = "<
|
6
|
+
username = "<YouUserName>"
|
7
|
+
password = "<YourPassword>"
|
8
8
|
it "should not purge content, if username and password are not correct." do
|
9
|
-
HighwindsAPI.set_credentials(username, password)
|
9
|
+
HighwindsAPI.set_credentials("bad username", "bad password")
|
10
10
|
r = HighwindsAPI::Content.purge_url("http://staging.crossrider.com/kerker/", true).response
|
11
11
|
r.code.should eq("403"), "response was: #{r}"
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should purge content by url" do
|
15
15
|
HighwindsAPI.set_credentials(username, password)
|
16
16
|
r = HighwindsAPI::Content.purge_url("http://staging.crossrider.com/kerker/", true).response
|
17
17
|
r.code.should eq("200"), "response was: #{r}"
|
18
18
|
end
|
19
19
|
|
20
|
+
it "should purge folder by path" do
|
21
|
+
HighwindsAPI.set_credentials(username, password)
|
22
|
+
r = HighwindsAPI::Content.purge_path("y2s9x4y9", "kerker/").response
|
23
|
+
r.code.should eq("200"), "response was: #{r}"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should purge file by path" do
|
27
|
+
HighwindsAPI.set_credentials(username, password)
|
28
|
+
r = HighwindsAPI::Content.purge_path("y2s9x4y9", "kerker/akamai").response
|
29
|
+
r.code.should eq("200"), "response was: #{r}"
|
30
|
+
end
|
31
|
+
|
20
32
|
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.
|
4
|
+
version: 0.0.2
|
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-
|
12
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|