lib/fog/storage/models/rackspace/directory.rb in fog-0.8.2 vs lib/fog/storage/models/rackspace/directory.rb in fog-0.9.0
- old
+ new
@@ -1,18 +1,19 @@
require 'fog/core/model'
require 'fog/storage/models/rackspace/files'
module Fog
- module Rackspace
- class Storage
+ module Storage
+ class Rackspace
class Directory < Fog::Model
identity :key, :aliases => 'name'
attribute :bytes, :aliases => 'X-Container-Bytes-Used'
attribute :count, :aliases => 'X-Container-Object-Count'
+ attribute :cdn_cname
def destroy
requires :key
connection.delete_container(key)
connection.cdn.post_container(key, 'X-CDN-Enabled' => 'False')
@@ -21,11 +22,11 @@
false
end
def files
@files ||= begin
- Fog::Rackspace::Storage::Files.new(
+ Fog::Storage::Rackspace::Files.new(
:directory => self,
:connection => connection
)
end
end
@@ -40,10 +41,10 @@
begin response = connection.cdn.head_container(key)
if response.headers['X-CDN-Enabled'] == 'True'
if connection.rackspace_cdn_ssl == true
response.headers['X-CDN-SSL-URI']
else
- response.headers['X-CDN-URI']
+ cdn_cname || response.headers['X-CDN-URI']
end
end
rescue Fog::Service::NotFound
nil
end