Module: QiniuHelper
Instance Attribute Summary
Attributes included from QiniuCommon
#bucket, #host
Instance Method Summary
collapse
file_for, generate_uptoken, upload_verbose
Instance Method Details
#delete(key) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/qiniu_rails/qiniu_helper.rb', line 28
def delete(key)
code, result, = Qiniu::Storage.delete(
bucket,
key
)
code
end
|
#download_url(key) ⇒ Object
12
13
14
|
# File 'lib/qiniu_rails/qiniu_helper.rb', line 12
def download_url(key)
Qiniu::Auth.authorize_download_url_2(host, key)
end
|
#qiniu_url(key) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/qiniu_rails/qiniu_helper.rb', line 16
def qiniu_url(key)
_host = host
_host = host + '/' unless _host.end_with? '/'
_host = 'http://' + _host unless _host.start_with? 'http://'
_host + key.to_s
end
|
#upload(local_file, key = nil, **options) ⇒ Object
23
24
25
26
|
# File 'lib/qiniu_rails/qiniu_helper.rb', line 23
def upload(local_file, key = nil, **options)
code, result, = upload_verbose(local_file, key, options)
result['key']
end
|