Method: Aliyun::OSS::Connection#url_for

Defined in:
lib/aliyun/oss/connection.rb

#url_for(path, options = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/aliyun/oss/connection.rb', line 60

def url_for(path, options = {})
  authenticate = options.delete(:authenticated)
  # Default to true unless explicitly false
  authenticate = true if authenticate.nil? 
  path         = self.class.prepare_path(path)
  request      = request_method(:get).new(path, {})
  query_string = query_string_authentication(request, options)
  "#{protocol(options)}#{http.address}#{port_string}#{path}".tap do |url|
    url << "?#{query_string}" if authenticate
  end
end