neography 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS +2 -1
- data/Gemfile.lock +14 -13
- data/lib/neography/rest.rb +7 -3
- data/lib/neography/version.rb +1 -1
- data/neography.gemspec +2 -2
- data/spec/integration/rest_batch_spec.rb +18 -0
- data/spec/integration/rest_index_spec.rb +23 -1
- metadata +8 -8
data/CONTRIBUTORS
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neography (0.0.
|
4
|
+
neography (0.0.30)
|
5
5
|
httparty (>= 0.8.1)
|
6
6
|
json
|
7
7
|
multi_json
|
8
8
|
os
|
9
|
-
rake
|
9
|
+
rake
|
10
10
|
rubyzip
|
11
11
|
|
12
12
|
GEM
|
@@ -16,21 +16,22 @@ GEM
|
|
16
16
|
httparty (0.8.3)
|
17
17
|
multi_json (~> 1.0)
|
18
18
|
multi_xml
|
19
|
-
json (1.7.
|
19
|
+
json (1.7.5)
|
20
|
+
json (1.7.5-java)
|
20
21
|
multi_json (1.3.6)
|
21
22
|
multi_xml (0.5.1)
|
22
23
|
net-http-spy (0.2.1)
|
23
24
|
os (0.9.6)
|
24
|
-
rake (0.
|
25
|
-
rspec (2.
|
26
|
-
rspec-core (~> 2.
|
27
|
-
rspec-expectations (~> 2.
|
28
|
-
rspec-mocks (~> 2.
|
29
|
-
rspec-core (2.
|
30
|
-
rspec-expectations (2.
|
25
|
+
rake (0.9.2.2)
|
26
|
+
rspec (2.11.0)
|
27
|
+
rspec-core (~> 2.11.0)
|
28
|
+
rspec-expectations (~> 2.11.0)
|
29
|
+
rspec-mocks (~> 2.11.0)
|
30
|
+
rspec-core (2.11.1)
|
31
|
+
rspec-expectations (2.11.3)
|
31
32
|
diff-lcs (~> 1.1.3)
|
32
|
-
rspec-mocks (2.
|
33
|
-
rubyzip (0.9.
|
33
|
+
rspec-mocks (2.11.2)
|
34
|
+
rubyzip (0.9.9)
|
34
35
|
|
35
36
|
PLATFORMS
|
36
37
|
java
|
@@ -39,5 +40,5 @@ PLATFORMS
|
|
39
40
|
DEPENDENCIES
|
40
41
|
neography!
|
41
42
|
net-http-spy (= 0.2.1)
|
42
|
-
rake
|
43
|
+
rake
|
43
44
|
rspec
|
data/lib/neography/rest.rb
CHANGED
@@ -314,7 +314,7 @@ module Neography
|
|
314
314
|
|
315
315
|
def find_node_index(*args)
|
316
316
|
case args.size
|
317
|
-
when 3 then index = get("/index/node/#{args[0]}/#{args[1]}?query
|
317
|
+
when 3 then index = get("/index/node/#{args[0]}/#{args[1]}?query=\"#{args[2]}\"") || Array.new
|
318
318
|
when 2 then index = get("/index/node/#{args[0]}?query=#{args[1]}") || Array.new
|
319
319
|
end
|
320
320
|
return nil if index.empty?
|
@@ -547,6 +547,12 @@ module Neography
|
|
547
547
|
when 4 then {:method => "DELETE", :to => "/index/node/#{args[1]}/#{args[2]}/#{get_id(args[3])}" }
|
548
548
|
when 3 then {:method => "DELETE", :to => "/index/node/#{args[1]}/#{get_id(args[2])}" }
|
549
549
|
end
|
550
|
+
when :remove_relationship_from_index
|
551
|
+
case args.size
|
552
|
+
when 5 then {:method => "DELETE", :to => "/index/relationship/#{args[1]}/#{args[2]}/#{args[3]}/#{get_id(args[4])}" }
|
553
|
+
when 4 then {:method => "DELETE", :to => "/index/relationship/#{args[1]}/#{args[2]}/#{get_id(args[3])}" }
|
554
|
+
when 3 then {:method => "DELETE", :to => "/index/relationship/#{args[1]}/#{get_id(args[2])}" }
|
555
|
+
end
|
550
556
|
when :delete_node
|
551
557
|
{:method => "DELETE", :to => "/node/#{get_id(args[1])}"}
|
552
558
|
else
|
@@ -583,8 +589,6 @@ module Neography
|
|
583
589
|
evaluate_response(HTTParty.get(configuration + URI.encode(path), merge_options(options)))
|
584
590
|
end
|
585
591
|
|
586
|
-
|
587
|
-
|
588
592
|
def post(path,options={})
|
589
593
|
evaluate_response(HTTParty.post(configuration + URI.encode(path), merge_options(options)))
|
590
594
|
end
|
data/lib/neography/version.rb
CHANGED
data/neography.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_development_dependency "rspec"
|
23
23
|
s.add_development_dependency "net-http-spy", "0.2.1"
|
24
|
-
s.add_development_dependency "rake"
|
24
|
+
s.add_development_dependency "rake"
|
25
25
|
s.add_dependency "httparty", ">= 0.8.1"
|
26
|
-
s.add_dependency "rake"
|
26
|
+
s.add_dependency "rake"
|
27
27
|
s.add_dependency "json"
|
28
28
|
s.add_dependency "os"
|
29
29
|
s.add_dependency "rubyzip"
|
@@ -310,6 +310,24 @@ describe Neography::Rest do
|
|
310
310
|
@neo.get_node_index(index, key, value3).should be_nil
|
311
311
|
end
|
312
312
|
|
313
|
+
it "can remove a relationship from an index in batch" do
|
314
|
+
index = generate_text(6)
|
315
|
+
key = generate_text(6)
|
316
|
+
value1 = generate_text
|
317
|
+
value2 = generate_text
|
318
|
+
|
319
|
+
node1 = @neo.create_node
|
320
|
+
node2 = @neo.create_node
|
321
|
+
relationship1 = @neo.create_unique_relationship(index, key, value1, "friends", node1, node2)
|
322
|
+
relationship2 = @neo.create_unique_relationship(index, key, value2, "friends", node2, node1)
|
323
|
+
|
324
|
+
batch_result = @neo.batch [:remove_relationship_from_index, index, key, relationship1],
|
325
|
+
[:remove_relationship_from_index, index, key, relationship2]
|
326
|
+
|
327
|
+
@neo.get_relationship_index(index, key, value1).should be_nil
|
328
|
+
@neo.get_relationship_index(index, key, value2).should be_nil
|
329
|
+
end
|
330
|
+
|
313
331
|
end
|
314
332
|
|
315
333
|
describe "referenced batch" do
|
@@ -224,6 +224,28 @@ describe Neography::Rest do
|
|
224
224
|
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
225
225
|
end
|
226
226
|
|
227
|
+
it "can find a node index with spaces in the value" do
|
228
|
+
new_node = @neo.create_node
|
229
|
+
key = generate_text(6)
|
230
|
+
value = generate_text + ' ' + generate_text
|
231
|
+
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
232
|
+
new_index = @neo.find_node_index("test_node_index", key, value)
|
233
|
+
new_index.should_not be_nil
|
234
|
+
new_index.first["self"].should == new_node["self"]
|
235
|
+
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
236
|
+
end
|
237
|
+
|
238
|
+
it "can find a node index with slashes in the value" do
|
239
|
+
new_node = @neo.create_node
|
240
|
+
key = generate_text(6)
|
241
|
+
value = generate_text + '/' + generate_text
|
242
|
+
@neo.add_node_to_index("test_node_index", key, value, new_node)
|
243
|
+
new_index = @neo.find_node_index("test_node_index", key, value)
|
244
|
+
new_index.should_not be_nil
|
245
|
+
new_index.first["self"].should == new_node["self"]
|
246
|
+
@neo.remove_node_from_index("test_node_index", key, value, new_node)
|
247
|
+
end
|
248
|
+
|
227
249
|
it "can get a relationship index" do
|
228
250
|
new_node1 = @neo.create_node
|
229
251
|
new_node2 = @neo.create_node
|
@@ -387,4 +409,4 @@ describe Neography::Rest do
|
|
387
409
|
|
388
410
|
end
|
389
411
|
|
390
|
-
end
|
412
|
+
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: 0.0.
|
4
|
+
version: 0.0.31
|
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
|
+
date: 2012-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -48,17 +48,17 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0
|
53
|
+
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: httparty
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0
|
85
|
+
version: '0'
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0
|
93
|
+
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: json
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|