arangorb 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
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,49 +1,49 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoTask do
4
- context "#new" do
5
- it "create new instance" do
6
- myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 2
7
- expect(myArangoTask.params["foo"]).to eq "bar"
8
- end
9
- end
10
-
11
- context "#create" do
12
- it "create a new Task instance" do
13
- myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 2
14
- expect(myArangoTask.create.created.class).to eq Float
15
- end
16
-
17
- it "create a new Task instance with ID" do
18
- myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
19
- expect(myArangoTask.create.params["foo2"]).to eq "bar2"
20
- end
21
-
22
- it "duplilcate a Task instance with ID" do
23
- myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo21" => "bar2", "bar21" => "foo21"}, period: 2
24
- expect(myArangoTask.create).to eq "duplicate task id"
25
- end
26
- end
27
-
28
- context "#retrieve" do
29
- it "retrieve lists" do
30
- myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
31
- myArangoTask.create
32
- result = ArangoTask.tasks.map{|x| x.database.name}
33
- expect(result.include? 'MyDatabase').to be true
34
- end
35
-
36
- it "retrieve" do
37
- myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
38
- myArangoTask.create
39
- expect(myArangoTask.retrieve.params["foo2"]).to eq "bar2"
40
- end
41
- end
42
-
43
- context "#destroy" do
44
- it "destroy" do
45
- myArangoTask = ArangoTask.new id: "mytaskid"
46
- expect(myArangoTask.destroy).to be true
47
- end
48
- end
49
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoTask do
4
+ context "#new" do
5
+ it "create new instance" do
6
+ myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 2
7
+ expect(myArangoTask.params["foo"]).to eq "bar"
8
+ end
9
+ end
10
+
11
+ context "#create" do
12
+ it "create a new Task instance" do
13
+ myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 2
14
+ expect(myArangoTask.create.created.class).to eq Float
15
+ end
16
+
17
+ it "create a new Task instance with ID" do
18
+ myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
19
+ expect(myArangoTask.create.params["foo2"]).to eq "bar2"
20
+ end
21
+
22
+ it "duplilcate a Task instance with ID" do
23
+ myArangoTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo21" => "bar2", "bar21" => "foo21"}, period: 2
24
+ expect(myArangoTask.create).to eq "duplicate task id"
25
+ end
26
+ end
27
+
28
+ context "#retrieve" do
29
+ it "retrieve lists" do
30
+ myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
31
+ myArangoTask.create
32
+ result = ArangoTask.tasks.map{|x| x.database.name}
33
+ expect(result.include? 'MyDatabase').to be true
34
+ end
35
+
36
+ it "retrieve" do
37
+ myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
38
+ myArangoTask.create
39
+ expect(myArangoTask.retrieve.params["foo2"]).to eq "bar2"
40
+ end
41
+ end
42
+
43
+ context "#destroy" do
44
+ it "destroy" do
45
+ myArangoTask = ArangoTask.new id: "mytaskid"
46
+ expect(myArangoTask.destroy).to be true
47
+ end
48
+ end
49
+ end
@@ -1,15 +1,15 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoTransaction do
4
- context "#new and use" do
5
- it "create new instance" do
6
- myArangoTransaction = ArangoTransaction.new action: "function(){ var db = require('@arangodb').db; db.MyCollection.save({}); return db.MyCollection.count(); }", write: @myCollection
7
- expect(myArangoTransaction.collections["write"][0].name).to eq "MyCollection"
8
- end
9
-
10
- it "execute" do
11
- myArangoTransaction = ArangoTransaction.new action: "function(){ var db = require('@arangodb').db; db.MyCollection.save({}); return db.MyCollection.count(); }", write: @myCollection
12
- expect(myArangoTransaction.execute).to be >= 1
13
- end
14
- end
15
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoTransaction do
4
+ context "#new and use" do
5
+ it "create new instance" do
6
+ myArangoTransaction = ArangoTransaction.new action: "function(){ var db = require('@arangodb').db; db.MyCollection.save({}); return db.MyCollection.count(); }", write: @myCollection
7
+ expect(myArangoTransaction.collections["write"][0].name).to eq "MyCollection"
8
+ end
9
+
10
+ it "execute" do
11
+ myArangoTransaction = ArangoTransaction.new action: "function(){ var db = require('@arangodb').db; db.MyCollection.save({}); return db.MyCollection.count(); }", write: @myCollection
12
+ expect(myArangoTransaction.execute).to be >= 1
13
+ end
14
+ end
15
+ end
@@ -1,72 +1,72 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoUser do
4
- context "#new" do
5
- it "create a new User without global" do
6
- myUser = ArangoUser.new user: "MyUser2", password: "Test"
7
- expect(myUser.user).to eq "MyUser2"
8
- end
9
-
10
- it "create a new instance with global" do
11
- myUser = ArangoUser.new
12
- expect(myUser.user).to eq "MyUser"
13
- end
14
- end
15
-
16
- context "#create" do
17
- it "create a new user" do
18
- @myUser.destroy
19
- @myUser = ArangoUser.new user: "MyUser", password: "Test"
20
- result = @myUser.create
21
- expect(result.user).to eq "MyUser"
22
- end
23
-
24
- it "create a duplicate user" do
25
- result = @myUser.create
26
- expect(result).to eq "duplicate user"
27
- end
28
- end
29
-
30
- context "#info" do
31
- it "retrieve User" do
32
- myUser = @myUser.retrieve
33
- expect(myUser.active).to be true
34
- end
35
- end
36
-
37
- context "#database" do
38
- it "grant" do
39
- result = @myUser.grant database: @myDatabase
40
- expect(result).to be true
41
- end
42
-
43
- it "databases" do
44
- result = @myUser.databases
45
- expect(result["MyDatabase"]).to eq "rw"
46
- end
47
-
48
- it "revoke" do
49
- result = @myUser.revoke database: @myDatabase
50
- expect(result).to be true
51
- end
52
- end
53
-
54
- context "#modify" do
55
- it "replace" do
56
- @myUser.replace active: false, password: "Test"
57
- expect(@myUser.active).to be false
58
- end
59
-
60
- it "update" do
61
- @myUser.update active: false, password: "Test"
62
- expect(@myUser.active).to be false
63
- end
64
- end
65
-
66
- context "#destroy" do
67
- it "destroy" do
68
- result = @myUser.destroy
69
- expect(result).to be true
70
- end
71
- end
72
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoUser do
4
+ context "#new" do
5
+ it "create a new User without global" do
6
+ myUser = ArangoUser.new user: "MyUser2", password: "Test"
7
+ expect(myUser.user).to eq "MyUser2"
8
+ end
9
+
10
+ it "create a new instance with global" do
11
+ myUser = ArangoUser.new
12
+ expect(myUser.user).to eq "MyUser"
13
+ end
14
+ end
15
+
16
+ context "#create" do
17
+ it "create a new user" do
18
+ @myUser.destroy
19
+ @myUser = ArangoUser.new user: "MyUser", password: "Test"
20
+ result = @myUser.create
21
+ expect(result.user).to eq "MyUser"
22
+ end
23
+
24
+ it "create a duplicate user" do
25
+ result = @myUser.create
26
+ expect(result).to eq "duplicate user"
27
+ end
28
+ end
29
+
30
+ context "#info" do
31
+ it "retrieve User" do
32
+ myUser = @myUser.retrieve
33
+ expect(myUser.active).to be true
34
+ end
35
+ end
36
+
37
+ context "#database" do
38
+ it "grant" do
39
+ result = @myUser.grant database: @myDatabase
40
+ expect(result).to be true
41
+ end
42
+
43
+ it "databases" do
44
+ result = @myUser.databases
45
+ expect(result["MyDatabase"]).to eq "rw"
46
+ end
47
+
48
+ it "revoke" do
49
+ result = @myUser.revoke database: @myDatabase
50
+ expect(result).to be true
51
+ end
52
+ end
53
+
54
+ context "#modify" do
55
+ it "replace" do
56
+ @myUser.replace active: false, password: "Test"
57
+ expect(@myUser.active).to be false
58
+ end
59
+
60
+ it "update" do
61
+ @myUser.update active: false, password: "Test"
62
+ expect(@myUser.active).to be false
63
+ end
64
+ end
65
+
66
+ context "#destroy" do
67
+ it "destroy" do
68
+ result = @myUser.destroy
69
+ expect(result).to be true
70
+ end
71
+ end
72
+ end
@@ -1,144 +1,144 @@
1
- require_relative './../../spec_helper'
2
-
3
- describe ArangoDatabase do
4
- context "#retrieve" do
5
- it "collection" do
6
- expect(@myDatabase["MyCollection"].class).to be ArangoCollection
7
- end
8
-
9
- it "collection" do
10
- expect(@myDatabase.collection("MyCollection").class).to be ArangoCollection
11
- end
12
-
13
- it "graph" do
14
- expect(@myDatabase.graph("MyGraph").class).to be ArangoGraph
15
- end
16
- end
17
- end
18
-
19
- describe ArangoCollection do
20
- context "#retrieve" do
21
- it "document" do
22
- expect(@myCollection["MyDocument"].class).to be ArangoDocument
23
- end
24
-
25
- it "database" do
26
- expect(@myCollection.database.class).to be ArangoDatabase
27
- end
28
- end
29
- end
30
-
31
- describe ArangoDocument do
32
- context "#retrieve" do
33
- it "collection" do
34
- expect(@myDocument.collection.class).to be ArangoCollection
35
- end
36
-
37
- it "database" do
38
- expect(@myDocument.database.class).to be ArangoDatabase
39
- end
40
- end
41
- end
42
-
43
- describe ArangoVertex do
44
- context "#retrieve" do
45
- it "collection" do
46
- expect(@myVertex.collection.class).to be ArangoCollection
47
- end
48
-
49
- it "database" do
50
- expect(@myVertex.database.class).to be ArangoDatabase
51
- end
52
-
53
- it "graph" do
54
- expect(@myVertex.graph.class).to be ArangoGraph
55
- end
56
- end
57
- end
58
-
59
- describe ArangoEdge do
60
- context "#retrieve" do
61
- it "collection" do
62
- expect(@myEdge.collection.class).to be ArangoCollection
63
- end
64
-
65
- it "database" do
66
- expect(@myEdge.database.class).to be ArangoDatabase
67
- end
68
-
69
- it "graph" do
70
- expect(@myEdge.graph.class).to be ArangoGraph
71
- end
72
- end
73
- end
74
-
75
-
76
- describe ArangoGraph do
77
- context "#retrieve" do
78
- it "database" do
79
- expect(@myGraph.database.class).to be ArangoDatabase
80
- end
81
- end
82
- end
83
-
84
- describe ArangoIndex do
85
- context "#retrieve" do
86
- it "collection" do
87
- expect(@myIndex.collection.class).to be ArangoCollection
88
- end
89
-
90
- it "database" do
91
- expect(@myIndex.database.class).to be ArangoDatabase
92
- end
93
- end
94
- end
95
-
96
- describe ArangoTask do
97
- context "#retrieve" do
98
- it "database" do
99
- expect(@myTask.database.class).to be ArangoDatabase
100
- end
101
- end
102
- end
103
-
104
- describe ArangoTraversal do
105
- context "#retrieve" do
106
- it "database" do
107
- @myTraversal.vertex = @myDoc[0]
108
- @myTraversal.graph = @myGraph
109
- @myTraversal.collection = @myEdgeCollection
110
- @myTraversal.in
111
- expect(@myTraversal.database.class).to be ArangoDatabase
112
- end
113
-
114
- it "graph" do
115
- expect(@myTraversal.graph.class).to be ArangoGraph
116
- end
117
-
118
- it "vertex" do
119
- expect(@myTraversal.vertex.class).to be ArangoDocument
120
- end
121
-
122
- it "collection" do
123
- expect(@myTraversal.collection.class).to be ArangoCollection
124
- end
125
- end
126
- end
127
-
128
- describe ArangoUser do
129
- context "#retrieve" do
130
- it "database" do
131
- expect(@myUser["MyDatabase"].class).to be String
132
- end
133
-
134
- it "database" do
135
- @myUser.grant database: @myDatabase
136
- expect(@myUser["MyDatabase"].class).to be ArangoDatabase
137
- end
138
-
139
- it "database" do
140
- @myUser.revoke database: @myDatabase
141
- expect(@myUser["MyDatabase"].class).to be String
142
- end
143
- end
144
- end
1
+ require_relative './../../spec_helper'
2
+
3
+ describe ArangoDatabase do
4
+ context "#retrieve" do
5
+ it "collection" do
6
+ expect(@myDatabase["MyCollection"].class).to be ArangoCollection
7
+ end
8
+
9
+ it "collection" do
10
+ expect(@myDatabase.collection("MyCollection").class).to be ArangoCollection
11
+ end
12
+
13
+ it "graph" do
14
+ expect(@myDatabase.graph("MyGraph").class).to be ArangoGraph
15
+ end
16
+ end
17
+ end
18
+
19
+ describe ArangoCollection do
20
+ context "#retrieve" do
21
+ it "document" do
22
+ expect(@myCollection["MyDocument"].class).to be ArangoDocument
23
+ end
24
+
25
+ it "database" do
26
+ expect(@myCollection.database.class).to be ArangoDatabase
27
+ end
28
+ end
29
+ end
30
+
31
+ describe ArangoDocument do
32
+ context "#retrieve" do
33
+ it "collection" do
34
+ expect(@myDocument.collection.class).to be ArangoCollection
35
+ end
36
+
37
+ it "database" do
38
+ expect(@myDocument.database.class).to be ArangoDatabase
39
+ end
40
+ end
41
+ end
42
+
43
+ describe ArangoVertex do
44
+ context "#retrieve" do
45
+ it "collection" do
46
+ expect(@myVertex.collection.class).to be ArangoCollection
47
+ end
48
+
49
+ it "database" do
50
+ expect(@myVertex.database.class).to be ArangoDatabase
51
+ end
52
+
53
+ it "graph" do
54
+ expect(@myVertex.graph.class).to be ArangoGraph
55
+ end
56
+ end
57
+ end
58
+
59
+ describe ArangoEdge do
60
+ context "#retrieve" do
61
+ it "collection" do
62
+ expect(@myEdge.collection.class).to be ArangoCollection
63
+ end
64
+
65
+ it "database" do
66
+ expect(@myEdge.database.class).to be ArangoDatabase
67
+ end
68
+
69
+ it "graph" do
70
+ expect(@myEdge.graph.class).to be ArangoGraph
71
+ end
72
+ end
73
+ end
74
+
75
+
76
+ describe ArangoGraph do
77
+ context "#retrieve" do
78
+ it "database" do
79
+ expect(@myGraph.database.class).to be ArangoDatabase
80
+ end
81
+ end
82
+ end
83
+
84
+ describe ArangoIndex do
85
+ context "#retrieve" do
86
+ it "collection" do
87
+ expect(@myIndex.collection.class).to be ArangoCollection
88
+ end
89
+
90
+ it "database" do
91
+ expect(@myIndex.database.class).to be ArangoDatabase
92
+ end
93
+ end
94
+ end
95
+
96
+ describe ArangoTask do
97
+ context "#retrieve" do
98
+ it "database" do
99
+ expect(@myTask.database.class).to be ArangoDatabase
100
+ end
101
+ end
102
+ end
103
+
104
+ describe ArangoTraversal do
105
+ context "#retrieve" do
106
+ it "database" do
107
+ @myTraversal.vertex = @myDoc[0]
108
+ @myTraversal.graph = @myGraph
109
+ @myTraversal.collection = @myEdgeCollection
110
+ @myTraversal.in
111
+ expect(@myTraversal.database.class).to be ArangoDatabase
112
+ end
113
+
114
+ it "graph" do
115
+ expect(@myTraversal.graph.class).to be ArangoGraph
116
+ end
117
+
118
+ it "vertex" do
119
+ expect(@myTraversal.vertex.class).to be ArangoDocument
120
+ end
121
+
122
+ it "collection" do
123
+ expect(@myTraversal.collection.class).to be ArangoCollection
124
+ end
125
+ end
126
+ end
127
+
128
+ describe ArangoUser do
129
+ context "#retrieve" do
130
+ it "database" do
131
+ expect(@myUser["MyDatabase"].class).to be String
132
+ end
133
+
134
+ it "database" do
135
+ @myUser.grant database: @myDatabase
136
+ expect(@myUser["MyDatabase"].class).to be ArangoDatabase
137
+ end
138
+
139
+ it "database" do
140
+ @myUser.revoke database: @myDatabase
141
+ expect(@myUser["MyDatabase"].class).to be String
142
+ end
143
+ end
144
+ end