Class: VpsbClient::HttpClient

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

Instance Method Summary collapse

Constructor Details

#initialize(curl_wrapper, protocol, hostname) ⇒ HttpClient

Returns a new instance of HttpClient.



3
4
5
6
7
# File 'lib/vpsb_client/http_client.rb', line 3

def initialize(curl_wrapper, protocol, hostname)
  @protocol = protocol
  @hostname = hostname
  @curl_wrapper = curl_wrapper
end

Instance Method Details

#get(request) ⇒ Object



9
10
11
# File 'lib/vpsb_client/http_client.rb', line 9

def get(request)
  @curl_wrapper.get(url(request))
end

#post(request) ⇒ Object



13
14
15
16
# File 'lib/vpsb_client/http_client.rb', line 13

def post(request)
  post_params = post_params(request, request.content_type)
  @curl_wrapper.post(url(request), post_params, request.content_type)
end

#put(request) ⇒ Object



18
19
20
21
# File 'lib/vpsb_client/http_client.rb', line 18

def put(request)
  put_params = put_params(request, request.content_type)
  @curl_wrapper.put(url(request), put_params, request.content_type)
end