Sha256: 94f357a89bfd7bdfdcbe14b773df279b5bbdbde171e92e727caa757eb7fc9b67
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require "azure/request" require "azure/auth" module Azure module Core class Service # Initialize the service. # # signer - The strategy to use to sign requests. # auth - Authorizer object. Defaults to Azure::Auth.new def initialize(signer, auth=Azure::Auth.new) @signer = signer @auth = auth end # Sign a request to include the necessary authorization header. # # request - An Azure::Request. # signer - A signer strategy (defaults to Azure::Tables::Auth::SharedKey) # # Returns the signed request. def sign_request(request) @auth.sign(request, @signer) end # Invoke the service. # # method - The HTTP method. # uri - The URI path for this service call. # body - The request body, if any (defaults to nil). # # Yields the request before signing it. # # Returns the Response object. def call(method, uri, body=nil, request_factory=Request) request = request_factory.new(method, uri, body) yield request if block_given? sign_request(request) request.request! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
azure-0.1.1 | lib/azure/core/service.rb |
azure-0.1.0 | lib/azure/core/service.rb |