Class: Xapit::Client::RemoteDatabase
- Inherits:
-
Object
- Object
- Xapit::Client::RemoteDatabase
- Defined in:
- lib/xapit/client/remote_database.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ RemoteDatabase
constructor
A new instance of RemoteDatabase.
- #request(command, options) ⇒ Object
Constructor Details
#initialize(url) ⇒ RemoteDatabase
Returns a new instance of RemoteDatabase.
4 5 6 |
# File 'lib/xapit/client/remote_database.rb', line 4 def initialize(url) @url = url end |
Instance Method Details
#request(command, options) ⇒ Object
14 15 16 17 18 |
# File 'lib/xapit/client/remote_database.rb', line 14 def request(command, ) uri = URI.parse("#{@url}/xapit/#{command}") response = Net::HTTP.start(uri.host, uri.port) { |http| http.request_post(uri.path, .to_json) } Xapit.symbolize_keys(JSON.parse("[#{response.body}]").first) # terrible hack for handling simple objects end |