Class: Fog::Storage::Nirvanix::Directory

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject

attribute :bytes, :aliases => ‘X-Container-Bytes-Used’

attribute :count, :aliases => 'X-Container-Object-Count'


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

def destroy
  requires :key
  connection.delete_folder(key)
  true
rescue Excon::Errors::NotFound
  false
end

#filesObject



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

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

#public=(new_public) ⇒ Object



32
33
34
# File 'lib/fog/nirvanix/models/storage/directory.rb', line 32

def public=(new_public)
  @public = new_public
end

#saveObject



36
37
38
39
40
# File 'lib/fog/nirvanix/models/storage/directory.rb', line 36

def save
  requires :key
  connection.create_folder(key)
  true
end