A multi-layer REST API Ruby wrapper for the Neo4j graph database built on top of Faraday.
- Layer 1 interacts with the Neo4j REST API raw requests
- Layer 2 binds the raw HTTP requests into Ruby Objects
- Layer 3 implements ActiveModel and treats Nodes and Relationships as Ruby Objects
Oracle: Our time is up. Listen to me, Neo.
You can save Zion if you reach The Source,
but to do that you will need the Keymaker.
Neo: The Keymaker?
Install and start the Neo4j server:
rakeneo4j:installrakeneo4j:start# optionally for testingrakeneo4j:installRAILS_ENV=testrakeneo4j:startRAILS_ENV=testAdd this line to your application's Gemfile:
gem"keymaker"And then execute:
$ bundle
Create a config/neo4j.yml file:
development:
server: localhostport: 7474test:
server: localhostport: 7475Then, create a Rails initializer config/initializers/keymaker.rb:
ifRails.env.development? || Rails.env.test?database_config=YAML::load_file("config/neo4j.yml")Keymaker.configuredo |c|
c.server=database_config["#{Rails.env}"]["server"]c.port=database_config["#{Rails.env}"]["port"]endelse# Heroku neo4j add-onKeymaker.configuredo |c|
c.server=ENV["NEO4J_HOST"]c.port=ENV["NEO4J_PORT"]c.username=ENV["NEO4J_LOGIN"]c.password=ENV["NEO4J_PASSWORD"]endendKeymaker.configuredo |c|
c.server="localhost"c.port=7474end## Create a node ##terminator_response=Keymaker.service.create_node_request({:name=>"Terminator",:catch_phrase=>"I'll be back"})terminator=Keymaker.service.get_node(terminator_response.neo4j_id)john_response=Keymaker.service.create_node_request({:name=>"John Connor",:catch_phrase=>"No problemo"})john_connor=Keymaker.service.get_node(john_response.neo4j_id)john_connor.name# => "John Connor"john_connor.catch_phrase# => "No problemo"## Update node properties ##Keymaker.service.update_node_properties_request({:node_id=>john_connor.neo4j_id,:catch_phrase=>"Easy money!"})john_connor.catch_phrase# => "Easy money!"## Delete a node ##Keymaker.service.delete_node_request({:node_id=>john_connor.neo4j_id})Keymaker.service.get_node_request({:node_id=>john_connor.neo4j_id})# => Keymaker::ResourceNotFound raised## Create a relationship ##rel=Keymaker.service.create_relationship_request({:node_id=>john_connor.neo4j_id,:end_node_id=>terminator.neo4j_id,:rel_type=>"knows",:data=>{:since=>"Summer of 1984"})## Delete a relationship ##Keymaker.service.delete_relationship_request(:relationship_id=>rel.neo4j_id)Coming soon
Coming soon
Coming soon
Coming soon
- Fork it
- Create a feature branch (
git checkout -b my_new_feature) - Write passing tests!
- Commit your changes (
git commit -v) - Push to the branch (
git push origin my_new_feature) - Create new Pull Request
- Test coverage
- Contributing documentation (installing neo4j, etc).
- Documentation
- Avdi Grimm
- Micah Cooper
- Stephen Caudill
- Travis Anderson
Copyright (c) 2012 Rogelio J. Samour See LICENSE for details.

