Class: Fog::Storage::HP::SharedDirectories

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

Instance Method Summary collapse

Instance Method Details

#allObject



10
11
12
# File 'lib/fog/hp/models/storage/shared_directories.rb', line 10

def all
  nil
end

#get(url) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/hp/models/storage/shared_directories.rb', line 29

def get(url)
  data = service.get_shared_container(url)
  shared_directory = new(:url => url)
  for key, value in data.headers
    if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key)
      shared_directory.merge_attributes(key => value)
    end
  end
  # set the files for the directory
  shared_directory.files.instance_variable_set(:@loaded, true)
  data.body.each do |file|
    shared_directory.files << shared_directory.files.new(file)
  end

  shared_directory
# throws exception Fog::HP::Errors::Forbidden if insufficient access
rescue Fog::Storage::HP::NotFound
  nil
end

#head(url) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/hp/models/storage/shared_directories.rb', line 14

def head(url)
  data = service.head_shared_container(url)
  shared_directory = new(:url => url)
  for key, value in data.headers
    if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key)
      shared_directory.merge_attributes(key => value)
    end
  end

  shared_directory
# throws exception Fog::HP::Errors::Forbidden if insufficient access
rescue Fog::Storage::HP::NotFound
  nil
end