Module: N4j::Node::ClassMethods

Defined in:
lib/n4j/node.rb

Overview

include N4j::Entity

Instance Method Summary collapse

Instance Method Details

#find(n) ⇒ Object



11
12
13
# File 'lib/n4j/node.rb', line 11

def find(n)
  find_by_node_id(n)
end

#find_by_node_id(n) ⇒ Object



15
16
17
# File 'lib/n4j/node.rb', line 15

def find_by_node_id(n)
  find_by_path("/node/#{n}")
end

#find_by_path(path) ⇒ Object



19
20
21
22
23
# File 'lib/n4j/node.rb', line 19

def find_by_path(path)
  path.sub!(N4j.neo4j_url_prefix,'')
  result = N4j.batch([{:to => path, :method => 'GET'}])
  new(result.first['body'])      
end

#service_rootObject



25
26
27
# File 'lib/n4j/node.rb', line 25

def service_root
  find_by_node_id(0)
end