orientdb4r 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/orientdb4r/client.rb +4 -1
- data/lib/orientdb4r/rest/client.rb +3 -2
- data/lib/orientdb4r/rest/model.rb +6 -0
- data/lib/orientdb4r/version.rb +1 -0
- data/orientdb4r.gemspec +1 -0
- data/test/test_database.rb +10 -0
- data/test/test_ddo.rb +4 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837cd8b67b6cae12cd3cbba07a03cfa444c7b4f2
|
4
|
+
data.tar.gz: d53bade090415bee1e561c15d90c410a18095635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc1e3a22f4af160726b1a2fc6d320e08abc1330b544b338f4224c9e4a60c6d4f4fad6ce58877331bf350d9d11b50089c9f89892a837303e44573f78a09bad06e
|
7
|
+
data.tar.gz: 9c8f9a858f9d5d88d461bc8edd277290f845cb2c5af9a3f0a0c9298f6c53a8841b9c2cb523437ac3ee05d635cb4cffcef2944dec90cb346b514ca7a30391e5d9
|
data/README.rdoc
CHANGED
@@ -24,7 +24,7 @@ see Wiki page for more sample at https://github.com/veny/orientdb4r/wiki
|
|
24
24
|
client.database_exists? :database => DB, :user => 'admin', :password => 'admin'
|
25
25
|
=> false
|
26
26
|
|
27
|
-
client.create_database :database => DB, :
|
27
|
+
client.create_database :database => DB, :storage => :memory, :user => 'root', :password => 'root'
|
28
28
|
=> false
|
29
29
|
|
30
30
|
client.connect :database => DB, :user => 'admin', :password => 'admin'
|
data/lib/orientdb4r/client.rb
CHANGED
@@ -68,6 +68,9 @@ module Orientdb4r
|
|
68
68
|
# Creates a new database.
|
69
69
|
# You can provide an additional authentication to the server with 'database.create' resource
|
70
70
|
# or the current one will be used.
|
71
|
+
# *options
|
72
|
+
# *storage - 'memory' (by default) or 'local'
|
73
|
+
# *type - 'document' (by default) or 'graph'
|
71
74
|
def create_database(options)
|
72
75
|
raise NotImplementedError, 'this should be overridden by concrete client'
|
73
76
|
end
|
@@ -240,7 +243,7 @@ module Orientdb4r
|
|
240
243
|
raise ArgumentError, "property name is blank" if blank?(property)
|
241
244
|
opt_pattern = {
|
242
245
|
:mandatory => :optional , :notnull => :optional, :min => :optional, :max => :optional,
|
243
|
-
:
|
246
|
+
:readonly => :optional, :linked_class => :optional
|
244
247
|
}
|
245
248
|
verify_options(options, opt_pattern)
|
246
249
|
|
@@ -148,12 +148,13 @@ module Orientdb4r
|
|
148
148
|
|
149
149
|
def create_database(options) #:nodoc:
|
150
150
|
options_pattern = {
|
151
|
-
:database => :mandatory, :
|
151
|
+
:database => :mandatory, :storage => :memory, :type => :document,
|
152
152
|
:user => :optional, :password => :optional
|
153
153
|
}
|
154
154
|
verify_and_sanitize_options(options, options_pattern)
|
155
|
+
verify_options(options.select {|k,v| k === :storage or k === :type}, {:storage => [:memory, :local], :type => [:document, :graph]})
|
155
156
|
|
156
|
-
params = { :method => :post, :uri => "database/#{options[:database]}/#{options[:type].to_s}" }
|
157
|
+
params = { :method => :post, :uri => "database/#{options[:database]}/#{options[:storage].to_s}/#{options[:type].to_s}" }
|
157
158
|
params[:no_session] = true # out of existing session which represents an already done authentication
|
158
159
|
|
159
160
|
# additional authentication allowed, overriden in 'call_server' if not defined
|
@@ -98,6 +98,12 @@ module Orientdb4r
|
|
98
98
|
get_mandatory_attribute :notNull
|
99
99
|
end
|
100
100
|
|
101
|
+
###
|
102
|
+
# Gets the 'read-only' flag.
|
103
|
+
def read_only
|
104
|
+
get_mandatory_attribute :readonly
|
105
|
+
end
|
106
|
+
|
101
107
|
###
|
102
108
|
# Gets linked class if the property is a link.
|
103
109
|
def linked_class
|
data/lib/orientdb4r/version.rb
CHANGED
@@ -2,6 +2,7 @@ module Orientdb4r
|
|
2
2
|
|
3
3
|
# Version history.
|
4
4
|
VERSION_HISTORY = [
|
5
|
+
['0.4.1', '2013-09-03', "Enh #24 (read-only class), #26 (type of new database), #27 (license in gemspec)"],
|
5
6
|
['0.4.0', '2013-08-14', "Closed gap between this driver and OrientDB v1.4.0+; Enh #20, BF #25"],
|
6
7
|
['0.3.3', '2012-12-16', "Enh #18 ('abstract' option into creating a new class), Enh #19 (GET - List Databases)"],
|
7
8
|
['0.3.2', '2012-11-02', "Enh #13 (User-Agent), Enh #16 (configurable Recover Time in Load Balancing)"],
|
data/orientdb4r.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.require_paths = ['lib']
|
29
29
|
s.rubygems_version = %q{1.3.7}
|
30
30
|
s.summary = %q{Ruby binding for Orient DB.}
|
31
|
+
s.license = 'Apache License, v2.0'
|
31
32
|
|
32
33
|
s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
|
33
34
|
# s.add_development_dependency(%q<json>, ["~> 1.5.1"])
|
data/test/test_database.rb
CHANGED
@@ -67,6 +67,10 @@ class TestDatabase < Test::Unit::TestCase
|
|
67
67
|
###
|
68
68
|
# CREATE DATABASE
|
69
69
|
def test_create_database
|
70
|
+
# bad options
|
71
|
+
assert_raise ArgumentError do @client.create_database(:database => 'UniT', :storage => :foo); end
|
72
|
+
assert_raise ArgumentError do @client.create_database(:database => 'UniT', :type => :foo); end
|
73
|
+
|
70
74
|
assert_nothing_thrown do
|
71
75
|
@client.create_database :database => 'UniT', :user => 'root', :password => 'root'
|
72
76
|
end
|
@@ -88,6 +92,12 @@ class TestDatabase < Test::Unit::TestCase
|
|
88
92
|
@client.connect :database => 'UniT', :user => 'admin', :password => 'admin'
|
89
93
|
end
|
90
94
|
@client.delete_database({:database => 'UniT', :user => 'root', :password => 'root'})
|
95
|
+
|
96
|
+
# create non-default DB: storage=local;type=graph
|
97
|
+
assert_nothing_thrown do
|
98
|
+
@client.create_database :database => 'UniT', :user => 'root', :password => 'root', :storage => :local, :type => :graph
|
99
|
+
@client.delete_database :database => 'UniT', :user => 'root', :password => 'root'
|
100
|
+
end
|
91
101
|
end
|
92
102
|
|
93
103
|
|
data/test/test_ddo.rb
CHANGED
@@ -110,7 +110,6 @@ class TestDdo < Test::Unit::TestCase
|
|
110
110
|
assert_raise Orientdb4r::NotFoundError do @client.get_class(CLASS); end # no info more
|
111
111
|
# the class is not visible in class list delivered by connect
|
112
112
|
db_info = @client.get_database
|
113
|
-
puts db_info['classes'].class
|
114
113
|
assert db_info['classes'].select { |i| i.name == CLASS }.empty?
|
115
114
|
|
116
115
|
# CLASS extends super_class
|
@@ -163,7 +162,7 @@ puts db_info['classes'].class
|
|
163
162
|
assert_nothing_thrown do
|
164
163
|
@client.create_class(CLASS) do |c|
|
165
164
|
c.property 'prop1', :integer
|
166
|
-
c.property 'prop2', :string, :mandatory => true, :notnull => true, :min => 1, :max => 99
|
165
|
+
c.property 'prop2', :string, :mandatory => true, :notnull => true, :readonly => true, :min => 1, :max => 99
|
167
166
|
c.link 'user', :linkset, 'OUser', :mandatory => true
|
168
167
|
end
|
169
168
|
end
|
@@ -175,6 +174,7 @@ puts db_info['classes'].class
|
|
175
174
|
assert_equal 'INTEGER', prop1.type
|
176
175
|
assert !prop1.mandatory
|
177
176
|
assert !prop1.not_null
|
177
|
+
assert !prop1.read_only
|
178
178
|
assert_nil prop1.min
|
179
179
|
assert_nil prop1.max
|
180
180
|
assert_nil prop1.linked_class
|
@@ -183,6 +183,7 @@ puts db_info['classes'].class
|
|
183
183
|
assert_equal 'STRING', prop2.type
|
184
184
|
assert prop2.mandatory
|
185
185
|
assert prop2.not_null
|
186
|
+
assert prop2.read_only
|
186
187
|
assert_equal '1', prop2.min
|
187
188
|
assert_equal '99', prop2.max
|
188
189
|
assert_nil prop2.linked_class
|
@@ -191,6 +192,7 @@ puts db_info['classes'].class
|
|
191
192
|
assert_equal 'LINKSET', user.type
|
192
193
|
assert user.mandatory
|
193
194
|
assert !user.not_null
|
195
|
+
assert !user.read_only
|
194
196
|
assert_nil user.min
|
195
197
|
assert_nil user.max
|
196
198
|
assert_equal 'OUser', user.linked_class
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orientdb4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vaclav Sykora
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -71,7 +71,8 @@ files:
|
|
71
71
|
- test/test_loadbalancing.rb
|
72
72
|
- test/test_utils.rb
|
73
73
|
homepage: http://github.com/veny/orientdb4r
|
74
|
-
licenses:
|
74
|
+
licenses:
|
75
|
+
- Apache License, v2.0
|
75
76
|
metadata: {}
|
76
77
|
post_install_message:
|
77
78
|
rdoc_options:
|