Skip to content

Commit 611af01

Browse files
committed
forgot to add the new db path to some delete actions, splitting test file
1 parent e01369f commit 611af01

File tree

8 files changed

+378
-550
lines changed

8 files changed

+378
-550
lines changed

lib/neography/rest.rb

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
module Neography
22
class Rest
33
include HTTParty
4-
base_uri 'http://localhost:9999'
4+
base_uri Neography::Config.to_s
55
format :json
66

77
class << self
88

99
def get_root
10-
rescue_ij { get('/') }
10+
rescue_ij { get('/db/data/') }
1111
end
1212

1313
def create_node(*args)
1414
if args[0].respond_to?(:each_pair) && args[0]
1515
options = { :body => args[0].to_json, :headers => {'Content-Type' => 'application/json'} }
16-
rescue_ij { post("/node", options) }
16+
rescue_ij { post("/db/data/node", options) }
1717
else
18-
rescue_ij { post("/node") }
18+
rescue_ij { post("/db/data/node") }
1919
end
2020
end
2121

2222
def get_node(id)
23-
rescue_ij { get("/node/#{id}") }
23+
rescue_ij { get("/db/data/node/#{id}") }
2424
end
2525

2626
def reset_node_properties(id, properties)
2727
options = { :body => properties.to_json, :headers => {'Content-Type' => 'application/json'} }
28-
rescue_ij { put("/node/#{id}/properties", options) }
28+
rescue_ij { put("/db/data/node/#{id}/properties", options) }
2929
end
3030

3131
def get_node_properties(id, properties = nil)
3232
if properties.nil?
33-
rescue_ij { get("/node/#{id}/properties") }
33+
rescue_ij { get("/db/data/node/#{id}/properties") }
3434
else
3535
node_properties = Hash.new
3636
properties.to_a.each do |property|
37-
value = rescue_ij { get("/node/#{id}/properties/#{property}") }
37+
value = rescue_ij { get("/db/data/node/#{id}/properties/#{property}") }
3838
node_properties[property] = value unless value.nil?
3939
end
4040
return nil if node_properties.empty?
@@ -44,42 +44,42 @@ def get_node_properties(id, properties = nil)
4444

4545
def remove_node_properties(id, properties = nil)
4646
if properties.nil?
47-
rescue_ij { delete("/node/#{id}/properties") }
47+
rescue_ij { delete("/db/data/node/#{id}/properties") }
4848
else
4949
properties.to_a.each do |property|
50-
rescue_ij { delete("/node/#{id}/properties/#{property}") }
50+
rescue_ij { delete("/db/data/node/#{id}/properties/#{property}") }
5151
end
5252
end
5353
end
5454

5555
def set_node_properties(id, properties)
5656
properties.each do |key, value|
5757
options = { :body => value.to_json, :headers => {'Content-Type' => 'application/json'} }
58-
rescue_ij { put("/node/#{id}/properties/#{key}", options) }
58+
rescue_ij { put("/db/data/node/#{id}/properties/#{key}", options) }
5959
end
6060
end
6161

6262
def delete_node(id)
63-
rescue_ij { delete("/node/#{id}") }
63+
rescue_ij { delete("/db/data/node/#{id}") }
6464
end
6565

6666
def create_relationship(type, from, to, props = nil)
6767
options = { :body => {:to => Neography::Config.to_s + "/node/#{to}", :data => props, :type => type }.to_json, :headers => {'Content-Type' => 'application/json'} }
68-
rescue_ij { post("/node/#{from}/relationships", options) }
68+
rescue_ij { post("/db/data/node/#{from}/relationships", options) }
6969
end
7070

7171
def reset_relationship_properties(id, properties)
7272
options = { :body => properties.to_json, :headers => {'Content-Type' => 'application/json'} }
73-
rescue_ij { put("/relationship/#{id}/properties", options) }
73+
rescue_ij { put("/db/data/relationship/#{id}/properties", options) }
7474
end
7575

7676
def get_relationship_properties(id, properties = nil)
7777
if properties.nil?
78-
rescue_ij { get("/relationship/#{id}/properties") }
78+
rescue_ij { get("/db/data/relationship/#{id}/properties") }
7979
else
8080
relationship_properties = Hash.new
8181
properties.to_a.each do |property|
82-
value = rescue_ij { get("/relationship/#{id}/properties/#{property}") }
82+
value = rescue_ij { get("/db/data/relationship/#{id}/properties/#{property}") }
8383
relationship_properties[property] = value unless value.nil?
8484
end
8585
return nil if relationship_properties.empty?
@@ -89,32 +89,32 @@ def get_relationship_properties(id, properties = nil)
8989

