Class: Fog::Rackspace::Files::Directories

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/files/directories.rb

Instance Method Summary collapse

Methods inherited from Collection

#_dump, _load, aliases, attribute, #attributes, attributes, #connection, #connection=, #create, #initialize, #inspect, #load, #merge_attributes, model, #model, #new, #reload, #table, #to_json

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject


24
25
26
27
# File 'lib/fog/rackspace/models/files/directories.rb', line 24

def all
  data = connection.get_containers.body
  load(data)
end

#get(name, options = {}) ⇒ Object


29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/rackspace/models/files/directories.rb', line 29

def get(name, options = {})
  data = connection.get_container(name, options).body
  directory = new(:name => name)
  directory.files.merge_attributes(options)
  directory.files.instance_variable_set(:@loaded, true)
  data.each do |file|
    directory.files << directory.files.new(file)
  end
  directory
rescue Excon::Errors::NotFound
  nil
end