arangorb 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/ArangoRB.gemspec +20 -18
  3. data/Gemfile +3 -0
  4. data/README.md +1079 -908
  5. data/lib/AQL.rb +155 -0
  6. data/lib/Batch.rb +97 -0
  7. data/lib/Cache.rb +71 -0
  8. data/lib/Collection.rb +852 -0
  9. data/lib/Database.rb +417 -0
  10. data/lib/Document.rb +346 -0
  11. data/lib/Edge.rb +104 -0
  12. data/lib/Error.rb +125 -0
  13. data/lib/Foxx.rb +277 -0
  14. data/lib/Graph.rb +325 -0
  15. data/lib/Index.rb +126 -0
  16. data/lib/Replication.rb +235 -0
  17. data/lib/Request.rb +143 -0
  18. data/lib/Server.rb +466 -0
  19. data/lib/Task.rb +120 -0
  20. data/lib/Transaction.rb +115 -0
  21. data/lib/Traversal.rb +224 -0
  22. data/lib/User.rb +197 -0
  23. data/lib/Vertex.rb +127 -0
  24. data/lib/View.rb +151 -0
  25. data/lib/arangorb.rb +23 -15
  26. data/lib/helpers/Error.rb +28 -0
  27. data/lib/helpers/Return.rb +53 -0
  28. metadata +64 -45
  29. data/lib/ArangoRB_AQL.rb +0 -181
  30. data/lib/ArangoRB_Cache.rb +0 -174
  31. data/lib/ArangoRB_Col.rb +0 -526
  32. data/lib/ArangoRB_DB.rb +0 -363
  33. data/lib/ArangoRB_Doc.rb +0 -319
  34. data/lib/ArangoRB_Edg.rb +0 -184
  35. data/lib/ArangoRB_Gra.rb +0 -201
  36. data/lib/ArangoRB_Index.rb +0 -135
  37. data/lib/ArangoRB_Replication.rb +0 -261
  38. data/lib/ArangoRB_Ser.rb +0 -446
  39. data/lib/ArangoRB_Task.rb +0 -129
  40. data/lib/ArangoRB_Tra.rb +0 -169
  41. data/lib/ArangoRB_Tran.rb +0 -68
  42. data/lib/ArangoRB_User.rb +0 -157
  43. data/lib/ArangoRB_Ver.rb +0 -162
  44. data/spec/arangoRB_helper.rb +0 -4
  45. data/spec/arangoRestart_helper.rb +0 -14
  46. data/spec/arangorb-1.3.0.gem +0 -0
  47. data/spec/lib/0.1.0/arangoAQL_helper.rb +0 -64
  48. data/spec/lib/0.1.0/arangoC_helper.rb +0 -170
  49. data/spec/lib/0.1.0/arangoDB_helper.rb +0 -119
  50. data/spec/lib/0.1.0/arangoDoc_helper.rb +0 -79
  51. data/spec/lib/0.1.0/arangoE_helper.rb +0 -50
  52. data/spec/lib/0.1.0/arangoG_helper.rb +0 -78
  53. data/spec/lib/0.1.0/arangoS_helper.rb +0 -37
  54. data/spec/lib/0.1.0/arangoT_helper.rb +0 -48
  55. data/spec/lib/0.1.0/arangoV_helper.rb +0 -65
  56. data/spec/lib/1.0.0/arangoC_helper.rb +0 -73
  57. data/spec/lib/1.0.0/arangoDB_helper.rb +0 -48
  58. data/spec/lib/1.0.0/arangoI_helper.rb +0 -43
  59. data/spec/lib/1.0.0/arangoS_helper.rb +0 -192
  60. data/spec/lib/1.0.0/arangoTa_helper.rb +0 -49
  61. data/spec/lib/1.0.0/arangoTr_helper.rb +0 -15
  62. data/spec/lib/1.0.0/arangoU_helper.rb +0 -72
  63. data/spec/lib/1.1.0/arangoRB_helper.rb +0 -144
  64. data/spec/lib/1.1.0/arangoRB_walks_helper.rb +0 -19
  65. data/spec/lib/1.2.0/arangoCache_helper.rb +0 -66
  66. data/spec/lib/1.3.0/arangoHash_helper.rb +0 -30
  67. data/spec/lib/arangoRB_0.1.0_helper.rb +0 -9
  68. data/spec/lib/arangoRB_1.0.0_helper.rb +0 -6
  69. data/spec/lib/arangoRB_1.1.0_helper.rb +0 -2
  70. data/spec/lib/arangoRB_1.2.0_helper.rb +0 -2
  71. data/spec/spec_helper.rb +0 -42
