Sha256: 8b8a3632712476cdf074b238b6d42e14fea7a5de106c02720de5c9d0cc7c24eb
Contents?: true
Size: 1.56 KB
Versions: 6
Compression:
Stored size: 1.56 KB
Contents
module Fog module Storage class Aliyun class Real # Get an expiring object http url # # ==== Parameters # * container<~String> - Name of container containing object # * object<~String> - Name of object to get expiring url for # * expires<~Time> - An expiry time for this url # # ==== Returns # * response<~Excon::Response>: # * body<~String> - url for object def get_object_http_url_public(object, expires, options = {}) options = options.reject { |_key, value| value.nil? } bucket = options[:bucket] bucket ||= @aliyun_oss_bucket acl = get_bucket_acl(bucket) location = get_bucket_location(bucket) if 'private' == acl expires_time = (Time.now.to_i + expires).to_s resource = bucket + '/' + object signature = sign('GET', expires_time, nil, resource) url = 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object + '?OSSAccessKeyId=' + @aliyun_accesskey_id + '&Expires=' + expires_time + '&Signature=' + URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ') elsif 'public-read' == acl || 'public-read-write' == acl url = 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object else url = 'acl is wrong with value:' + acl end end end class Mock def get_object_http_url_public(object, expires, options = {}) end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems