Class: HTTPI::Adapter::Curb
- Inherits:
-
Object
- Object
- HTTPI::Adapter::Curb
- Defined in:
- lib/httpi/adapter/curb.rb
Overview
HTTPI::Adapter::Curb
Adapter for the Curb client. rubygems.org/gems/curb
Instance Method Summary collapse
-
#client ⇒ Object
Returns a memoized
Curl::Easy
instance. -
#delete(request) ⇒ Object
Executes an HTTP DELETE request.
-
#get(request) ⇒ Object
Executes an HTTP GET request.
-
#head(request) ⇒ Object
Executes an HTTP HEAD request.
-
#initialize(request = nil) ⇒ Curb
constructor
A new instance of Curb.
-
#post(request) ⇒ Object
Executes an HTTP POST request.
-
#put(request) ⇒ Object
Executes an HTTP PUT request.
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
#client ⇒ Object
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.
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.
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.
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.
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.
40 41 42 |
# File 'lib/httpi/adapter/curb.rb', line 40 def put(request) do_request(request) { |client| client.http_put request.body } end |