Sha256: fdcdd04c2eded3effe58319287a250b5e717c8e7252e19b47ca156ae80a0408e

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

require "fog/brightbox/models/storage/files"

module Fog
  module Brightbox
    class Storage
      class Directory < Fog::Model
        identity :key, :aliases => "name"

        attribute :bytes, :aliases => "X-Container-Bytes-Used"
        attribute :count, :aliases => "X-Container-Object-Count"
        attribute :read_permissions, :aliases => "X-Container-Read"
        attribute :write_permissions, :aliases => "X-Container-Write"

        def destroy
          requires :key
          service.delete_container(key)
          true
        rescue Excon::Errors::NotFound
          false
        end

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

        attr_writer :public

        def public_url
          # raise NotImplementedError
          ""
        end

        def save
          requires :key
          options = {
            "read_permissions" => read_permissions,
            "write_permissions" => write_permissions
          }
          service.put_container(key, options)
          true
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fog-brightbox-1.7.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.6.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.5.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.5.0.rc1 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.4.2 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.4.1 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.4.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.3.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.2.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.1.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.0.0 lib/fog/brightbox/models/storage/directory.rb
fog-brightbox-1.0.0.rc2 lib/fog/brightbox/models/storage/directory.rb