Class: HttpClient

Inherits:
Object
  • Object
show all
Includes:
CurlCommandGenerator
Defined in:
lib/http_client.rb

Instance Method Summary collapse

Methods included from CurlCommandGenerator

#curlize

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