maxdemarzi/neography — pull request #105 by sosiouxme (2013-08-11 19:08:09+00:00)
Title: Accept node hashes in label hashes

Currently, adding labels as you would expect to against Neo4J 2 is broken:

neo = Neography::Rest.new
node = neo.create_node({})
neo.add_label(node, "Person")
# => Neography::NeographyError: Neography::NeographyError
from /home/luke/.gem/gems/neography-1.1.1/lib/neography/connection.rb:195:in `raise_errors'
from /home/luke/.gem/gems/neography-1.1.1/lib/neography/connection.rb:171:in `handle_4xx_500_response'

I.e. nondescript error. Looking in the neography log is slightly helpful...

Error 405 Method Not Allowed
HTTP ERROR 405
Problem accessing /db/data/node/%7B%22extensions%22=%3E%7B%7D,%20%22labels%22=%3E%22[...]

Unlike most Neography methods, add_label and the like don't convert whatever they get to a node ID using get_id(). So, whatever you pass in gets sent off directly in the REST request... a bit surprising.

Modified logic and tests supplied.