Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Nov 19, 2010
1 parent 93e4fbd commit e01369f
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 256 deletions.
6 changes: 3 additions & 3 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
== Welcome to Neography

Neography is a thin ruby wrapper to the Neo4j Rest API, for more information:
* {Getting Started with REST for Neo4j}[http://wiki.neo4j.org/content/Getting_Started_REST]
* {Getting Started with Neo4j Server}[http://wiki.neo4j.org/content/Getting_Started_with_Neo4j_Server]
* {Neo4j Rest API Reference}[http://components.neo4j.org/neo4j-rest/]


Expand All @@ -16,7 +16,7 @@ Neography is a thin ruby wrapper to the Neo4j Rest API, for more information:
Neography::Config.use do |config|
config[:protocol] = 'http://'
config[:server] = 'localhost'
config[:port] = '9999'
config[:port] = '7474'
end

==== Rails
Expand Down Expand Up @@ -66,7 +66,7 @@ A thin ruby wrapper Neography::Rest which tries to mirror the Neo4j Rest API and
Neography::Rest.remove_from_index(key, value, id) # removes a node to an index with the given key/value pair
Neography::Rest.get_index(key, value) # gets an index with the given key/value pair

... and a work in progress more rubyish layer that's not quite ready for use yet.
... and a work in progress more rubyish layer is in the works.

Neography::Node.new # Create an empty node
Neography::Node.new(:age => 31, :name => "Max") # Create a node with some properties
Expand Down
28 changes: 0 additions & 28 deletions lib/neography.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,11 @@ def find_and_require_user_defined_code
end
end

def evaluate_response(response)
logger = Logger.new('log/neography.log')

code = response.code
body = response.body

case code
when 200
logger.debug "OK"
when 201
logger.debug "OK, created"
when 204
logger.debug "OK, no content returned"
when 400
logger.error "Invalid data sent"
when 404
logger.error "#{body}"
end

end

require 'httparty'
require 'json'
require 'logger'
#require 'net-http-spy'

#Net::HTTP.http_logger_options = {:verbose => true}
#Net::HTTP.http_logger_options = {:body => true}

require 'neography/config'
require 'neography/rest'
require 'neography/neo'
require 'neography/node'
require 'neography/relationship'

find_and_require_user_defined_code
4 changes: 2 additions & 2 deletions lib/neography/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Neography
# ==== Default Configurations
# <tt>:protocol</tt>:: default <tt>http://</tt> protocol to use (can be https://)
# <tt>:server</tt>:: default <tt>localhost</tt> where the database is stored on the network
# <tt>:port</tt>:: default <tt>9999</tt> what port is listening
# <tt>:port</tt>:: default <tt>7474</tt> what port is listening
#
class Config
# This code is copied from merb-core/config.rb.
Expand All @@ -22,7 +22,7 @@ def defaults
@defaults ||= {
:protocol => 'http://',
:server => 'localhost',
:port => '9999'
:port => '7474'
}
end

Expand Down
12 changes: 0 additions & 12 deletions lib/neography/neo.rb

This file was deleted.

129 changes: 0 additions & 129 deletions lib/neography/node.rb

This file was deleted.

73 changes: 0 additions & 73 deletions lib/neography/relationship.rb

This file was deleted.

4 changes: 2 additions & 2 deletions neography.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Gem::Specification.new do |s|
s.authors = "Max De Marzi"
s.email = "[email protected]"
s.homepage = "http://rubygems.org/gems/neography"
s.summary = "ruby wrapper to Neo4j Rest Interface"
s.description = "A Ruby wrapper to the Neo4j Rest Client Interface see http://components.neo4j.org/neo4j-rest/ for more details."
s.summary = "ruby wrapper to Neo4j Rest API"
s.description = "A Ruby wrapper to the Neo4j Rest API see http://components.neo4j.org/neo4j-rest/ for more details."

s.rubyforge_project = "neography"

Expand Down
14 changes: 11 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@

FakeWeb.allow_net_connect = false

#To test against a real database:
#1. Make sure empty database is running (./bin/neo4j-rest start)
#2. Uncomment the next two lines
# To test against a real database:
# 1. Make sure empty database is running on your test neo4j server (bin/neo4j start)
# 2. Uncomment the next two lines
FakeWeb.clean_registry
FakeWeb.allow_net_connect = true

# 3. If you want to see more, uncomment the next few lines
# require 'net-http-spy'
# Net::HTTP.http_logger_options = {:body => true} # just the body
# Net::HTTP.http_logger_options = {:verbose => true} # see everything




def generate_text(length=8)
chars = 'abcdefghjkmnpqrstuvwxyz'
key = ''
Expand Down
8 changes: 4 additions & 4 deletions spec/support/fake_root_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FakeWeb.register_uri(:get, "http://localhost:9999/", :body => '{
"index" : "http://localhost:9999/index",
"node" : "http://localhost:9999/node",
"reference_node" : "http://localhost:9999/node/0"
FakeWeb.register_uri(:get, "http://localhost:7474/", :body => '{
"index" : "http://localhost:7474/index",
"node" : "http://localhost:7474/node",
"reference_node" : "http://localhost:7474/node/0"
}')

0 comments on commit e01369f

Please sign in to comment.