Class: Azure::Core::Service
- Inherits:
-
Object
- Object
- Azure::Core::Service
- Defined in:
- lib/azure/core/service.rb
Overview
A base class for Service implementations
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#host ⇒ Object
Returns the value of attribute host.
Instance Method Summary collapse
- #call(method, uri, body = nil, headers = {}) {|request| ... } ⇒ Object
- #generate_uri(path = '', query = {}) ⇒ Object
-
#initialize(host = '', options = {}) ⇒ Service
constructor
Create a new instance of the Service.
Constructor Details
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
31 32 33 |
# File 'lib/azure/core/service.rb', line 31 def client @client end |
#host ⇒ Object
Returns the value of attribute host.
31 32 33 |
# File 'lib/azure/core/service.rb', line 31 def host @host end |
Instance Method Details
#call(method, uri, body = nil, headers = {}) {|request| ... } ⇒ Object
33 34 35 36 37 |
# 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 = {}) ⇒ Object
39 40 41 42 43 |
# 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 |