diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6ca06d4..6ee8b02 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,4 +3,5 @@ Maintainer: Contributors: * Peter Neubauer -* Ian Dees \ No newline at end of file +* Ian Dees +* Phuong CAO \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 6f747a7..56be38f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - neography (0.0.11) + neography (0.0.12) httparty (~> 0.7.3) json diff --git a/lib/neography/rest.rb b/lib/neography/rest.rb index 2028983..2330ed0 100644 --- a/lib/neography/rest.rb +++ b/lib/neography/rest.rb @@ -373,6 +373,8 @@ def delete(path,options={}) def get_id(id) case id + when Array + get_id(id.first) when Hash id["self"].split('/').last when String diff --git a/spec/integration/rest_index_spec.rb b/spec/integration/rest_index_spec.rb index 8c07fc5..bc773ca 100644 --- a/spec/integration/rest_index_spec.rb +++ b/spec/integration/rest_index_spec.rb @@ -250,6 +250,25 @@ @neo.remove_relationship_from_index("test_index", key, value, new_relationship) end + it "can find use the results of a node index" do + new_node1 = @neo.create_node + new_node2 = @neo.create_node + key = generate_text(6) + value1 = generate_text + value2 = generate_text + @neo.add_node_to_index("test_index", key, value1, new_node1) + @neo.add_node_to_index("test_index", key, value2, new_node2) + existing_node1 = @neo.get_node_index("test_index", key, value1) + existing_node2 = @neo.get_node_index("test_index", key, value2) + new_relationship = @neo.create_relationship("friends", existing_node1, existing_node2) + new_relationship["start"].should_not be_nil + new_relationship["start"].should == new_node1["self"] + new_relationship["end"].should_not be_nil + new_relationship["end"].should == new_node2["self"] + @neo.remove_node_from_index("test_index", new_node1) + @neo.remove_node_from_index("test_index", new_node2) + end + end