class Azure::Core::Service

A base class for Service implementations

Attributes

client[RW]
host[RW]

Public Class Methods

new(host='', options = {}) click to toggle source

Create a new instance of the Service

@param host [String] The hostname. (optional, Default empty) @param options [Hash] options including {:client} (optional, Default {})

# File lib/azure/core/service.rb, line 26
def initialize(host='', options = {})
  @host = host
  @client = options[:client] || Azure
end

Public Instance Methods

call(method, uri, body=nil, headers={}) { |request| ... } click to toggle source
# File lib/azure/core/service.rb, line 33
def call(method, uri, body=nil, headers={})
  request = Core::Http::HttpRequest.new(method, uri, body: body, headers: headers, client: @client)
  yield request if block_given?
  request.call
end
generate_uri(path='', query={}) click to toggle source
# File lib/azure/core/service.rb, line 39
def generate_uri(path='', query={})
  uri = URI.parse(File.join(host, path))
  uri.query = URI.encode_www_form(query) unless query == nil or query.empty?
  uri
end