arangorb 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +1 -1
- data/README.md +26 -1
- data/lib/ArangoRB_AQL.rb +30 -60
- data/lib/ArangoRB_Col.rb +89 -258
- data/lib/ArangoRB_DB.rb +18 -90
- data/lib/ArangoRB_Doc.rb +46 -45
- data/lib/ArangoRB_Edg.rb +48 -57
- data/lib/ArangoRB_Gra.rb +66 -105
- data/lib/ArangoRB_Index.rb +41 -72
- data/lib/ArangoRB_Ser.rb +21 -65
- data/lib/ArangoRB_Task.rb +33 -57
- data/lib/ArangoRB_Tra.rb +31 -35
- data/lib/ArangoRB_Tran.rb +17 -15
- data/lib/ArangoRB_User.rb +54 -71
- data/lib/ArangoRB_Ver.rb +48 -57
- data/spec/arangoRB_helper.rb +1 -0
- data/spec/lib/0.1.0/arangoC_helper.rb +2 -2
- data/spec/lib/0.1.0/arangoDoc_helper.rb +1 -1
- data/spec/lib/0.1.0/arangoE_helper.rb +1 -1
- data/spec/lib/0.1.0/arangoS_helper.rb +3 -3
- data/spec/lib/0.1.0/arangoT_helper.rb +4 -4
- data/spec/lib/0.1.0/arangoV_helper.rb +1 -1
- data/spec/lib/1.0.0/arangoDB_helper.rb +0 -33
- data/spec/lib/1.0.0/arangoS_helper.rb +1 -1
- data/spec/lib/1.0.0/arangoTa_helper.rb +1 -1
- data/spec/lib/1.0.0/arangoTr_helper.rb +1 -1
- data/spec/lib/1.1.0/arangoRB_helper.rb +144 -0
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +18 -0
- data/spec/lib/arangoRB_1.1.0_helper.rb +2 -0
- data/spec/spec_helper.rb +1 -0
- metadata +5 -3
@@ -4,7 +4,7 @@ describe ArangoVertex do
|
|
4
4
|
context "#new" do
|
5
5
|
it "create a new Document instance without global" do
|
6
6
|
myVertex = ArangoVertex.new collection: "MyCollection", database: "MyDatabase", graph: "MyGraph"
|
7
|
-
expect(myVertex.collection).to eq "MyCollection"
|
7
|
+
expect(myVertex.collection.name).to eq "MyCollection"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "create a new instance with global" do
|
@@ -1,39 +1,6 @@
|
|
1
1
|
require_relative './../../spec_helper'
|
2
2
|
|
3
3
|
describe ArangoDatabase do
|
4
|
-
# context "#async" do
|
5
|
-
# it "pendingAsync" do
|
6
|
-
# ArangoServer.async = "store"
|
7
|
-
# ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
8
|
-
# expect(@myDatabase.pendingAsync).to eq []
|
9
|
-
# end
|
10
|
-
#
|
11
|
-
# it "fetchAsync" do
|
12
|
-
# ArangoServer.async = "store"
|
13
|
-
# id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
14
|
-
# expect(@myDatabase.fetchAsync(id: id)["count"]).to eq 18
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# it "retrieveAsync" do
|
18
|
-
# ArangoServer.async = "store"
|
19
|
-
# ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
20
|
-
# expect(@myDatabase.retrievePendingAsync).to eq []
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# it "cancelAsync" do
|
24
|
-
# ArangoServer.async = "store"
|
25
|
-
# id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
26
|
-
# expect(@myDatabase.cancelAsync(id: id)).to eq "not found"
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# it "destroyAsync" do
|
30
|
-
# ArangoServer.async = "store"
|
31
|
-
# id = ArangoAQL.new(query: "FOR u IN MyCollection RETURN u.num").execute
|
32
|
-
# expect(@myDatabase.destroyAsync type: id).to be true
|
33
|
-
# end
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
|
37
4
|
context "#replication" do
|
38
5
|
it "inventory" do
|
39
6
|
expect(@myDatabase.inventory["collections"].class).to be Array
|
@@ -29,7 +29,7 @@ describe ArangoTask do
|
|
29
29
|
it "retrieve lists" do
|
30
30
|
myArangoTask = ArangoTask.new name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo2" => "bar2", "bar2" => "foo2"}, period: 2
|
31
31
|
myArangoTask.create
|
32
|
-
result = ArangoTask.tasks.map{|x| x.database}
|
32
|
+
result = ArangoTask.tasks.map{|x| x.database.name}
|
33
33
|
expect(result.include? 'MyDatabase').to be true
|
34
34
|
end
|
35
35
|
|
@@ -4,7 +4,7 @@ describe ArangoTransaction do
|
|
4
4
|
context "#new and use" do
|
5
5
|
it "create new instance" do
|
6
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]).to eq "MyCollection"
|
7
|
+
expect(myArangoTransaction.collections["write"][0].name).to eq "MyCollection"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "execute" do
|
@@ -0,0 +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
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative './../../spec_helper'
|
2
|
+
|
3
|
+
describe ArangoDatabase do
|
4
|
+
context "#retrieve" do
|
5
|
+
it "walk" do
|
6
|
+
print "#{@myDatabase.name}\n"
|
7
|
+
print "#{@myDatabase['MyCollection'].name}\n"
|
8
|
+
print "#{@myDatabase['MyCollection'].documents.map{|x| x.name}}\n"
|
9
|
+
print "#{@myDatabase['MyCollection']["FirstKey"].name}\n"
|
10
|
+
print "#{@myDatabase['MyCollection'][@myDatabase['MyCollection']["FirstKey"]].name}\n"
|
11
|
+
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection").map{|x| x.name}}\n"
|
12
|
+
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
|
13
|
+
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database.name}\n"
|
14
|
+
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
|
15
|
+
expect(@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]).to eq 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -29,6 +29,7 @@ RSpec.configure do |config|
|
|
29
29
|
@myIndex = @myCollection.createIndex unique: false, fields: "num", type: "hash", id: "MyIndex"
|
30
30
|
@myTraversal = ArangoTraversal.new
|
31
31
|
@myUser = ArangoUser.new.create
|
32
|
+
@myTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 60
|
32
33
|
end
|
33
34
|
|
34
35
|
config.after(:all) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arangorb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -74,8 +74,11 @@ files:
|
|
74
74
|
- spec/lib/1.0.0/arangoTa_helper.rb
|
75
75
|
- spec/lib/1.0.0/arangoTr_helper.rb
|
76
76
|
- spec/lib/1.0.0/arangoU_helper.rb
|
77
|
+
- spec/lib/1.1.0/arangoRB_helper.rb
|
78
|
+
- spec/lib/1.1.0/arangoRB_walks_helper.rb
|
77
79
|
- spec/lib/arangoRB_0.1.0_helper.rb
|
78
80
|
- spec/lib/arangoRB_1.0.0_helper.rb
|
81
|
+
- spec/lib/arangoRB_1.1.0_helper.rb
|
79
82
|
- spec/spec_helper.rb
|
80
83
|
homepage: https://github.com/StefanoMartin/ArangoRB
|
81
84
|
licenses:
|
@@ -102,4 +105,3 @@ signing_key:
|
|
102
105
|
specification_version: 4
|
103
106
|
summary: A simple ruby client for ArangoDB
|
104
107
|
test_files: []
|
105
|
-
has_rdoc:
|