arangorb 1.2.0 → 1.3.0

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