lib/google/cloud/storage/bucket.rb in google-cloud-storage-0.23.0 vs lib/google/cloud/storage/bucket.rb in google-cloud-storage-0.23.1

- old
+ new

@@ -611,10 +611,13 @@ # @param [String] content_type When provided, the client (browser) must # send this value in the HTTP header. e.g. `text/plain` # @param [String] content_md5 The MD5 digest value in base64. If you # provide this in the string, the client (usually a browser) must # provide this HTTP header with this same value in its request. + # @param [Hash] headers Google extension headers (custom HTTP headers + # that begin with `x-goog-`) that must be included in requests that + # use the signed URL. # @param [String] issuer Service Account's Client Email. # @param [String] client_email Service Account's Client Email. # @param [OpenSSL::PKey::RSA, String] signing_key Service Account's # Private Key. # @param [OpenSSL::PKey::RSA, String] private_key Service Account's @@ -647,14 +650,26 @@ # key = OpenSSL::PKey::RSA.new "-----BEGIN PRIVATE KEY-----\n..." # shared_url = bucket.signed_url "avatars/heidi/400x400.png", # issuer: "service-account@gcloud.com", # signing_key: key # + # @example Using the headers option: + # require "google/cloud/storage" + # + # storage = Google::Cloud.storage + # + # bucket = storage.bucket "my-todo-app" + # shared_url = bucket.signed_url "avatars/heidi/400x400.png", + # headers: { + # "x-goog-acl" => "private", + # "x-goog-meta-foo" => "bar,baz" + # } + # def signed_url path, method: nil, expires: nil, content_type: nil, - content_md5: nil, issuer: nil, client_email: nil, - signing_key: nil, private_key: nil + content_md5: nil, headers: nil, issuer: nil, + client_email: nil, signing_key: nil, private_key: nil ensure_service! - options = { method: method, expires: expires, + options = { method: method, expires: expires, headers: headers, content_type: content_type, content_md5: content_md5, issuer: issuer, client_email: client_email, signing_key: signing_key, private_key: private_key } signer = File::Signer.from_bucket self, path signer.signed_url options