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,78 +1,78 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoGraph do
4
- context "#new" do
5
- it "create a new Graph instance without global" do
6
- myGraph = ArangoGraph.new graph: "MyGraph", database: "MyDatabase"
7
- expect(myGraph.graph).to eq "MyGraph"
8
- end
9
-
10
- it "create a new instance with global" do
11
- myGraph = ArangoGraph.new
12
- expect(myGraph.graph).to eq "MyGraph"
13
- end
14
- end
15
-
16
- context "#create" do
17
- it "create new graph" do
18
- @myGraph.destroy
19
- myGraph = @myGraph.create
20
- expect(myGraph.graph).to eq "MyGraph"
21
- end
22
- end
23
-
24
- context "#info" do
25
- it "info graph" do
26
- myGraph = @myGraph.retrieve
27
- expect(myGraph.graph).to eq "MyGraph"
28
- end
29
- end
30
-
31
- context "#manageVertexCollections" do
32
- it "add VertexCollection" do
33
- @myGraph.removeEdgeCollection collection: "MyEdgeCollection"
34
- @myGraph.removeVertexCollection collection: "MyCollection"
35
- myGraph = @myGraph.addVertexCollection collection: "MyCollection"
36
- expect(myGraph.orphanCollections[0]).to eq "MyCollection"
37
- end
38
-
39
- it "retrieve VertexCollection" do
40
- myGraph = @myGraph.vertexCollections
41
- expect(myGraph[0].collection).to eq "MyCollection"
42
- end
43
-
44
- it "remove VertexCollection" do
45
- myGraph = @myGraph.removeVertexCollection collection: "MyCollection"
46
- expect(myGraph.orphanCollections[0]).to eq nil
47
- end
48
- end
49
-
50
- context "#manageEdgeCollections" do
51
- it "add EdgeCollection" do
52
- myGraph = @myGraph.addEdgeCollection collection: "MyEdgeCollection", from: "MyCollection", to: @myCollectionB
53
- expect(myGraph.edgeDefinitions[0]["from"][0]).to eq "MyCollection"
54
- end
55
-
56
- it "retrieve EdgeCollection" do
57
- myGraph = @myGraph.edgeCollections
58
- expect(myGraph[0].collection).to eq "MyEdgeCollection"
59
- end
60
-
61
- it "replace EdgeCollection" do
62
- myGraph = @myGraph.replaceEdgeCollection collection: @myEdgeCollection, from: "MyCollection", to: "MyCollection"
63
- expect(myGraph.edgeDefinitions[0]["to"][0]).to eq "MyCollection"
64
- end
65
-
66
- it "remove EdgeCollection" do
67
- myGraph = @myGraph.removeEdgeCollection collection: "MyEdgeCollection"
68
- expect(myGraph.edgeDefinitions[0]).to eq nil
69
- end
70
- end
71
-
72
- context "#destroy" do
73
- it "delete graph" do
74
- myGraph = @myGraph.destroy
75
- expect(myGraph).to be true
76
- end
77
- end
78
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoGraph do
4
+ context "#new" do
5
+ it "create a new Graph instance without global" do
6
+ myGraph = ArangoGraph.new graph: "MyGraph", database: "MyDatabase"
7
+ expect(myGraph.graph).to eq "MyGraph"
8
+ end
9
+
10
+ it "create a new instance with global" do
11
+ myGraph = ArangoGraph.new
12
+ expect(myGraph.graph).to eq "MyGraph"
13
+ end
14
+ end
15
+
16
+ context "#create" do
17
+ it "create new graph" do
18
+ @myGraph.destroy
19
+ myGraph = @myGraph.create
20
+ expect(myGraph.graph).to eq "MyGraph"
21
+ end
22
+ end
23
+
24
+ context "#info" do
25
+ it "info graph" do
26
+ myGraph = @myGraph.retrieve
27
+ expect(myGraph.graph).to eq "MyGraph"
28
+ end
29
+ end
30
+
31
+ context "#manageVertexCollections" do
32
+ it "add VertexCollection" do
33
+ @myGraph.removeEdgeCollection collection: "MyEdgeCollection"
34
+ @myGraph.removeVertexCollection collection: "MyCollection"
35
+ myGraph = @myGraph.addVertexCollection collection: "MyCollection"
36
+ expect(myGraph.orphanCollections[0]).to eq "MyCollection"
37
+ end
38
+
39
+ it "retrieve VertexCollection" do
40
+ myGraph = @myGraph.vertexCollections
41
+ expect(myGraph[0].collection).to eq "MyCollection"
42
+ end
43
+
44
+ it "remove VertexCollection" do
45
+ myGraph = @myGraph.removeVertexCollection collection: "MyCollection"
46
+ expect(myGraph.orphanCollections[0]).to eq nil
47
+ end
48
+ end
49
+
50
+ context "#manageEdgeCollections" do
51
+ it "add EdgeCollection" do
52
+ myGraph = @myGraph.addEdgeCollection collection: "MyEdgeCollection", from: "MyCollection", to: @myCollectionB
53
+ expect(myGraph.edgeDefinitions[0]["from"][0]).to eq "MyCollection"
54
+ end
55
+
56
+ it "retrieve EdgeCollection" do
57
+ myGraph = @myGraph.edgeCollections
58
+ expect(myGraph[0].collection).to eq "MyEdgeCollection"
59
+ end
60
+
61
+ it "replace EdgeCollection" do
62
+ myGraph = @myGraph.replaceEdgeCollection collection: @myEdgeCollection, from: "MyCollection", to: "MyCollection"
63
+ expect(myGraph.edgeDefinitions[0]["to"][0]).to eq "MyCollection"
64
+ end
65
+
66
+ it "remove EdgeCollection" do
67
+ myGraph = @myGraph.removeEdgeCollection collection: "MyEdgeCollection"
68
+ expect(myGraph.edgeDefinitions[0]).to eq nil
69
+ end
70
+ end
71
+
72
+ context "#destroy" do
73
+ it "delete graph" do
74
+ myGraph = @myGraph.destroy
75
+ expect(myGraph).to be true
76
+ end
77
+ end
78
+ end
@@ -1,37 +1,37 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoServer do
4
- context "#database" do
5
- it "setup a global database" do
6
- ArangoServer.database = "MyDatabase"
7
- expect(ArangoServer.database.name).to eq "MyDatabase"
8
- end
9
- end
10
-
11
- context "#graph" do
12
- it "setup a global graph" do
13
- ArangoServer.graph = "MyGraph"
14
- expect(ArangoServer.graph.name).to eq "MyGraph"
15
- end
16
- end
17
-
18
- context "#collection" do
19
- it "setup a global collection" do
20
- ArangoServer.collection = "MyCollection"
21
- expect(ArangoServer.collection.name).to eq "MyCollection"
22
- end
23
- end
24
-
25
- context "#verbose" do
26
- it "try verbose" do
27
- ArangoServer.verbose = true
28
- result = ArangoCollection.new(collection: "Test").create
29
- expect(result.class).to be Hash
30
- end
31
-
32
- it "print verbose" do
33
- ArangoServer.verbose = true
34
- expect(ArangoServer.verbose).to be true
35
- end
36
- end
37
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoServer do
4
+ context "#database" do
5
+ it "setup a global database" do
6
+ ArangoServer.database = "MyDatabase"
7
+ expect(ArangoServer.database.name).to eq "MyDatabase"
8
+ end
9
+ end
10
+
11
+ context "#graph" do
12
+ it "setup a global graph" do
13
+ ArangoServer.graph = "MyGraph"
14
+ expect(ArangoServer.graph.name).to eq "MyGraph"
15
+ end
16
+ end
17
+
18
+ context "#collection" do
19
+ it "setup a global collection" do
20
+ ArangoServer.collection = "MyCollection"
21
+ expect(ArangoServer.collection.name).to eq "MyCollection"
22
+ end
23
+ end
24
+
25
+ context "#verbose" do
26
+ it "try verbose" do
27
+ ArangoServer.verbose = true
28
+ result = ArangoCollection.new(collection: "Test").create
29
+ expect(result.class).to be Hash
30
+ end
31
+
32
+ it "print verbose" do
33
+ ArangoServer.verbose = true
34
+ expect(ArangoServer.verbose).to be true
35
+ end
36
+ end
37
+ end
@@ -1,48 +1,48 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoTraversal do
4
- context "#new" do
5
- it "create a new Traversal instance" do
6
- myTraversal = ArangoTraversal.new
7
- expect(myTraversal.database.name).to eq "MyDatabase"
8
- end
9
-
10
- it "instantiate start Vertex" do
11
- @myTraversal.vertex = @myDoc[0]
12
- expect(@myTraversal.vertex.id).to eq "MyCollection/FirstKey"
13
- end
14
-
15
- it "instantiate Graph" do
16
- @myTraversal.graph = @myGraph
17
- expect(@myTraversal.graph.name).to eq @myGraph.graph
18
- end
19
-
20
- it "instantiate EdgeCollection" do
21
- @myTraversal.collection = @myEdgeCollection
22
- expect(@myTraversal.collection.name).to eq @myEdgeCollection.collection
23
- end
24
-
25
- it "instantiate Direction" do
26
- @myTraversal.in
27
- expect(@myTraversal.direction).to eq "inbound"
28
- end
29
-
30
- it "instantiate Max" do
31
- @myTraversal.max = 3
32
- expect(@myTraversal.max).to eq 3
33
- end
34
-
35
- it "instantiate Min" do
36
- @myTraversal.min = 1
37
- expect(@myTraversal.min).to eq 1
38
- end
39
- end
40
-
41
- context "#execute" do
42
- it "execute Traversal" do
43
- @myTraversal.any
44
- @myTraversal.execute
45
- expect(@myTraversal.vertices.length).to be >= 30
46
- end
47
- end
48
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoTraversal do
4
+ context "#new" do
5
+ it "create a new Traversal instance" do
6
+ myTraversal = ArangoTraversal.new
7
+ expect(myTraversal.database.name).to eq "MyDatabase"
8
+ end
9
+
10
+ it "instantiate start Vertex" do
11
+ @myTraversal.vertex = @myDoc[0]
12
+ expect(@myTraversal.vertex.id).to eq "MyCollection/FirstKey"
13
+ end
14
+
15
+ it "instantiate Graph" do
16
+ @myTraversal.graph = @myGraph
17
+ expect(@myTraversal.graph.name).to eq @myGraph.graph
18
+ end
19
+
20
+ it "instantiate EdgeCollection" do
21
+ @myTraversal.collection = @myEdgeCollection
22
+ expect(@myTraversal.collection.name).to eq @myEdgeCollection.collection
23
+ end
24
+
25
+ it "instantiate Direction" do
26
+ @myTraversal.in
27
+ expect(@myTraversal.direction).to eq "inbound"
28
+ end
29
+
30
+ it "instantiate Max" do
31
+ @myTraversal.max = 3
32
+ expect(@myTraversal.max).to eq 3
33
+ end
34
+
35
+ it "instantiate Min" do
36
+ @myTraversal.min = 1
37
+ expect(@myTraversal.min).to eq 1
38
+ end
39
+ end
40
+
41
+ context "#execute" do
42
+ it "execute Traversal" do
43
+ @myTraversal.any
44
+ @myTraversal.execute
45
+ expect(@myTraversal.vertices.length).to be >= 30
46
+ end
47
+ end
48
+ end
@@ -1,65 +1,65 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoVertex do
4
- context "#new" do
5
- it "create a new Document instance without global" do
6
- myVertex = ArangoVertex.new collection: "MyCollection", database: "MyDatabase", graph: "MyGraph"
7
- expect(myVertex.collection.name).to eq "MyCollection"
8
- end
9
-
10
- it "create a new instance with global" do
11
- myVertex = ArangoVertex.new key: "myKey", body: {"Hello" => "World"}
12
- expect(myVertex.key).to eq "myKey"
13
- end
14
- end
15
-
16
- context "#create" do
17
- it "create a new Document" do
18
- @myVertex.destroy
19
- myVertex = @myVertex.create
20
- expect(myVertex.body["Hello"]).to eq "World"
21
- end
22
-
23
- it "create a duplicate Document" do
24
- myVertex = @myVertex.create
25
- expect(myVertex).to eq "unique constraint violated"
26
- end
27
- end
28
-
29
- context "#info" do
30
- it "retrieve Document" do
31
- myVertex = @myVertex.retrieve
32
- expect(myVertex.body["Hello"]).to eq "World"
33
- end
34
-
35
- it "retrieve Edges" do
36
- @myEdgeCollection.create_edge from: ["MyCollection/myA", "MyCollection/myB"], to: @myVertex
37
- myEdges = @myVertex.retrieve_edges(collection: @myEdgeCollection)
38
- expect(myEdges.length).to eq 2
39
- end
40
-
41
- # it "going in different directions" do
42
- # myVertex = @myVertex.in("MyEdgeCollection")[0].from.out(@myEdgeCollection)[0].to
43
- # expect(myVertex.id).to eq @myVertex.id
44
- # end
45
- end
46
-
47
- context "#modify" do
48
- it "replace" do
49
- myVertex = @myVertex.replace body: {"value" => 3}
50
- expect(myVertex.body["value"]).to eq 3
51
- end
52
-
53
- it "update" do
54
- myVertex = @myVertex.update body: {"time" => 13}
55
- expect(myVertex.body["value"]).to eq 3
56
- end
57
- end
58
-
59
- context "#destroy" do
60
- it "delete a Document" do
61
- result = @myVertex.destroy
62
- expect(result).to eq true
63
- end
64
- end
65
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoVertex do
4
+ context "#new" do
5
+ it "create a new Document instance without global" do
6
+ myVertex = ArangoVertex.new collection: "MyCollection", database: "MyDatabase", graph: "MyGraph"
7
+ expect(myVertex.collection.name).to eq "MyCollection"
8
+ end
9
+
10
+ it "create a new instance with global" do
11
+ myVertex = ArangoVertex.new key: "myKey", body: {"Hello" => "World"}
12
+ expect(myVertex.key).to eq "myKey"
13
+ end
14
+ end
15
+
16
+ context "#create" do
17
+ it "create a new Document" do
18
+ @myVertex.destroy
19
+ myVertex = @myVertex.create
20
+ expect(myVertex.body["Hello"]).to eq "World"
21
+ end
22
+
23
+ it "create a duplicate Document" do
24
+ myVertex = @myVertex.create
25
+ expect(myVertex).to eq "unique constraint violated"
26
+ end
27
+ end
28
+
29
+ context "#info" do
30
+ it "retrieve Document" do
31
+ myVertex = @myVertex.retrieve
32
+ expect(myVertex.body["Hello"]).to eq "World"
33
+ end
34
+
35
+ it "retrieve Edges" do
36
+ @myEdgeCollection.create_edge from: ["MyCollection/myA", "MyCollection/myB"], to: @myVertex
37
+ myEdges = @myVertex.retrieve_edges(collection: @myEdgeCollection)
38
+ expect(myEdges.length).to eq 2
39
+ end
40
+
41
+ # it "going in different directions" do
42
+ # myVertex = @myVertex.in("MyEdgeCollection")[0].from.out(@myEdgeCollection)[0].to
43
+ # expect(myVertex.id).to eq @myVertex.id
44
+ # end
45
+ end
46
+
47
+ context "#modify" do
48
+ it "replace" do
49
+ myVertex = @myVertex.replace body: {"value" => 3}
50
+ expect(myVertex.body["value"]).to eq 3
51
+ end
52
+
53
+ it "update" do
54
+ myVertex = @myVertex.update body: {"time" => 13}
55
+ expect(myVertex.body["value"]).to eq 3
56
+ end
57
+ end
58
+
59
+ context "#destroy" do
60
+ it "delete a Document" do
61
+ result = @myVertex.destroy
62
+ expect(result).to eq true
63
+ end
64
+ end
65
+ end