Class: Fog::Brightbox::Storage::Directory

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/brightbox/models/storage/directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#public=(value) ⇒ Object (writeonly)

Sets the attribute public

Parameters:

  • value

    the value to set the attribute public to.



31
32
33
# File 'lib/fog/brightbox/models/storage/directory.rb', line 31

def public=(value)
  @public = value
end

Instance Method Details

#destroyObject



14
15
16
17
18
19
20
# File 'lib/fog/brightbox/models/storage/directory.rb', line 14

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

#filesObject



22
23
24
25
26
27
28
29
# File 'lib/fog/brightbox/models/storage/directory.rb', line 22

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

#public_urlObject



33
34
35
36
37
# File 'lib/fog/brightbox/models/storage/directory.rb', line 33

def public_url
  requires :key
  @public_url ||= ::File.join(service.management_url.to_s,
                              Fog::Brightbox::Storage.escape(key, "/"))
end

#saveObject



39
40
41
42
43
44
45
46
47
# File 'lib/fog/brightbox/models/storage/directory.rb', line 39

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