Class: RSolr::HTTPClient::Adapter::Curb
- Inherits:
-
Object
- Object
- RSolr::HTTPClient::Adapter::Curb
- Includes:
- Util
- Defined in:
- lib/rsolr/http_client/adapter/curb.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #get(path, params = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Curb
constructor
A new instance of Curb.
- #post(path, data, params = {}, headers = {}) ⇒ Object
Methods included from Util
#build_param, #build_url, #escape, #hash_to_query
Constructor Details
#initialize(opts = {}) ⇒ Curb
Returns a new instance of Curb.
11 12 13 14 |
# File 'lib/rsolr/http_client/adapter/curb.rb', line 11 def initialize(opts={}) @uri = URI.parse(opts[:url]) @connection = ::Curl::Easy.new end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
9 10 11 |
# File 'lib/rsolr/http_client/adapter/curb.rb', line 9 def connection @connection end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/rsolr/http_client/adapter/curb.rb', line 8 def uri @uri end |
Instance Method Details
#get(path, params = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rsolr/http_client/adapter/curb.rb', line 16 def get(path, params={}) @connection.url = _build_url(path, params) @connection.multipart_form_post = false @connection.perform create_http_context(path, params) end |
#post(path, data, params = {}, headers = {}) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rsolr/http_client/adapter/curb.rb', line 23 def post(path, data, params={}, headers={}) @connection.url = _build_url(path, params) @connection.headers = headers @connection.http_post(data) create_http_context(path, params, data, headers) end |