rackspace-cloudfiles 1.3.0.5 → 1.3.0.6
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/cloudfiles.gemspec +1 -1
- data/lib/cloudfiles.rb +1 -1
- data/lib/cloudfiles/container.rb +2 -2
- data/test/cloudfiles_container_test.rb +5 -1
- metadata +1 -1
data/cloudfiles.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cloudfiles}
|
5
|
-
s.version = "1.3.0.
|
5
|
+
s.version = "1.3.0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["H. Wade Minter, Rackspace Hosting"]
|
data/lib/cloudfiles.rb
CHANGED
data/lib/cloudfiles/container.rb
CHANGED
@@ -61,8 +61,8 @@ module CloudFiles
|
|
61
61
|
response = self.connection.cfreq("HEAD",@cdnmgmthost,@cdnmgmtpath)
|
62
62
|
raise NoSuchContainerException, "Container #{@name} does not exist" unless (response.code == "204")
|
63
63
|
@cdn_enabled = ((response["x-cdn-enabled"] || "").downcase == "true") ? true : false
|
64
|
-
@cdn_ttl = @
|
65
|
-
@cdn_url = @
|
64
|
+
@cdn_ttl = @cdn_enabled ? response["x-ttl"] : false
|
65
|
+
@cdn_url = @cdn_enabled ? response["x-cdn-uri"] : false
|
66
66
|
|
67
67
|
true
|
68
68
|
end
|
@@ -11,6 +11,8 @@ class CloudfilesContainerTest < Test::Unit::TestCase
|
|
11
11
|
assert_equal @container.name, 'test_container'
|
12
12
|
assert_equal @container.class, CloudFiles::Container
|
13
13
|
assert_equal @container.public?, false
|
14
|
+
assert_equal @container.cdn_url, false
|
15
|
+
assert_equal @container.cdn_ttl, false
|
14
16
|
end
|
15
17
|
|
16
18
|
def test_object_creation_no_such_container
|
@@ -25,13 +27,15 @@ class CloudfilesContainerTest < Test::Unit::TestCase
|
|
25
27
|
|
26
28
|
def test_object_creation_with_cdn
|
27
29
|
connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path')
|
28
|
-
response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5', 'x-cdn-enabled' => 'True'}
|
30
|
+
response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5', 'x-cdn-enabled' => 'True', 'x-cdn-uri' => 'http://cdn.test.example/container', 'x-ttl' => '86400'}
|
29
31
|
response.stubs(:code).returns('204')
|
30
32
|
connection.stubs(:cfreq => response)
|
31
33
|
@container = CloudFiles::Container.new(connection, 'test_container')
|
32
34
|
assert_equal @container.name, 'test_container'
|
33
35
|
assert_equal @container.cdn_enabled, true
|
34
36
|
assert_equal @container.public?, true
|
37
|
+
assert_equal @container.cdn_url, 'http://cdn.test.example/container'
|
38
|
+
assert_equal @container.cdn_ttl, '86400'
|
35
39
|
end
|
36
40
|
|
37
41
|
def test_to_s
|