Accessing Neo4j from Ruby using the REST Bindings

In this recipe, we will learn how to access the Neo4j graph database server from Ruby using the REST bindings.

Getting ready

The Neo4j REST server can be accessed using an excellent neography gem module, which claims to be a thin wrapper over the Neo4j REST API interface.

The following steps will get you started with neography gem:

  1. The neography gem modules can be installed on the machine using the gem install command:
    gem install 'neography'
    
  2. The neography module also requires the gem module in the Ruby code, so configure and initialize the neography gem modules with the following code:
    @graph = Neography::Rest.new({ :protocol   => 'http://',
                                   :server     => IP_ADDRESS,
                                   :port       => PORT,
    })

How to do it...

Follow ...

Get Neo4j Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.