@@ -1,19 +0,0 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoDatabase do
4
- context "#retrieve" do
5
- it "walk" do
6
- print "\n"
7
- print "#{@myDatabase.name}\n"
8
- print "#{@myDatabase['MyCollection'].name}\n"
9
- print "#{@myDatabase['MyCollection'].documents.map{|x| x.name}}\n"
10
- print "#{@myDatabase['MyCollection']["FirstKey"].name}\n"
11
- print "#{@myDatabase['MyCollection'][@myDatabase['MyCollection']["FirstKey"]].name}\n"
12
- print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection").map{|x| x.name}}\n"
13
- print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
14
- print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database.name}\n"
15
- print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
16
- expect(@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]).to eq 1
17
- end
18
- end
19
- end
@@ -1,66 +0,0 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoCache do
4
- context "#cache" do
5
- it "cache" do
6
- @myDatabase.retrieve
7
- @myCollection.retrieve
8
- @myEdgeCollection.retrieve
9
- @myGraph.retrieve
10
- @myAQL.execute
11
- @myVertex.retrieve
12
- @myEdge.retrieve
13
- @myIndex.retrieve
14
- @myUser.retrieve
15
- @myTask.retrieve
16
- val = ArangoCache.cache data: [@myDatabase, @myCollection, @myEdgeCollection, @myGraph, @myAQL, @myVertex, @myEdge, @myIndex, @myUser, @myTask, [1,2,3]]
17
- expect(val.length).to eq 11
18
- end
19
-
20
- it "cache with ID" do
21
- myAQL2 = ArangoAQL.new query: "FOR u IN MyCollection RETURN u"
22
- myAQL2.execute
23
- ArangoCache.cache id: "myAQL", data: myAQL2
24
- val = ArangoCache.uncache type: "AQL", id: "myAQL"
25
- expect(val.result.length).to be > 0
26
- end
27
-
28
- it "uncache" do
29
- val = ArangoCache.uncache data: [@myCollection, @myVertex]
30
- val = val.map{|v| v.class.to_s}
31
- expect(val).to eq ["ArangoCollection", "ArangoVertex"]
32
- end
33
- end
34
-
35
- context "#limits" do
36
- it "max" do
37
- ArangoCache.cache data: @myDoc
38
- val = ArangoCache.retrieve["Document"]
39
- ArangoCache.max type: "Document", val: 5
40
- ArangoCache.retrieve["Document"]
41
- ArangoCache.cache data: @myDoc[0]
42
- val = ArangoCache.uncache type: "Document"
43
- expect(val.length).to eq 5
44
- end
45
- end
46
-
47
- context "#clear" do
48
- it "clear object" do
49
- ArangoCache.clear data: @myCollection
50
- val = ArangoCache.uncache data: @myCollection
51
- expect(val.nil?).to be true
52
- end
53
-
54
- it "clear type" do
55
- ArangoCache.clear type: "Vertex"
56
- val = ArangoCache.retrieve
57
- expect(val["Vertex"].empty?).to be true
58
- end
59
-
60
- it "clear type" do
61
- ArangoCache.clear
62
- val = ArangoCache.retrieve
63
- expect(val["Database"].empty?).to be true
64
- end
65
- end
66
- end
@@ -1,30 +0,0 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe "ArangoHash" do
4
- context "#hash" do
5
- it "hash" do
6
- @myDatabase.retrieve
7
- @myCollection.retrieve
8
- @myEdgeCollection.retrieve
9
- @myGraph.retrieve
10
- @myAQL.execute
11
- @myVertex.retrieve
12
- @myEdge.retrieve
13
- @myIndex.retrieve
14
- @myUser.retrieve
15
- @myTask.retrieve
16
-
17
- print "#{@myDatabase.to_h}\n"
18
- print "#{@myCollection.to_h}\n"
19
- print "#{@myEdgeCollection.to_h}\n"
20
- print "#{@myGraph.to_h}\n"
21
- print "#{@myAQL.to_h}\n"
22
- print "#{@myVertex.to_h}\n"
23
- print "#{@myEdge.to_h}\n"
24
- print "#{@myIndex.to_h}\n"
25
- print "#{@myUser.to_h}\n"
26
- print "#{@myTask.to_h}\n"
27
- expect(@myTask.to_hash.class).to be Hash
28
- end
29
- end
30
- end
@@ -1,9 +0,0 @@
1
- require "lib/0.1.0/arangoS_helper"
2
- require "lib/0.1.0/arangoDB_helper"
3
- require "lib/0.1.0/arangoC_helper"
4
- require "lib/0.1.0/arangoDoc_helper"
5
- require "lib/0.1.0/arangoG_helper"
6
- require "lib/0.1.0/arangoV_helper"
7
- require "lib/0.1.0/arangoE_helper"
8
- require "lib/0.1.0/arangoT_helper"
9
- require "lib/0.1.0/arangoAQL_helper"
@@ -1,6 +0,0 @@
1
- require "lib/1.0.0/arangoS_helper"
2
- require "lib/1.0.0/arangoDB_helper"
3
- require "lib/1.0.0/arangoC_helper"
4
- require "lib/1.0.0/arangoU_helper"
5
- require "lib/1.0.0/arangoTr_helper"
6
- require "lib/1.0.0/arangoTa_helper"
@@ -1,2 +0,0 @@
1
- require "lib/1.1.0/arangoRB_helper"
2
- require "lib/1.1.0/arangoRB_walks_helper"
@@ -1,2 +0,0 @@
1
- require "lib/1.2.0/arangoCache_helper"
2
- require "lib/1.3.0/arangoHash_helper"
data/spec/spec_helper.rb DELETED
@@ -1,42 +0,0 @@
1
- require "rspec"
2
- require "arangorb"
3
- # require_relative File.expand_path('../../lib/arangorb', __FILE__)
4
-
5
- RSpec.configure do |config|
6
- config.color = true
7
- config.before(:all) do
8
- ArangoServer.default_server user: "root", password: "tretretre", server: "localhost", port: "8529"
9
- ArangoServer.database = "MyDatabase"
10
- ArangoServer.collection = "MyCollection"
11
- ArangoServer.graph = "MyGraph"
12
- ArangoServer.user = "MyUser"
13
- ArangoServer.verbose = false
14
- ArangoServer.async = false
15
- @myDatabase = ArangoDatabase.new.create
16
- @myGraph = ArangoGraph.new.create
17
- @myCollection = ArangoCollection.new.create
18
- @myCollectionB = ArangoCollection.new(collection: "MyCollectionB").create
19
- @myDocument = ArangoDocument.new(body: {"Hello" => "World", "num" => 1}, key: "FirstDocument").create
20
- @myEdgeCollection = ArangoCollection.new(collection: "MyEdgeCollection").create_edge_collection
21
- @myGraph.addVertexCollection collection: "MyCollection"
22
- @myGraph.addEdgeCollection collection: "MyEdgeCollection", from: "MyCollection", to: "MyCollection"
23
- @myAQL = ArangoAQL.new query: "FOR u IN MyCollection RETURN u.num"
24
- @myDoc = @myCollection.create_document document: [{"num" => 1, "_key" => "FirstKey"}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 2}, {"num" => 2}, {"num" => 2}, {"num" => 3}, {"num" => 2}, {"num" => 5}, {"num" => 2}]
25
- @myEdgeCollection.create_edge from: [@myDoc[0].id, @myDoc[1].id, @myDoc[2].id, @myDoc[3].id, @myDoc[7].id], to: [@myDoc[4].id, @myDoc[5].id, @myDoc[6].id, @myDoc[8].id]
26
- @myVertex = ArangoVertex.new(body: {"Hello" => "World", "num" => 1}, key: "FirstVertex").create
27
- @vertexA = ArangoVertex.new(body: {"Hello" => "World", "num" => 1}).create
28
- @vertexB = ArangoVertex.new(body: {"Hello" => "Moon", "num" => 2}).create
29
- @myEdge = ArangoEdge.new(from: @vertexA, to: @vertexB, collection: "MyEdgeCollection").create
30
- @myIndex = @myCollection.createIndex unique: false, fields: "num", type: "hash", id: "MyIndex"
31
- @myTraversal = ArangoTraversal.new
32
- @myUser = ArangoUser.new.create
33
- @myTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 60
34
- end
35
-
36
- config.after(:all) do
37
- ArangoDatabase.new.destroy
38
- ArangoUser.new.destroy
39
- @myUser.destroy unless @myUser.nil?
40
- @myIndex.destroy unless @myIndex.nil?
41
- end
42
- end