Class: Miasma::Contrib::AzureApiCore::SignatureAzure::SasBlob

Inherits:
Miasma::Contrib::AzureApiCore::SignatureAzure show all
Defined in:
lib/miasma/contrib/azure.rb

Constant Summary collapse

SIGNATURE_HEADERS =
[
  'Cache-Control',
  'Content-Disposition',
  'Content-Encoding',
  'Content-Language',
  'Content-Type'
]

Instance Attribute Summary

Attributes inherited from Miasma::Contrib::AzureApiCore::SignatureAzure

#account_name, #hmac, #shared_key

Instance Method Summary collapse

Methods inherited from Miasma::Contrib::AzureApiCore::SignatureAzure

#build_canonical_headers, #build_canonical_resource, #generate_signature, #initialize, #sign_request

Methods inherited from Miasma::Contrib::AzureApiCore::Signature

#initialize, #safe_escape

Constructor Details

This class inherits a constructor from Miasma::Contrib::AzureApiCore::SignatureAzure

Instance Method Details

#generate(http_method, path, opts) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/miasma/contrib/azure.rb', line 197

def generate(http_method, path, opts)
  params = opts.fetch(:params, Smash.new)
  headers = opts.fetch(:headers, Smash.new)
  to_sign = [
    params[:sp],
    params[:st],
    params[:se],
    ['/blob', , path].join('/'),
    params[:si],
    params[:sip],
    params[:spr],
    params[:sv],
    *self.class.const_get(:SIGNATURE_HEADERS).map{|head_name|
      headers.fetch(head_name, '')
    }
  ].map(&:to_s).join("\n")
  sign_request(to_sign)
end