Class: Neography::Rest::NodeTraversal

Inherits:
Object
  • Object
show all
Extended by:
Paths
Includes:
Helpers
Defined in:
lib/neography/rest/node_traversal.rb

Instance Method Summary collapse

Methods included from Paths

add_path, build_path, encode

Methods included from Helpers

#get_id, #json_content_type, #parse_direction

Constructor Details

#initialize(connection) ⇒ NodeTraversal

Returns a new instance of NodeTraversal.



9
10
11
# File 'lib/neography/rest/node_traversal.rb', line 9

def initialize(connection)
  @connection = connection
end

Instance Method Details

#traverse(id, return_type, description) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/neography/rest/node_traversal.rb', line 13

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

  type = get_type(return_type)

  @connection.post(traversal_path(:id => get_id(id), :type => type), options) || []
end