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



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

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



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

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

#public_urlObject



38
39
40
# File 'lib/fog/aliyun/models/storage/directory.rb', line 38

def public_url
  nil
end

#saveObject



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

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