Class: Fog::Storage::Aliyun::Directory

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



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

def destroy
  requires :key
  prefix = key+'/'
  ret = service.list_objects(:prefix=>prefix)["Contents"]
  
  if ret.nil?
    puts " Not found: Direction not exist!"
    false
  elsif ret.size == 1
    service.delete_container(key)
    true
  else
    raise Fog::Storage::Aliyun::Error, " Forbidden: Direction not empty!"
    false
  end
end

#filesObject



27
28
29
30
31
32
33
34
# File 'lib/fog/aliyun/models/storage/directory.rb', line 27

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

#public_urlObject



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

def public_url
  nil
end

#saveObject



40
41
42
43
44
# File 'lib/fog/aliyun/models/storage/directory.rb', line 40

def save
  requires :key
  service.put_container(key)
  true
end