Sha256: 6f6db2b2e179d7217d320f3d0613d25a76478db172db6c231af11b22f055c9df
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
require 'fog/core/model' require 'fog/storage/models/rackspace/files' module Fog module Rackspace class Storage class Directory < Fog::Model identity :key, :aliases => 'name' attribute :bytes, :aliases => 'X-Container-Bytes-Used' attribute :count, :aliases => 'X-Container-Object-Count' def destroy requires :key connection.delete_container(key) connection.cdn.post_container(key, 'X-CDN-Enabled' => 'False') true rescue Excon::Errors::NotFound false end def files @files ||= begin Fog::Rackspace::Storage::Files.new( :directory => self, :connection => connection ) end end def public=(new_public) @public = new_public end def public_url requires :key @public_url ||= begin begin response = connection.cdn.head_container(key) response.headers['X-CDN-Enabled'] == 'True' && response.headers['X-CDN-URI'] rescue Fog::Service::NotFound nil end end end def save requires :key connection.put_container(key) if @public @public_url = connection.cdn.put_container(key, 'X-CDN-Enabled' => 'True').headers['X-CDN-URI'] else connection.cdn.put_container(key, 'X-CDN-Enabled' => 'False') @public_url = nil end true end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fog-0.7.1 | lib/fog/storage/models/rackspace/directory.rb |
fog-0.7.0 | lib/fog/storage/models/rackspace/directory.rb |