Skip to content

Commit

Permalink
Merge pull request #132 from tunespeak/master
Browse files Browse the repository at this point in the history
add support for add_label to batch
  • Loading branch information
maxdemarzi committed Dec 27, 2013
2 parents 6f39b74 + 83be1f9 commit 62a08d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/neography/rest/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ def reset_node_properties(id, body)
end
end

# NodeLabel

def add_label(id, body)
post build_node_uri(id) + "/labels" do
body
end
end

# NodeRelationships

def get_node_relationships(id, direction = nil, types = nil)
Expand Down
10 changes: 10 additions & 0 deletions spec/unit/rest/batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ class Rest
[:reset_node_properties, "index2", { "key2" => "value2" } ]
end

it "adds a node label" do
expected_body = [
{ "id" => 0, "method" => "POST", "to" => "{0}/labels", "body" => "foo" },
{ "id" => 1, "method" => "POST", "to" => "{0}/labels", "body" => "bar" },
]
connection.should_receive(:post).with("/batch", json_match(:body, expected_body))
subject.execute [:add_label, "{0}", "foo"],
[:add_label, "{0}", "bar"]
end

it "gets node relationships" do
expected_body = [
{ "id" => 0, "method" => "GET", "to" => "/node/id1/relationships/direction1" },
Expand Down

0 comments on commit 62a08d4

Please sign in to comment.