Skip to content

Commit

Permalink
added create_or_fail to relationship indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
pwaleczek committed Apr 14, 2014
1 parent 37b7588 commit aab503a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/neography/rest/relationship_indexes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Neography
class Rest
module RelationshipIndexes
module RelationshipIndexes
include Neography::Rest::Helpers

def list_relationship_indexes
Expand Down Expand Up @@ -118,7 +118,21 @@ def get_or_create_unique_relationship(index, key, value, properties = {})
:headers => json_content_type
}
@connection.post("/index/relationship/%{index}?uniqueness=%{function}" % {:index => index, :function => 'get_or_create'}, options)


end

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

end

end
Expand Down

0 comments on commit aab503a

Please sign in to comment.