class Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner

Attributes

account_name[RW]
api_ver[RW]

Public Class Methods

new(api_ver, account_name = "", sas_token = "") click to toggle source

Public: Initialize the Signer with a SharedAccessSignature

@param api_ver [String] The api version of the service. @param account_name [String] The account name. Defaults to the one in the global configuration. @param sas_token [String] The sas token to be used for signing

# File lib/azure/storage/common/core/auth/shared_access_signature_signer.rb, line 40
def initialize(api_ver, account_name = "", sas_token = "")
  if account_name.empty? || sas_token.empty?
    client = Azure::Storage::Common::Client.create_from_env
    account_name = client.storage_account_name if account_name.empty?
    sas_token = client.storage_sas_token if sas_token.empty?
  end
  @api_ver = api_ver
  @account_name = account_name
  @sas_token = sas_token
end

Public Instance Methods

sign_request(req) click to toggle source
# File lib/azure/storage/common/core/auth/shared_access_signature_signer.rb, line 51
def sign_request(req)
  req.uri = URI.parse(req.uri.to_s + (req.uri.query.nil? ? "?" : "&") + sas_token.sub(/^\?/, "") + "&api-version=" + @api_ver)
  req
end