Module: Neography::Rest::NodeTraversal

Includes:
Helpers
Included in:
Neography::Rest
Defined in:
lib/neography/rest/node_traversal.rb

Instance Method Summary collapse

Methods included from Helpers

#encode, #escape, #get_id, #json_content_type, #parse_depth, #parse_direction, #parse_order, #parse_type, #parse_uniqueness

Instance Method Details

#traverse(id, return_type, description) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/neography/rest/node_traversal.rb', line 6

def traverse(id, return_type, description)
  options = { :body => {
      "order"           => parse_order(description["order"]),
      "uniqueness"      => parse_uniqueness(description["uniqueness"]),
      "relationships"   => description["relationships"],
      "prune_evaluator" => description["prune evaluator"],
      "return_filter"   => description["return filter"],
      "max_depth"       => parse_depth(description["depth"])
    }.to_json,
    :headers => json_content_type
  }

  type = parse_type(return_type)

  @connection.post("/node/%{id}/traverse/%{type}" % {:id => get_id(id), :type => type}, options) || []
end