arangorb 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +1 -1
- data/README.md +43 -20
- data/lib/Replication.rb +4 -2
- data/lib/Server.rb +26 -6
- data/lib/arangorb.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9682380a2dafba5778de976c70914176d480a738
|
4
|
+
data.tar.gz: 45635e45b4586a361b2bad070d0e74e33bd5460f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e041b73e5f7cabb3a50308efd1d759a3e2304f61ae9e8bbea0e79dcdaf614263e6dc518fb7e2a8608f3f946f023d4d19da9d41ae196f48d04ca91b05df8632
|
7
|
+
data.tar.gz: 3f4a43a9ef26271c7971642e6b582d5638cbcc639ffb9576bcb67438537cb279e6fae9743d37e9ee838b85ba2413d1d9d39a71dc3d27ef03729674bb065ad66a
|
data/ArangoRB.gemspec
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@ ArangoRB [![Gem Version](https://badge.fury.io/rb/arangorb.svg)](https://badge.f
|
|
2
2
|
===============================
|
3
3
|
|
4
4
|
[ArangoDatabase](https://www.arangodb.com/) is a native multi-model database with flexible data models for document, graphs, and key-values.
|
5
|
-
ArangoRB is a Gem to use ArangoDatabase with Ruby. ArangoRB is based on the [HTTP API of ArangoDB](https://docs.arangodb.com/3.
|
5
|
+
ArangoRB is a Gem to use ArangoDatabase with Ruby. ArangoRB is based on the [HTTP API of ArangoDB](https://docs.arangodb.com/3.4/HTTP/index.html).
|
6
6
|
|
7
7
|
ArangoRB 0.1.0 - 1.3.0 have been tested with ArangoDB 3.0 with Ruby 2.3.1</br>
|
8
8
|
ArangoRB 1.4.0 has been tested with ArangoDB 3.1 with Ruby 2.3.3</br>
|
@@ -14,34 +14,23 @@ To install ArangoRB: `gem install arangorb`
|
|
14
14
|
|
15
15
|
To use it in your application: `require "arangorb"`
|
16
16
|
|
17
|
-
## Differences between version 1.4 and 2.0
|
18
|
-
|
19
|
-
ArangoRB 1.4 and ArangoRB 2.0 are not compatible.
|
20
|
-
The new version provide different improvements.
|
21
|
-
* Now all the instances are in a module Arango. This means that previous classes like Arango::Server will become Arango::Server.
|
22
|
-
* Arango::Server is now an instance. This means that ArangoRB 2.0 will permits to use different servers.
|
23
|
-
* ArangoRB has implemented connection_pool
|
24
|
-
* ArangoRB has now a better implementation of Cache
|
25
|
-
* The returned values are returned with symbols as keys
|
26
|
-
* Oj is used for parsing instead of JSON
|
27
|
-
* Add supports for View and Foxx. The least is untested.
|
28
|
-
* Better hierarchy handling between the different instances. For example now myDocument.database will return the database instance that includes the document.
|
29
|
-
* Better handling of replication (untested)
|
30
|
-
* Clean in general the code (for future easier maintance)
|
31
|
-
* Now errors are handled by Arango::Error
|
32
|
-
|
33
17
|
## Support
|
34
18
|
|
35
19
|
This is a project managed by one single person. ArangoDB is a wonderful project that it is hard to cover completely alone. For this reason all your supports is more than welcome.
|
36
20
|
Any pull request, issue, suggestions and ideas are more than welcome. Do not be shy to contact me, create issues on Github or pushing changes.
|
37
21
|
|
38
22
|
Here something the community can help on:
|
23
|
+
* Replication example in example/replication_year.rb is a work in progress. Any found bugs and advice to improve it will be great. I removed the IPs in the examples to make clear that it is only an example that needs work.
|
39
24
|
* Add test and correct bugs for replication, clustering, foxx and other.
|
40
25
|
* Improve AQL instance to implement in Rails.
|
41
26
|
* Improve Documentation.
|
42
27
|
|
43
28
|
If you like this project, please star it. It will remind me that my work has been useful for somebody.
|
44
29
|
|
30
|
+
For the differences between version 1.4.0 and 2.0.0: [Click here](#differences).
|
31
|
+
|
32
|
+
For testing: [Click here](#testing).
|
33
|
+
|
45
34
|
## Classes used
|
46
35
|
|
47
36
|
ArangoRB has the two type of classes.
|
@@ -84,11 +73,12 @@ To setup a server use the following way:
|
|
84
73
|
|
85
74
|
``` ruby
|
86
75
|
server = Arango::Server.new username: "MyUsername", password: "MyPassword",
|
87
|
-
server: "localhost", port: "8529"
|
76
|
+
server: "localhost", port: "8529", tls: false
|
88
77
|
server.username = "MyOtherUsername" # Default "root"
|
89
78
|
server.password = "other_password"
|
90
79
|
server.server = "127.0.0.1" # Default "localhost"
|
91
80
|
server.port = "8765" # Default "8529"
|
81
|
+
server.tls = true # Default false, to do https requests instead of http
|
92
82
|
```
|
93
83
|
|
94
84
|
Password is a mandatory field.
|
@@ -124,7 +114,7 @@ ArangoRB supports connection pool, to activate it you can setup pool to true dur
|
|
124
114
|
|
125
115
|
``` ruby
|
126
116
|
server = Arango::Server.new username: "MyUsername", password: "MyPassword",
|
127
|
-
server: "localhost", port: "8529", pool: true, size: 5, timeout: 5
|
117
|
+
server: "localhost", port: "8529", pool: true, size: 5, timeout: 5, tls: false
|
128
118
|
server.pool = true # Defult false
|
129
119
|
server.size = 7 # Default 5
|
130
120
|
server.timeout = 10 # Default 5
|
@@ -677,7 +667,8 @@ myGraph.replaceEdgeCollections collection: "myEdgeCollection", from: "myCollecti
|
|
677
667
|
myGraph.removeEdgeCollections collection: "myEdgeCollection" # Remove an Edge Collection to our Graph
|
678
668
|
```
|
679
669
|
|
680
|
-
<a name="ArangoVertex"></a
|
670
|
+
<a name="ArangoVertex"></a>
|
671
|
+
<a name="ArangoEdge"></a>
|
681
672
|
## Arango::Vertex and Arango::Edge
|
682
673
|
|
683
674
|
Both these two classes inherit the class Arango::Document.
|
@@ -1077,3 +1068,35 @@ rescue Arango::Error => e
|
|
1077
1068
|
e.to_h # Hash version of the error
|
1078
1069
|
end
|
1079
1070
|
```
|
1071
|
+
|
1072
|
+
<a name="testing"></a>
|
1073
|
+
## Testing
|
1074
|
+
|
1075
|
+
To test ArangoRB you can use:
|
1076
|
+
|
1077
|
+
``` ruby
|
1078
|
+
rspec spec/arangoRB_helper.rb
|
1079
|
+
ruby examples/year.rb
|
1080
|
+
ruby examples/year2.rb
|
1081
|
+
```
|
1082
|
+
|
1083
|
+
Remember however the following:
|
1084
|
+
* Setup the correct server in lib/spec_helper.rb and in the examples
|
1085
|
+
* The test examples/year2.rb should run much after the test examples/year.rb, since the last test is dependent from the conclusion of the first test (that is running in async).
|
1086
|
+
|
1087
|
+
<a name="differences"></a>
|
1088
|
+
## Differences between version 1.4 and 2.0
|
1089
|
+
|
1090
|
+
ArangoRB 1.4 and ArangoRB 2.0 are not compatible.
|
1091
|
+
The new version provide different improvements.
|
1092
|
+
* Now all the instances are in a module Arango. This means that previous classes like ArangoServer will become Arango::Server.
|
1093
|
+
* Arango::Server is now an instance. This means that ArangoRB 2.0 will permits to use different servers.
|
1094
|
+
* ArangoRB has implemented connection_pool.
|
1095
|
+
* ArangoRB has now a better implementation of Cache.
|
1096
|
+
* The returned values are returned with symbols as keys.
|
1097
|
+
* Oj is used for parsing instead of JSON.
|
1098
|
+
* Add supports for View and Foxx. The least is untested.
|
1099
|
+
* Better hierarchy handling between the different instances. For example now myDocument.database will return the database instance that includes the document.
|
1100
|
+
* Better handling of replication (untested).
|
1101
|
+
* Clean in general the code (for future maintainer).
|
1102
|
+
* Now errors are handled by Arango::Error.
|
data/lib/Replication.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Arango
|
4
4
|
class Replication
|
5
|
+
include Arango::Helper_Error
|
6
|
+
|
5
7
|
def initialize(master:, slave:, includeSystem: true,
|
6
8
|
initialSyncMaxWaitTime: nil, incremental: nil,
|
7
9
|
restrictCollections: nil, connectTimeout: nil,
|
@@ -54,7 +56,7 @@ module Arango
|
|
54
56
|
|
55
57
|
def restrictType=(restrictType)
|
56
58
|
satisfy_category?(restrictType, ["include", "exclude", nil])
|
57
|
-
@restrictType =
|
59
|
+
@restrictType = restrictType
|
58
60
|
end
|
59
61
|
alias assign_restrictType restrictType=
|
60
62
|
|
@@ -200,7 +202,7 @@ module Arango
|
|
200
202
|
}
|
201
203
|
@slave.request("PUT", "_api/replication/applier-config", body: body)
|
202
204
|
end
|
203
|
-
alias modifyReplication
|
205
|
+
alias modifyReplication modify
|
204
206
|
|
205
207
|
# LOGGER
|
206
208
|
|
data/lib/Server.rb
CHANGED
@@ -5,8 +5,13 @@ module Arango
|
|
5
5
|
include Arango::Helper_Error
|
6
6
|
|
7
7
|
def initialize(username: "root", password:, server: "localhost",
|
8
|
-
warning: true, port: "8529", verbose: false, return_output: false,
|
9
|
-
|
8
|
+
warning: true, port: "8529", verbose: false, return_output: false,
|
9
|
+
async: false, active_cache: false, pool: false, size: 5, timeout: 5,
|
10
|
+
tls: false)
|
11
|
+
@tls = tls
|
12
|
+
@base_uri = "http"
|
13
|
+
@base_uri += "s" if tls
|
14
|
+
@base_uri += "://#{server}:#{port}"
|
10
15
|
@server = server
|
11
16
|
@port = port
|
12
17
|
@username = username
|
@@ -32,7 +37,7 @@ module Arango
|
|
32
37
|
# === DEFINE ===
|
33
38
|
|
34
39
|
attr_reader :async, :port, :server, :base_uri, :username, :cache,
|
35
|
-
:verbose, :return_output, :active_cache, :pool
|
40
|
+
:verbose, :return_output, :active_cache, :pool, :password, :tls
|
36
41
|
attr_accessor :warning, :size, :timeout
|
37
42
|
|
38
43
|
def active_cache=(active)
|
@@ -89,13 +94,26 @@ module Arango
|
|
89
94
|
|
90
95
|
def port=(port)
|
91
96
|
@port = port
|
92
|
-
@base_uri = "http
|
97
|
+
@base_uri = "http"
|
98
|
+
@base_uri += "s" if @tls
|
99
|
+
@base_uri += "://#{@server}:#{@port}"
|
93
100
|
@request.base_uri = @base_uri
|
94
101
|
end
|
95
102
|
|
96
103
|
def server=(server)
|
97
104
|
@server = server
|
98
|
-
@base_uri = "http
|
105
|
+
@base_uri = "http"
|
106
|
+
@base_uri += "s" if @tls
|
107
|
+
@base_uri += "://#{@server}:#{@port}"
|
108
|
+
@request.base_uri = @base_uri
|
109
|
+
end
|
110
|
+
|
111
|
+
def tls=(tls)
|
112
|
+
satisfy_category?(tls, [false, true])
|
113
|
+
@tls = tls
|
114
|
+
@base_uri = "http"
|
115
|
+
@base_uri += "s" if @tls
|
116
|
+
@base_uri += "://#{@server}:#{@port}"
|
99
117
|
@request.base_uri = @base_uri
|
100
118
|
end
|
101
119
|
|
@@ -128,8 +146,10 @@ module Arango
|
|
128
146
|
"async": @async,
|
129
147
|
"verbose": @verbose,
|
130
148
|
"return_output": @return_output,
|
131
|
-
"warning": @warning
|
149
|
+
"warning": @warning,
|
150
|
+
"tls": @tls
|
132
151
|
}.delete_if{|k,v| v.nil?}
|
152
|
+
hash
|
133
153
|
end
|
134
154
|
|
135
155
|
# === REQUESTS ===
|
data/lib/arangorb.rb
CHANGED
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: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|