9090
def remove_relationship_properties(id, properties = nil)
9191
if properties.nil?
92-
rescue_ij { delete("/relationship/#{id}/properties") }
92+
rescue_ij { delete("/db/data/relationship/#{id}/properties") }
9393
else
9494
properties.to_a.each do |property|
95-
rescue_ij { delete("/relationship/#{id}/properties/#{property}") }
95+
rescue_ij { delete("/db/data/relationship/#{id}/properties/#{property}") }
9696
end
9797
end
9898
end
9999

100100
def set_relationship_properties(id, properties)
101101
properties.each do |key, value|
102102
options = { :body => value.to_json, :headers => {'Content-Type' => 'application/json'} }
103-
rescue_ij { put("/relationship/#{id}/properties/#{key}", options) }
103+
rescue_ij { put("/db/data/relationship/#{id}/properties/#{key}", options) }
104104
end
105105
end
106106

107107
def delete_relationship(id)
108-
rescue_ij { delete("/relationship/#{id}") }
108+
rescue_ij { delete("/db/data/relationship/#{id}") }
109109
end
110110

111111
def get_node_relationships(id, dir=nil, types=nil)
112112
dir = get_dir(dir)
113113

114114
if types.nil?
115-
node_relationships = rescue_ij { get("/node/#{id}/relationships/#{dir}") } || Array.new
115+
node_relationships = rescue_ij { get("/db/data/node/#{id}/relationships/#{dir}") } || Array.new
116116
else
117-
node_relationships = rescue_ij { get("/node/#{id}/relationships/#{dir}/#{types.to_a.join('&')}") } || Array.new
117+
node_relationships = rescue_ij { get("/db/data/node/#{id}/relationships/#{dir}/#{types.to_a.join('&')}") } || Array.new
118118
end
119119
return nil if node_relationships.empty?
120120
node_relationships
@@ -123,36 +123,36 @@ def get_node_relationships(id, dir=nil, types=nil)
123123
def delete_node!(id)
124124
relationships = get_node_relationships(id)
125125
relationships.each { |r| delete_relationship(r["self"].split('/').last) } unless relationships.nil?
126-
rescue_ij { delete("/node/#{id}") }
126+
rescue_ij { delete("/db/data/node/#{id}") }
127127
end
128128

129129
def list_indexes
130-
rescue_ij { get("/index") }
130+
rescue_ij { get("/db/data/index") }
131131
end
132132

133133
def add_to_index(key, value, id)
134134
options = { :body => (Neography::Config.to_s + "/node/#{id}").to_json, :headers => {'Content-Type' => 'application/json'} }
135-
rescue_ij { post("/index/node/#{key}/#{value}", options) }
135+
rescue_ij { post("/db/data/index/node/#{key}/#{value}", options) }
136136
end
137137

138138
def remove_from_index(key, value, id)
139-
rescue_ij { delete("/index/node/#{key}/#{value}/#{id}") }
139+
rescue_ij { delete("/db/data/index/node/#{key}/#{value}/#{id}") }
140140
end
141141

142142
def get_index(key, value)
143-
index = rescue_ij { get("/index/node/#{key}/#{value}") } || Array.new
143+
index = rescue_ij { get("/db/data/index/node/#{key}/#{value}") } || Array.new
144144
return nil if index.empty?
145145
index
146146
end
147147

148148
def get_path(from, to, relationships, depth=1, algorithm="allPaths")
149149
options = { :body => {"to" => Neography::Config.to_s + "/node/#{to}", "relationships" => relationships, "max depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
150-
path = rescue_ij { post("/node/#{from}/path", options) } || Hash.new
150+
path = rescue_ij { post("/db/data/node/#{from}/path", options) } || Hash.new
151151
end
152152

153153
def get_paths(from, to, relationships, depth=1, algorithm="allPaths")
154154
options = { :body => {"to" => Neography::Config.to_s + "/node/#{to}", "relationships" => relationships, "max depth" => depth, "algorithm" => get_algorithm(algorithm) }.to_json, :headers => {'Content-Type' => 'application/json'} }
155-
paths = rescue_ij { post("/node/#{from}/paths", options) } || Array.new
155+
paths = rescue_ij { post("/db/data/node/#{from}/paths", options) } || Array.new
156156
end
157157

158158
private

spec/integration/node_spec.rb

Lines changed: 0 additions & 120 deletions
This file was deleted.

spec/integration/relationship_spec.rb

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)