Class: Fog::Storage::Atmos::Directories
- Inherits:
-
Collection
- Object
- Collection
- Fog::Storage::Atmos::Directories
- Defined in:
- lib/fog/atmos/models/storage/directories.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/atmos/models/storage/directories.rb', line 12 def all directory ? ns = directory.key : ns = '' ns = ns + '/' unless ns =~ /\/$/ data = service.get_namespace(ns).body[:DirectoryList] data = {:DirectoryEntry => []} if data.kind_of? String data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash dirs = data[:DirectoryEntry].select {|de| de[:FileType] == 'directory'} dirs.each do |d| d[:Filename] = ns + d[:Filename] if directory d[:Filename] += '/' unless d[:Filename] =~ /\/$/ end load(dirs) end |
#get(key, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/atmos/models/storage/directories.rb', line 26 def get(key, = {}) return nil if key == '' # Root dir shouldn't be retrieved like this. key =~ /\/$/ ? ns = key : ns = key + '/' res = service.get_namespace ns = res.headers['x-emc-meta'] obj_id = .scan(/objectid=(\w+),/).flatten[0] new(:objectid => obj_id, :key => ns) rescue Fog::Storage::Atmos::NotFound nil end |
#new(attributes = {}) ⇒ Object
37 38 39 40 |
# File 'lib/fog/atmos/models/storage/directories.rb', line 37 def new(attributes ={}) attributes = {:directory => directory}.merge(attributes) if directory super(attributes) end |