Method: QcloudCos::ConvenientApi#public_url
- Defined in:
- lib/qcloud_cos/convenient_api.rb
permalink #public_url(path, options = {}) ⇒ String
获取文件外网访问地址
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/qcloud_cos/convenient_api.rb', line 93 def public_url(path, = {}) path = fixed_path(path) bucket = validates(path, ) result = stat(path, ) if result.key?('data') && result['data'].key?('access_url') expired = ['expired'] || PUBLIC_EXPIRED_SECONDS sign = .sign(bucket, expired) "#{result['data']['access_url']}?sign=#{sign}" else fail FileNotExistError end end |