Skip to content

Commit

Permalink
Fails to create a duplicate unique node
Browse files Browse the repository at this point in the history
  • Loading branch information
pwaleczek committed Apr 7, 2014
1 parent 6829cfd commit 08f69b0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/neography/rest/node_indexes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Neography
class Rest
module NodeIndexes
module NodeIndexes
include Neography::Rest::Helpers

def list_node_indexes
Expand Down Expand Up @@ -117,9 +117,25 @@ def get_or_create_unique_node(index, key, value, properties = {})
:headers => json_content_type
}
@connection.post("/index/node/%{index}?uniqueness=%{function}" % {:index => index, :function => 'get_or_create'}, options)

end

def create_or_fail_unique_node(index, key, value, properties = {})
options = {
:body => (
{ :properties => properties,
:key => key,
:value => value
}
).to_json,
:headers => json_content_type
}
@connection.post("/index/node/%{index}?uniqueness=%{function}" % {:index => index, :function => 'create_or_fail'}, options)

end

end

end
end
end

0 comments on commit 08f69b0

Please sign in to comment.