Class: Fog::Storage::OpenStack::Directory

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/openstack/models/storage/directory.rb

Instance Attribute Summary collapse

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#create, #initialize, #update

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Attribute Details

#public=(value) ⇒ Object (writeonly)

Sets the attribute public

Parameters:

  • value

    the value to set the attribute public to.



13
14
15
# File 'lib/fog/openstack/models/storage/directory.rb', line 13

def public=(value)
  @public = value
end

Instance Method Details

#destroyObject



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

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

#filesObject



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

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

#public_urlObject



32
33
34
35
36
37
38
39
40
# File 'lib/fog/openstack/models/storage/directory.rb', line 32

def public_url
  requires :key

  @public_url ||= begin
    service.public_url(key)
  rescue Fog::Storage::OpenStack::NotFound => err
    nil
  end
end

#saveObject



42
43
44
45
46
# File 'lib/fog/openstack/models/storage/directory.rb', line 42

def save
  requires :key
  service.put_container(key, :public => @public)
  true
end