Class: NeoRest::Index
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- NeoRest::Index
- Defined in:
- lib/NeoRest/index.rb
Instance Attribute Summary collapse
-
#index_name ⇒ Object
readonly
Returns the value of attribute index_name.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #get_nodes ⇒ Object
-
#initialize(index_name, key, value) ⇒ Index
constructor
A new instance of Index.
- #remove(node) ⇒ Object
Constructor Details
#initialize(index_name, key, value) ⇒ Index
Returns a new instance of Index.
12 13 14 15 16 |
# File 'lib/NeoRest/index.rb', line 12 def initialize( index_name, key, value ) @index_name = index_name @key = key @value = value end |
Instance Attribute Details
#index_name ⇒ Object (readonly)
Returns the value of attribute index_name.
10 11 12 |
# File 'lib/NeoRest/index.rb', line 10 def index_name @index_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/NeoRest/index.rb', line 10 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/NeoRest/index.rb', line 10 def value @value end |
Class Method Details
.get_nodes(index_name, key, value) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/NeoRest/index.rb', line 29 def get_nodes index_name, key, value nodes_json = JSON.parse( RestClient.get( "#{$neo_base_url}/index/node/#{index_name}/#{key}/#{URI.escape(value)}", :accept => :json ) ) nodes = [] nodes_json.each { | node | nodes << NeoRest::Node.new( node ) } return nodes unless block_given? nodes.each { | node | yield node } end |
Instance Method Details
#get_nodes ⇒ Object
23 24 25 |
# File 'lib/NeoRest/index.rb', line 23 def get_nodes NeoRest::Index.get_nodes index_name, key, value end |
#remove(node) ⇒ Object
18 19 20 21 |
# File 'lib/NeoRest/index.rb', line 18 def remove node node = node.neo_id if node.respond_to?('neo_id') RestClient.delete( "#{$neo_base_url}/index/node/#{index_name}/#{key}/#{URI.escape(value)}/#{node}" ) end |