Class: Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner
- Inherits:
-
Core::Auth::Signer
- Object
- Core::Auth::Signer
- Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner
- Defined in:
- lib/azure/storage/common/core/auth/shared_access_signature_signer.rb
Instance Attribute Summary collapse
-
#account_name ⇒ Object
readonly
Returns the value of attribute account_name.
-
#api_ver ⇒ Object
Returns the value of attribute api_ver.
Attributes inherited from Core::Auth::Signer
Instance Method Summary collapse
-
#initialize(api_ver, account_name = "", sas_token = "") ⇒ SharedAccessSignatureSigner
constructor
Public: Initialize the Signer with a SharedAccessSignature.
- #sign_request(req) ⇒ Object
Methods inherited from Core::Auth::Signer
Constructor Details
#initialize(api_ver, account_name = "", sas_token = "") ⇒ SharedAccessSignatureSigner
Public: Initialize the Signer with a SharedAccessSignature
40 41 42 43 44 45 46 47 48 49 |
# 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 |
Instance Attribute Details
#account_name ⇒ Object (readonly)
Returns the value of attribute account_name.
32 33 34 |
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 32 def account_name @account_name end |
#api_ver ⇒ Object
Returns the value of attribute api_ver.
33 34 35 |
# File 'lib/azure/storage/common/core/auth/shared_access_signature_signer.rb', line 33 def api_ver @api_ver end |
Instance Method Details
#sign_request(req) ⇒ Object
51 52 53 54 |
# 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 |