Class: HTTPI::Adapter::Curb

Inherits:
Object
  • Object
show all
Defined in:
lib/httpi/adapter/curb.rb

Overview

HTTPI::Adapter::Curb

Adapter for the Curb client. rubygems.org/gems/curb

Instance Method Summary collapse

Constructor Details

#initialize(request = nil) ⇒ Curb

Returns a new instance of Curb.



12
13
# File 'lib/httpi/adapter/curb.rb', line 12

def initialize(request = nil)
end

Instance Method Details

#clientObject

Returns a memoized Curl::Easy instance.



16
17
18
# File 'lib/httpi/adapter/curb.rb', line 16

def client
  @client ||= Curl::Easy.new
end

#delete(request) ⇒ Object

Executes an HTTP DELETE request.

See Also:



46
47
48
# File 'lib/httpi/adapter/curb.rb', line 46

def delete(request)
  do_request(request) { |client| client.http_delete }
end

#get(request) ⇒ Object

Executes an HTTP GET request.

See Also:



22
23
24
# File 'lib/httpi/adapter/curb.rb', line 22

def get(request)
  do_request(request) { |client| client.http_get }
end

#head(request) ⇒ Object

Executes an HTTP HEAD request.

See Also:



34
35
36
# File 'lib/httpi/adapter/curb.rb', line 34

def head(request)
  do_request(request) { |client| client.http_head }
end

#post(request) ⇒ Object

Executes an HTTP POST request.

See Also:



28
29
30
# File 'lib/httpi/adapter/curb.rb', line 28

def post(request)
  do_request(request) { |client| client.http_post request.body }
end

#put(request) ⇒ Object

Executes an HTTP PUT request.

See Also:



40
41
42
# File 'lib/httpi/adapter/curb.rb', line 40

def put(request)
  do_request(request) { |client| client.http_put request.body }
end