Class: CF::HTTP::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cf/http/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter = nil) ⇒ Client

Returns a new instance of Client.



6
7
8
# File 'lib/cf/http/client.rb', line 6

def initialize(adapter = nil)
  @adapter = adapter || NetHTTPAdapter.new
end

Instance Method Details

#delete(url, headers = {}) ⇒ Object



26
27
28
# File 'lib/cf/http/client.rb', line 26

def delete(url, headers = {})
  @adapter.request(:delete, url, nil, headers)
end

#get(url, headers = {}) ⇒ Object



10
11
12
# File 'lib/cf/http/client.rb', line 10

def get(url, headers = {})
  @adapter.request(:get, url, nil, headers)
end

#patch(url, body = nil, headers = {}) ⇒ Object



22
23
24
# File 'lib/cf/http/client.rb', line 22

def patch(url, body = nil, headers = {})
  @adapter.request(:patch, url, body, headers)
end

#post(url, body = nil, headers = {}) ⇒ Object



14
15
16
# File 'lib/cf/http/client.rb', line 14

def post(url, body = nil, headers = {})
  @adapter.request(:post, url, body, headers)
end

#put(url, body = nil, headers = {}) ⇒ Object



18
19
20
# File 'lib/cf/http/client.rb', line 18

def put(url, body = nil, headers = {})
  @adapter.request(:put, url, body, headers)
end