arangorb 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +18 -18
- data/Gemfile +8 -7
- data/LICENSE +21 -21
- data/README.md +906 -867
- data/lib/ArangoRB_AQL.rb +181 -160
- data/lib/ArangoRB_Cache.rb +174 -174
- data/lib/ArangoRB_Col.rb +526 -499
- data/lib/ArangoRB_DB.rb +363 -339
- data/lib/ArangoRB_Doc.rb +319 -298
- data/lib/ArangoRB_Edg.rb +184 -169
- data/lib/ArangoRB_Gra.rb +201 -180
- data/lib/ArangoRB_Index.rb +135 -115
- data/lib/ArangoRB_Replication.rb +261 -0
- data/lib/ArangoRB_Ser.rb +446 -441
- data/lib/ArangoRB_Task.rb +129 -113
- data/lib/ArangoRB_Tra.rb +169 -142
- data/lib/ArangoRB_Tran.rb +68 -53
- data/lib/ArangoRB_User.rb +149 -136
- data/lib/ArangoRB_Ver.rb +162 -147
- data/lib/arangorb.rb +16 -15
- data/spec/arangoRB_helper.rb +4 -4
- data/spec/arangoRestart_helper.rb +14 -14
- data/spec/lib/0.1.0/arangoAQL_helper.rb +64 -64
- data/spec/lib/0.1.0/arangoC_helper.rb +170 -170
- data/spec/lib/0.1.0/arangoDB_helper.rb +119 -119
- data/spec/lib/0.1.0/arangoDoc_helper.rb +79 -79
- data/spec/lib/0.1.0/arangoE_helper.rb +50 -50
- data/spec/lib/0.1.0/arangoG_helper.rb +78 -78
- data/spec/lib/0.1.0/arangoS_helper.rb +37 -37
- data/spec/lib/0.1.0/arangoT_helper.rb +48 -48
- data/spec/lib/0.1.0/arangoV_helper.rb +65 -65
- data/spec/lib/1.0.0/arangoC_helper.rb +73 -73
- data/spec/lib/1.0.0/arangoDB_helper.rb +48 -48
- data/spec/lib/1.0.0/arangoI_helper.rb +43 -43
- data/spec/lib/1.0.0/arangoS_helper.rb +192 -192
- data/spec/lib/1.0.0/arangoTa_helper.rb +49 -49
- data/spec/lib/1.0.0/arangoTr_helper.rb +15 -15
- data/spec/lib/1.0.0/arangoU_helper.rb +72 -72
- data/spec/lib/1.1.0/arangoRB_helper.rb +144 -144
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +19 -19
- data/spec/lib/1.2.0/arangoCache_helper.rb +66 -66
- data/spec/lib/1.3.0/arangoHash_helper.rb +30 -0
- data/spec/lib/arangoRB_0.1.0_helper.rb +9 -9
- data/spec/lib/arangoRB_1.0.0_helper.rb +6 -6
- data/spec/lib/arangoRB_1.1.0_helper.rb +2 -2
- data/spec/lib/arangoRB_1.2.0_helper.rb +2 -1
- data/spec/spec_helper.rb +41 -41
- metadata +6 -5
data/lib/ArangoRB_Task.rb
CHANGED
@@ -1,113 +1,129 @@
|
|
1
|
-
# === AQL ===
|
2
|
-
|
3
|
-
class ArangoTask < ArangoServer
|
4
|
-
def initialize(database: @@database, id: nil, name: nil, type: nil, period: nil, command: nil, params: {}, created: nil) # TESTED
|
5
|
-
if database.is_a?(String)
|
6
|
-
@database = database
|
7
|
-
elsif database.is_a?(ArangoDatabase)
|
8
|
-
@database = database.database
|
9
|
-
else
|
10
|
-
raise "database should be a String or an ArangoDatabase instance, not a #{database.class}"
|
11
|
-
end
|
12
|
-
@id = id
|
13
|
-
@name = name
|
14
|
-
@type = type
|
15
|
-
@period = period
|
16
|
-
@command = command
|
17
|
-
@params = params
|
18
|
-
@created = created
|
19
|
-
@idCache = "IND_#{@id}"
|
20
|
-
end
|
21
|
-
|
22
|
-
attr_reader :id, :name, :type, :period, :created, :command, :params, :idCache
|
23
|
-
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
if
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
result
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
1
|
+
# === AQL ===
|
2
|
+
|
3
|
+
class ArangoTask < ArangoServer
|
4
|
+
def initialize(database: @@database, id: nil, name: nil, type: nil, period: nil, command: nil, params: {}, created: nil) # TESTED
|
5
|
+
if database.is_a?(String)
|
6
|
+
@database = database
|
7
|
+
elsif database.is_a?(ArangoDatabase)
|
8
|
+
@database = database.database
|
9
|
+
else
|
10
|
+
raise "database should be a String or an ArangoDatabase instance, not a #{database.class}"
|
11
|
+
end
|
12
|
+
@id = id
|
13
|
+
@name = name
|
14
|
+
@type = type
|
15
|
+
@period = period
|
16
|
+
@command = command
|
17
|
+
@params = params
|
18
|
+
@created = created
|
19
|
+
@idCache = "IND_#{@id}"
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :id, :name, :type, :period, :created, :command, :params, :idCache
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
{
|
26
|
+
"id" => @id,
|
27
|
+
"name" => @name,
|
28
|
+
"database" => @database,
|
29
|
+
"type" => @type,
|
30
|
+
"period" => @period,
|
31
|
+
"create" => @created,
|
32
|
+
"command" => @command,
|
33
|
+
"params" => @params,
|
34
|
+
"idCache" => @idCache
|
35
|
+
}.delete_if{|k,v| v.nil?}
|
36
|
+
end
|
37
|
+
alias to_h to_hash
|
38
|
+
|
39
|
+
def database
|
40
|
+
ArangoDatabase.new(database: @database)
|
41
|
+
end
|
42
|
+
|
43
|
+
def retrieve # TESTED
|
44
|
+
result = self.class.get("/_db/#{@database}/_api/tasks/#{@id}")
|
45
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
46
|
+
return true if @@async
|
47
|
+
result = result.parsed_response
|
48
|
+
if @@verbose
|
49
|
+
unless result.is_a?(Hash) && result["error"]
|
50
|
+
@name = result["name"]
|
51
|
+
@type = result["type"]
|
52
|
+
@period = result["period"]
|
53
|
+
@created = result["created"]
|
54
|
+
@command = result["command"]
|
55
|
+
@database = result["database"]
|
56
|
+
end
|
57
|
+
result
|
58
|
+
else
|
59
|
+
if result.is_a?(Hash) && result["error"]
|
60
|
+
result["errorMessage"]
|
61
|
+
else
|
62
|
+
@name = result["name"]
|
63
|
+
@type = result["type"]
|
64
|
+
@period = result["period"]
|
65
|
+
@created = result["created"]
|
66
|
+
@command = result["command"]
|
67
|
+
@database = result["database"]
|
68
|
+
self
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.tasks # TESTED
|
74
|
+
result = get("/_db/#{@@database}/_api/tasks", @@request)
|
75
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
76
|
+
return true if @@async
|
77
|
+
result = result.parsed_response
|
78
|
+
@@verbose ? result : (result.is_a?(Hash) && result["error"]) ? result["errorMessage"] : result.map{|x| ArangoTask.new(id: x["id"], name: x["name"], type: x["type"], period: x["period"], created: x["created"], command: x["command"], database: x["database"])}
|
79
|
+
end
|
80
|
+
|
81
|
+
def create offset: nil # TESTED
|
82
|
+
body = {
|
83
|
+
"name" => @name,
|
84
|
+
"command" => @command,
|
85
|
+
"period" => @period,
|
86
|
+
"offset" => offset,
|
87
|
+
"params" => @params
|
88
|
+
}.delete_if{|k,v| v.nil?}.to_json
|
89
|
+
request = @@request.merge({ :body => body })
|
90
|
+
if @id.nil?
|
91
|
+
result = self.class.post("/_db/#{@database}/_api/tasks", request)
|
92
|
+
else
|
93
|
+
result = self.class.put("/_db/#{@database}/_api/tasks/#{@id}", request)
|
94
|
+
end
|
95
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
96
|
+
return true if @@async
|
97
|
+
result = result.parsed_response
|
98
|
+
if @@verbose
|
99
|
+
unless result.is_a?(Hash) && result["error"]
|
100
|
+
@id = result["id"]
|
101
|
+
@name = result["name"]
|
102
|
+
@type = result["type"]
|
103
|
+
@period = result["period"]
|
104
|
+
@created = result["created"]
|
105
|
+
@command = result["command"]
|
106
|
+
@database = result["database"]
|
107
|
+
end
|
108
|
+
result
|
109
|
+
else
|
110
|
+
return result["errorMessage"] if result.is_a?(Hash) && result["error"]
|
111
|
+
@id = result["id"]
|
112
|
+
@name = result["name"]
|
113
|
+
@type = result["type"]
|
114
|
+
@period = result["period"]
|
115
|
+
@created = result["created"]
|
116
|
+
@command = result["command"]
|
117
|
+
@database = result["database"]
|
118
|
+
self
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def destroy # TESTED
|
123
|
+
result = self.class.delete("/_db/#{@database}/_api/tasks/#{@id}", @@request)
|
124
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
125
|
+
return true if @@async
|
126
|
+
result = result.parsed_response
|
127
|
+
@@verbose ? result : (result.is_a?(Hash) && result["error"]) ? result["errorMessage"] : true
|
128
|
+
end
|
129
|
+
end
|
data/lib/ArangoRB_Tra.rb
CHANGED
@@ -1,142 +1,169 @@
|
|
1
|
-
# === TRAVERSAL ===
|
2
|
-
|
3
|
-
class ArangoTraversal < ArangoServer
|
4
|
-
def initialize(body: {}, database: @@database, graph: nil, edgeCollection: nil) # TESTED
|
5
|
-
@sort = body["sort"]
|
6
|
-
@direction = body["direction"]
|
7
|
-
@maxDepth = body["maxDepth"]
|
8
|
-
@minDepth = body["minDepth"]
|
9
|
-
@startVertex = body["startVertex"]
|
10
|
-
@visitor = body["visitor"]
|
11
|
-
@itemOrder = body["itemOrder"]
|
12
|
-
@strategy = body["strategy"]
|
13
|
-
@filter = body["filter"]
|
14
|
-
@init = body["init"]
|
15
|
-
@maxiterations = body["maxiterations"]
|
16
|
-
@uniqueness = body["uniqueness"]
|
17
|
-
@order = body["order"]
|
18
|
-
@graphName = body["graphName"].nil? ? graph : body["graphName"]
|
19
|
-
@expander = body["expander"]
|
20
|
-
@edgeCollection = body["edgeCollection"].nil? ? edgeCollection : body["edgeCollection"]
|
21
|
-
@database = database
|
22
|
-
@vertices = nil
|
23
|
-
@paths = nil
|
24
|
-
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
25
|
-
end
|
26
|
-
|
27
|
-
attr_accessor :sort, :direction, :maxDepth, :minDepth, :visitor, :itemOrder, :strategy, :filter, :init, :maxiterations, :uniqueness, :order, :expander
|
28
|
-
attr_reader :idCache, :vertices, :paths
|
29
|
-
|
30
|
-
### RETRIEVE ###
|
31
|
-
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
@
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
def
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
1
|
+
# === TRAVERSAL ===
|
2
|
+
|
3
|
+
class ArangoTraversal < ArangoServer
|
4
|
+
def initialize(body: {}, database: @@database, graph: nil, edgeCollection: nil) # TESTED
|
5
|
+
@sort = body["sort"]
|
6
|
+
@direction = body["direction"]
|
7
|
+
@maxDepth = body["maxDepth"]
|
8
|
+
@minDepth = body["minDepth"]
|
9
|
+
@startVertex = body["startVertex"]
|
10
|
+
@visitor = body["visitor"]
|
11
|
+
@itemOrder = body["itemOrder"]
|
12
|
+
@strategy = body["strategy"]
|
13
|
+
@filter = body["filter"]
|
14
|
+
@init = body["init"]
|
15
|
+
@maxiterations = body["maxiterations"]
|
16
|
+
@uniqueness = body["uniqueness"]
|
17
|
+
@order = body["order"]
|
18
|
+
@graphName = body["graphName"].nil? ? graph : body["graphName"]
|
19
|
+
@expander = body["expander"]
|
20
|
+
@edgeCollection = body["edgeCollection"].nil? ? edgeCollection : body["edgeCollection"]
|
21
|
+
@database = database
|
22
|
+
@vertices = nil
|
23
|
+
@paths = nil
|
24
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
25
|
+
end
|
26
|
+
|
27
|
+
attr_accessor :sort, :direction, :maxDepth, :minDepth, :visitor, :itemOrder, :strategy, :filter, :init, :maxiterations, :uniqueness, :order, :expander
|
28
|
+
attr_reader :idCache, :vertices, :paths
|
29
|
+
|
30
|
+
### RETRIEVE ###
|
31
|
+
|
32
|
+
def to_hash
|
33
|
+
{
|
34
|
+
"database" => @database,
|
35
|
+
"sort" => @sort,
|
36
|
+
"direction" => @direction,
|
37
|
+
"maxDepth" => @maxDepth,
|
38
|
+
"minDepth" => @minDepth,
|
39
|
+
"startVertex" => @startVertex,
|
40
|
+
"visitor" => @visitor,
|
41
|
+
"itemOrder" => @itemOrder,
|
42
|
+
"strategy" => @strategy,
|
43
|
+
"filter" => @filter,
|
44
|
+
"init" => @init,
|
45
|
+
"maxiterations" => @maxiterations,
|
46
|
+
"uniqueness" => @uniqueness,
|
47
|
+
"order" => @order,
|
48
|
+
"graphName" => @graphName,
|
49
|
+
"expander" => @expander,
|
50
|
+
"edgeCollection" => @edgeCollection,
|
51
|
+
"vertices" => @vertices.map{|x| x.id},
|
52
|
+
"paths" => @paths.map{|x| {"edges" => x["edges"].map{|e| e.id}, "vertices" => x["vertices"].map{|v| v.id} } },
|
53
|
+
"idCache" => @idCache
|
54
|
+
}.delete_if{|k,v| v.nil?}
|
55
|
+
end
|
56
|
+
alias to_h to_hash
|
57
|
+
|
58
|
+
def startVertex
|
59
|
+
val = @startVertex.split("/")
|
60
|
+
ArangoDocument.new(database: @database, collection: val[0], key: val[1])
|
61
|
+
end
|
62
|
+
|
63
|
+
def edgeCollection
|
64
|
+
ArangoCollection.new(collection: @edgeCollection, database: @database)
|
65
|
+
end
|
66
|
+
|
67
|
+
def database
|
68
|
+
ArangoDatabase.new(database: @database)
|
69
|
+
end
|
70
|
+
|
71
|
+
def graphName
|
72
|
+
ArangoGraph.new(graph: @graphName, database: @database).retrieve
|
73
|
+
end
|
74
|
+
|
75
|
+
def startVertex=(startVertex) # TESTED
|
76
|
+
if startVertex.is_a?(String)
|
77
|
+
@startVertex = startVertex
|
78
|
+
elsif startVertex.is_a?(ArangoDocument)
|
79
|
+
@startVertex = startVertex.id
|
80
|
+
else
|
81
|
+
raise "startVertex should be a String or an ArangoDocument instance, not a #{startVertex.class}"
|
82
|
+
end
|
83
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
84
|
+
end
|
85
|
+
|
86
|
+
def graphName=(graphName) # TESTED
|
87
|
+
if graphName.is_a?(String) || graphName.nil?
|
88
|
+
@graphName = graphName
|
89
|
+
elsif graphName.is_a?(ArangoGraph)
|
90
|
+
@graphName = graphName.graph
|
91
|
+
else
|
92
|
+
raise "graphName should be a String or an ArangoGraph instance, not a #{graphName.class}"
|
93
|
+
end
|
94
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
95
|
+
end
|
96
|
+
|
97
|
+
def edgeCollection=(edgeCollection) # TESTED
|
98
|
+
if edgeCollection.is_a?(String) || edgeCollection.nil?
|
99
|
+
@edgeCollection = edgeCollection
|
100
|
+
elsif edgeCollection.is_a?(ArangoCollection)
|
101
|
+
@edgeCollection = edgeCollection.collection
|
102
|
+
else
|
103
|
+
raise "edgeCollection should be a String or an ArangoCollection instance, not a #{edgeCollection.class}"
|
104
|
+
end
|
105
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
106
|
+
end
|
107
|
+
|
108
|
+
def in # TESTED
|
109
|
+
@direction = "inbound"
|
110
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
111
|
+
end
|
112
|
+
|
113
|
+
def out # TESTED
|
114
|
+
@direction = "outbound"
|
115
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
116
|
+
end
|
117
|
+
|
118
|
+
def any # TESTED
|
119
|
+
@direction = "any"
|
120
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
121
|
+
end
|
122
|
+
|
123
|
+
alias vertex= startVertex=
|
124
|
+
alias vertex startVertex
|
125
|
+
alias max maxDepth
|
126
|
+
alias max= maxDepth=
|
127
|
+
alias min minDepth
|
128
|
+
alias min= minDepth=
|
129
|
+
alias collection edgeCollection
|
130
|
+
alias collection= edgeCollection=
|
131
|
+
alias graph graphName
|
132
|
+
alias graph= graphName=
|
133
|
+
|
134
|
+
def execute # TESTED
|
135
|
+
body = {
|
136
|
+
"sort" => @sort,
|
137
|
+
"direction" => @direction,
|
138
|
+
"maxDepth" => @maxDepth,
|
139
|
+
"minDepth" => @minDepth,
|
140
|
+
"startVertex" => @startVertex,
|
141
|
+
"visitor" => @visitor,
|
142
|
+
"itemOrder" => @itemOrder,
|
143
|
+
"strategy" => @strategy,
|
144
|
+
"filter" => @filter,
|
145
|
+
"init" => @init,
|
146
|
+
"maxiterations" => @maxiterations,
|
147
|
+
"uniqueness" => @uniqueness,
|
148
|
+
"order" => @order,
|
149
|
+
"graphName" => @graphName,
|
150
|
+
"expander" => @expander,
|
151
|
+
"edgeCollection" => @edgeCollection
|
152
|
+
}.delete_if{|k,v| v.nil?}
|
153
|
+
request = @@request.merge({ :body => body.to_json })
|
154
|
+
result = self.class.post("/_db/#{@database}/_api/traversal", request)
|
155
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
156
|
+
return true if @@async
|
157
|
+
result = result.parsed_response
|
158
|
+
return @@verbose ? result : result["errorMessage"] if result["error"]
|
159
|
+
@vertices = result["result"]["visited"]["vertices"].map{|x| ArangoDocument.new(key: x["_key"], collection: x["_id"].split("/")[0], database: @database, body: x)}
|
160
|
+
@paths = result["result"]["visited"]["paths"].map{|x|
|
161
|
+
{
|
162
|
+
"edges" => x["edges"].map{|e| ArangoDocument.new(key: e["_key"], collection: e["_id"].split("/")[0], database: @database, body: e, from: e["_from"], to: e["_to"] )},
|
163
|
+
"vertices" => x["vertices"].map{|v| ArangoDocument.new(key: v["_key"], collection: v["_id"].split("/")[0], database: @database, body: v )}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
@idCache = "ATR_#{@database}_#{@direction}_#{@startVertex}_" + (@graphName.nil? ? "#{@edgeCollection}" : "#{@graphName}")
|
167
|
+
@@verbose ? result : self
|
168
|
+
end
|
169
|
+
end
|