neography 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -122,6 +122,7 @@ module Neography
122
122
  when /NoSuchPropertyException/ ; raise NoSuchPropertyException.new(message, code, stacktrace)
123
123
  when /RelationshipNotFoundException/ ; raise RelationshipNotFoundException.new(message, code, stacktrace)
124
124
  when /NotFoundException/ ; raise NotFoundException.new(message, code, stacktrace)
125
+ when /UniquePathNotUniqueException/ ; raise UniquePathNotUniqueException.new(message, code, stacktrace)
125
126
  else
126
127
  raise NeographyError.new(message, code, stacktrace)
127
128
  end
@@ -39,4 +39,7 @@ module Neography
39
39
  # A path could not be found by node traversal
40
40
  class NotFoundException < NeographyError; end
41
41
 
42
+ # Thrown when CREATE UNIQUE matches multiple paths.
43
+ class UniquePathNotUniqueException < NeographyError; end
44
+
42
45
  end
@@ -20,6 +20,7 @@ require 'neography/rest/relationship_indexes'
20
20
  require 'neography/rest/relationship_auto_indexes'
21
21
  require 'neography/rest/cypher'
22
22
  require 'neography/rest/gremlin'
23
+ require 'neography/rest/extensions'
23
24
  require 'neography/rest/batch'
24
25
  require 'neography/rest/clean'
25
26
 
@@ -56,6 +57,7 @@ module Neography
56
57
 
57
58
  @cypher = Cypher.new(@connection)
58
59
  @gremlin = Gremlin.new(@connection)
60
+ @extensions = Extensions.new(@connection)
59
61
  @batch = Batch.new(@connection)
60
62
  @clean = Clean.new(@connection)
61
63
  end
@@ -334,6 +336,16 @@ module Neography
334
336
  @gremlin.execute(script, params)
335
337
  end
336
338
 
339
+ # unmanaged extensions
340
+
341
+ def post_extension(path, params = {})
342
+ @extensions.post(path, params)
343
+ end
344
+
345
+ def get_extension(path)
346
+ @extensions.get(path)
347
+ end
348
+
337
349
  # batch
338
350
 
339
351
  def batch(*args)
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -64,12 +64,12 @@ describe Neography::Rest do
64
64
 
65
65
  it "can delete everything but start node" do
66
66
  @neo.execute_query("START n=node(*) MATCH n-[r?]-() WHERE ID(n) <> 0 DELETE n,r")
67
- expect {
67
+ expect {
68
68
  @neo.execute_query("start n=node({id}) return n", {:id => 1})
69
69
  }.to raise_error(Neography::BadInputException)
70
70
  root_node = @neo.execute_query("start n=node({id}) return n", {:id => 0})
71
71
  root_node.should_not be_nil
72
- end
72
+ end
73
73
 
74
74
  it "throws an error for an invalid query" do
75
75
  expect {
@@ -77,6 +77,22 @@ describe Neography::Rest do
77
77
  }.to raise_error(Neography::SyntaxException)
78
78
  end
79
79
 
80
+ it "throws an error for not unique paths in unique path creation" do
81
+ node1 = @neo.create_node
82
+ node2 = @neo.create_node
83
+
84
+ id1 = node1["self"].split('/').last.to_i
85
+ id2 = node2["self"].split('/').last.to_i
86
+
87
+ # create two 'FOO' relationships
88
+ @neo.execute_query("START a=node({id1}), b=node({id2}) CREATE a-[r:FOO]->b RETURN r", { :id1 => id1, :id2 => id2 })
89
+ @neo.execute_query("START a=node({id1}), b=node({id2}) CREATE a-[r:FOO]->b RETURN r", { :id1 => id1, :id2 => id2 })
90
+
91
+ expect {
92
+ @neo.execute_query("START a=node({id1}), b=node({id2}) CREATE UNIQUE a-[r:FOO]->b RETURN r", { :id1 => id1, :id2 => id2 })
93
+ }.to raise_error(Neography::UniquePathNotUniqueException)
94
+ end
95
+
80
96
  end
81
97
 
82
98
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neography
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec