Class: Fog::Storage::Dtdream::Directories

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

Instance Method Summary collapse

Instance Method Details

#allObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/dtdream/models/storage/directories.rb', line 10

def all
  containers = service.get_containers()
	  if nil == containers
	    return nil
	  end
  data = Array.new
  i = 0
  containers.each do |entry|
    key = entry["Prefix"][0]
    key[-1] = ''
    data[i] = {:key=>key}
    i = i + 1
  end

  load(data)
end

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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/dtdream/models/storage/directories.rb', line 27

def get(key, options = {})
  if key != nil && key != "" && key != '.'
    dir = key+'/'
    ret = service.head_object(dir, options)
    if ret.data[:status] == 200
      new(:key => key)
    else
      nil
    end
  else
    new(:key => "")
  end
rescue Fog::Storage::Dtdream::NotFound
  nil
end