25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/fog/aliyun/models/storage/directories.rb', line 25
def get(key, options = {})
data = service.get_bucket(key, options)
directory = new(:key => key, :is_persisted => true)
options = data[1]
options[:max_keys] = options[:limit]
directory.files.merge_attributes(options)
objects = []
i = 0
data[0].each do |o|
objects[i] = {
'Key' => o.key,
'Type' => o.type,
'Size' => o.size,
'ETag' => o.etag,
'LastModified' => o.last_modified
}
i += 1
end
directory.files.load(objects)
directory
rescue AliyunOssSdk::ServerError => error
if error.error_code == "NoSuchBucket"
nil
else
raise(error)
end
end
|