Sha256: 12aa04e7a54235d0184b6063a4a700a29b0a6ff6494fd9e429fa7ec7928b5c8f

Contents?: true

Size: 946 Bytes

Versions: 8

Compression:

Stored size: 946 Bytes

Contents

require 'fog/core/model'
require 'fog/rackspace/models/storage/files'

module Fog
  module Rackspace
    class Storage

      class Directory < Fog::Model
        extend Fog::Deprecation
        deprecate(:name, :key)
        deprecate(:name=, :key=)

        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)
          true
        rescue Excon::Errors::NotFound
          false
        end

        def files
          @files ||= begin
            Fog::Rackspace::Storage::Files.new(
              :directory    => self,
              :connection   => connection
            )
          end
        end

        def save
          requires :key
          connection.put_container(key)
          true
        end

      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.3.16 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.15 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.14 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.13 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.12 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.11 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.10 lib/fog/rackspace/models/storage/directory.rb
fog-0.3.9 lib/fog/rackspace/models/storage/directory.rb