neography 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neography (0.0.12)
4
+ neography (0.0.13)
5
5
  httparty (~> 0.7.3)
6
6
  json
7
7
 
@@ -11,10 +11,9 @@ GEM
11
11
  crack (0.1.8)
12
12
  diff-lcs (1.1.2)
13
13
  fakeweb (1.3.0)
14
- httparty (0.7.3)
14
+ httparty (0.7.4)
15
15
  crack (= 0.1.8)
16
16
  json (1.4.6)
17
- json (1.4.6-java)
18
17
  net-http-spy (0.2.1)
19
18
  rake (0.8.7)
20
19
  rspec (2.0.1)
data/lib/neography.rb CHANGED
@@ -34,6 +34,7 @@ require 'neography/relationship_traverser'
34
34
  require 'neography/node_traverser'
35
35
  require 'neography/path_traverser'
36
36
  require 'neography/equal'
37
+ require 'neography/index'
37
38
 
38
39
  require 'neography/node'
39
40
  require 'neography/relationship'
@@ -1,5 +1,9 @@
1
1
  module Neography
2
- module NodeIndex
2
+ module Index
3
+
4
+ def index
5
+
6
+ end
3
7
 
4
8
  def find
5
9
 
@@ -1,5 +1,6 @@
1
1
  module Neography
2
2
  class Node < PropertyContainer
3
+ include Neography::Index
3
4
  include Neography::NodeRelationship
4
5
  include Neography::NodePath
5
6
  include Neography::Equal
@@ -31,11 +31,20 @@ module Neography
31
31
  end
32
32
  end
33
33
 
34
- def initialize(hash=nil, neo_server=nil)
34
+ def initialize(hash=nil, server=nil)
35
35
  super(hash)
36
36
  @start_node = hash["start"].split('/').last
37
37
  @end_node = hash["end"].split('/').last
38
38
  @rel_type = hash["type"]
39
+ neo_server = server
40
+ end
41
+
42
+ def neo_server
43
+ @neo_server ||= self.start_node.neo_server
44
+ end
45
+
46
+ def neo_server=(server)
47
+ @neo_server = server
39
48
  end
40
49
 
41
50
  def del
@@ -21,8 +21,8 @@ module Neography
21
21
  def each
22
22
  iterator.each do |i|
23
23
  rel = Neography::Relationship.new(i, @node.neo_server)
24
- rel.start_node = Neography::Node.load(rel.start_node)
25
- rel.end_node = Neography::Node.load(rel.end_node)
24
+ rel.start_node = Neography::Node.load(rel.start_node, @node.neo_server)
25
+ rel.end_node = Neography::Node.load(rel.end_node, @node.neo_server)
26
26
 
27
27
  yield rel if match_to_other?(rel)
28
28
  end
@@ -311,19 +311,19 @@ module Neography
311
311
  options = { :body => {"order" => get_order(description["order"]),
312
312
  "uniqueness" => get_uniqueness(description["uniqueness"]),
313
313
  "relationships" => description["relationships"],
314
- "prune evaluator" => description["prune evaluator"],
315
- "return filter" => description["return filter"],
316
- "max depth" => get_depth(description["depth"]), }.to_json, :headers => {'Content-Type' => 'application/json'} }
314
+ "prune_evaluator" => description["prune evaluator"],
315
+ "return_filter" => description["return filter"],
316
+ "max_depth" => get_depth(description["depth"]), }.to_json, :headers => {'Content-Type' => 'application/json'} }
317
317
  traversal = post("/node/#{get_id(id)}/traverse/#{get_type(return_type)}", options) || Array.new
318
318
  end
319
319
 
320
320
  def get_path(from, to, relationships, depth=1, algorithm="shortestPath")
321
- options = { :body => {"to" => self.configuration + "/node/#{get_id(to)}", "relationships" => relationships, "max depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
321
+ options = { :body => {"to" => self.configuration + "/node/#{get_id(to)}", "relationships" => relationships, "max_depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
322
322
  path = post("/node/#{get_id(from)}/path", options) || Hash.new
323
323
  end
324
324
 
325
325
  def get_paths(from, to, relationships, depth=1, algorithm="allPaths")
326
- options = { :body => {"to" => self.configuration + "/node/#{get_id(to)}", "relationships" => relationships, "max depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
326
+ options = { :body => {"to" => self.configuration + "/node/#{get_id(to)}", "relationships" => relationships, "max_depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
327
327
  paths = post("/node/#{get_id(from)}/paths", options) || Array.new
328
328
  end
329
329
 
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -19,7 +19,7 @@ describe Neography::Relationship do
19
19
  rel[:since].should == 1998
20
20
  rel[:colour].should == 'blue'
21
21
  rel.since.should == 1998
22
- rel.colourshould == 'blue'
22
+ rel.colour.should == 'blue'
23
23
  end
24
24
 
25
25
  it "#outgoing(:friends).create(other) creates a new relationship between self and other node" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: neography
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.13
5
+ version: 0.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Max De Marzi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-15 00:00:00 -07:00
13
+ date: 2011-07-24 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -104,9 +104,9 @@ files:
104
104
  - lib/neography.rb
105
105
  - lib/neography/config.rb
106
106
  - lib/neography/equal.rb
107
+ - lib/neography/index.rb
107
108
  - lib/neography/neography.rb
108
109
  - lib/neography/node.rb
109
- - lib/neography/node_index.rb
110
110
  - lib/neography/node_path.rb
111
111
  - lib/neography/node_relationship.rb
112
112
  - lib/neography/node_traverser.rb