Class: Neography::Rest::Gremlin

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/neography/rest/gremlin.rb

Instance Method Summary collapse

Methods included from Helpers

#get_id, #json_content_type, #parse_direction

Constructor Details

#initialize(connection) ⇒ Gremlin

Returns a new instance of Gremlin.



6
7
8
# File 'lib/neography/rest/gremlin.rb', line 6

def initialize(connection)
  @connection = connection
end

Instance Method Details

#execute(script, parameters = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/neography/rest/gremlin.rb', line 10

def execute(script, parameters = {})
  options = {
    :body => {
      :script => script,
      :params => parameters,
    }.to_json,
    :headers => json_content_type
  }
  result = @connection.post(@connection.gremlin_path, options)
  result == "null" ? nil : result
end