Module: N4j::Node::ClassMethods

Defined in:
lib/n4j/node.rb

Overview

include N4j::Entity

Instance Method Summary collapse

Instance Method Details

#find(n) ⇒ Object



13
14
15
# File 'lib/n4j/node.rb', line 13

def find(n)
  find_by_node_id(n)
end

#find_by_node_id(n) ⇒ Object



17
18
19
# File 'lib/n4j/node.rb', line 17

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

#find_by_path(path) ⇒ Object



21
22
23
24
25
# File 'lib/n4j/node.rb', line 21

def find_by_path(path)
  path.sub!(/\Ahttp.+?\/db\/data/,'')
  result = N4j.batch([{:to => path, :method => 'GET'}])
  new(result.first['body'])
end

#service_rootObject



27
28
29
# File 'lib/n4j/node.rb', line 27

def service_root
  find_by_node_id(0)
end