Class: Solr::HTTPClient::Adapter::NetHTTP
- Inherits:
-
Object
- Object
- Solr::HTTPClient::Adapter::NetHTTP
- Includes:
- Util
- Defined in:
- lib/solr/http_client/adapter/net_http.rb
Instance Attribute Summary collapse
-
#c ⇒ Object
readonly
Returns the value of attribute c.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #get(path, params = {}) ⇒ Object
-
#initialize(url) ⇒ NetHTTP
constructor
A new instance of NetHTTP.
- #post(path, data, params = {}, headers = {}) ⇒ Object
Constructor Details
#initialize(url) ⇒ NetHTTP
Returns a new instance of NetHTTP.
10 11 12 13 |
# File 'lib/solr/http_client/adapter/net_http.rb', line 10 def initialize(url) @uri = URI.parse(url) @c = Net::HTTP.new(@uri.host, @uri.port) end |
Instance Attribute Details
#c ⇒ Object (readonly)
Returns the value of attribute c.
8 9 10 |
# File 'lib/solr/http_client/adapter/net_http.rb', line 8 def c @c end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/solr/http_client/adapter/net_http.rb', line 7 def uri @uri end |
Instance Method Details
#get(path, params = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/solr/http_client/adapter/net_http.rb', line 15 def get(path, params={}) url = _build_url(path, params) net_http_response = @c.get(url) create_http_context(net_http_response, url, path, params) end |
#post(path, data, params = {}, headers = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/solr/http_client/adapter/net_http.rb', line 21 def post(path, data, params={}, headers={}) url = _build_url(path, params) net_http_response = @c.post(url, data, headers) create_http_context(net_http_response, url, path, params, data, headers) end |