module Neoon::Client::Request

Public Instance Methods

cypher(query, parameters = {}) click to toggle source
# File lib/neoon/client/request.rb, line 5
def cypher(query, parameters = {})
  options = { :query => query, :params => parameters }
  post('/cypher', options)
end
Also aliased as: q
delete(path, options={}) click to toggle source
# File lib/neoon/client/request.rb, line 23
def delete(path, options={})
  make_request(:delete, '/db/data' + path, options)
end
get(path, options={}) click to toggle source
# File lib/neoon/client/request.rb, line 11
def get(path, options={})
  make_request(:get, '/db/data' + path, options)
end
post(path, options={}) click to toggle source
# File lib/neoon/client/request.rb, line 15
def post(path, options={})
  make_request(:post, '/db/data' + path, options)
end
put(path, options={}) click to toggle source
# File lib/neoon/client/request.rb, line 19
def put(path, options={})
  make_request(:put, '/db/data' + path, options)
end
q(query, parameters = {})
Alias for: cypher

Private Instance Methods

make_request(method, path, options) click to toggle source
# File lib/neoon/client/request.rb, line 29
def make_request(method, path, options)
  response = connection.send(method) do |request|
    case method
    when :get, :delete
      request.url(path, options)
    when :post, :put
      request.path = path
      request.body = options unless options.empty?
    end
  end
  response.body
end