Class: Vayacondios::HttpClient
- Inherits:
-
Object
- Object
- Vayacondios::HttpClient
- Includes:
- Gorillib::Model
- Defined in:
- lib/vayacondios/client/http_client.rb
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
Instance Method Details
#fetch(type, id) ⇒ Object
19 20 21 |
# File 'lib/vayacondios/client/http_client.rb', line 19 def fetch(type, id) request(:get, type, id) end |
#insert(document = {}, type = nil, id = nil) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/vayacondios/client/http_client.rb', line 23 def insert(document = {}, type = nil, id = nil) id ||= document.delete(:_id) || document.delete('_id') type ||= document.delete(:_type) || document.delete('_type') request(:post, type, id, MultiJson.dump(document)) end |
#uri ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/vayacondios/client/http_client.rb', line 11 def uri return @uri if @uri uri_str = "http://#{host}:#{port}/v1" uri_str += "/#{organization}" if organization @uri ||= URI(uri_str) end |