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

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

Instance Attribute Summary collapse

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from 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/storage/models/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/storage/models/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/storage/models/directory.rb', line 23

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

#public_urlObject



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

def public_url
  requires :key

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

#saveObject



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

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