class SwiftStorage::Container
Public Instance Methods
acl()
click to toggle source
Read the container meta data
@return [Struct]
A struct with `read` and `write` ACL, each entry contains an Array of String.
# File lib/swift_storage/container.rb, line 54 def acl r = headers.read.split(',') rescue nil w = headers.write.split(',') rescue nil struct(:read => r, :write => w) end
create()
click to toggle source
Create the container
# File lib/swift_storage/container.rb, line 20 def create request(relative_path, :method => :put) end
objects()
click to toggle source
Returns the object collection for this container
@return [SwiftStorage::ObjectCollection]
The object collection.
# File lib/swift_storage/container.rb, line 14 def objects @objects ||= SwiftStorage::ObjectCollection.new(self) end
relative_path()
click to toggle source
# File lib/swift_storage/container.rb, line 5 def relative_path name end
write(write_acl: nil, read_acl: nil)
click to toggle source
Write the container meta data
@note This overrides all ACL set on the container.
Each ACL is a string in the following format:
-
`team:jon` give access to user “jon” of account “team”
@param read_acl [Array<String>]
An array of ACL.
@param write_acl [Array<String>]
An array of ACL.
# File lib/swift_storage/container.rb, line 38 def write(write_acl: nil, read_acl: nil) h = {} read_acl = read_acl.join(',') if read_acl.respond_to?(:to_ary) write_acl = write_acl.join(',') if write_acl.respond_to?(:to_ary) h[CONTAINER_READ] = read_acl h[CONTAINER_WRITE] = write_acl request(relative_path, :method => :post, :headers => h) end