Class: HttpClient
- Inherits:
-
Object
- Object
- HttpClient
- Includes:
- CurlCommandGenerator
- Defined in:
- lib/http_client.rb
Instance Method Summary collapse
-
#initialize(protocol, host, port, namespace) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #send_request(method, resource, headers = nil, data = nil, params = nil) ⇒ Object
Methods included from CurlCommandGenerator
Constructor Details
#initialize(protocol, host, port, namespace) ⇒ HttpClient
Returns a new instance of HttpClient.
10 11 12 13 14 15 16 |
# File 'lib/http_client.rb', line 10 def initialize(protocol, host, port, namespace) @http = Net::HTTP.new(host, port) @protocol = protocol @host = host @port = port @namespace = namespace end |
Instance Method Details
#send_request(method, resource, headers = nil, data = nil, params = nil) ⇒ Object
18 19 20 21 |
# File 'lib/http_client.rb', line 18 def send_request(method, resource, headers=nil, data=nil, params=nil) runtime, response = self.send(method.to_s.downcase, headers, resource, data, params) build_response(response, runtime, method, resource, params) end |