orientdb4r 0.2.2 → 0.2.3
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.
- data/lib/orientdb4r/rest/client.rb +9 -3
- data/lib/orientdb4r/version.rb +1 -0
- data/test/test_ddo.rb +2 -0
- data/test/test_dmo.rb +5 -1
- data/test/test_document_crud.rb +1 -0
- metadata +2 -2
|
@@ -58,11 +58,14 @@ module Orientdb4r
|
|
|
58
58
|
begin
|
|
59
59
|
response = @resource['disconnect'].get
|
|
60
60
|
rescue ::RestClient::Unauthorized
|
|
61
|
-
|
|
61
|
+
# https://groups.google.com/forum/?fromgroups#!topic/orient-database/5MAMCvFavTc
|
|
62
|
+
# Disconnect doesn't require you're authenticated.
|
|
63
|
+
# It always returns 401 because some browsers intercept this and avoid to reuse the same session again.
|
|
62
64
|
ensure
|
|
63
65
|
@connected = false
|
|
64
66
|
@user = nil
|
|
65
67
|
@password = nil
|
|
68
|
+
Orientdb4r::logger.debug 'disconnected from server'
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
|
|
@@ -126,8 +129,11 @@ module Orientdb4r
|
|
|
126
129
|
raise ArgumentError, 'query is blank' if blank? sql
|
|
127
130
|
|
|
128
131
|
response = @resource["query/#{@database}/sql/#{CGI::escape(sql)}"].get
|
|
129
|
-
|
|
130
|
-
rslt['result']
|
|
132
|
+
entries = process_response(response)
|
|
133
|
+
rslt = entries['result']
|
|
134
|
+
# mixin all document entries (they have '@class' attribute)
|
|
135
|
+
rslt.each { |doc| doc.extend Orientdb4r::DocumentMetadata unless doc['@class'].nil? }
|
|
136
|
+
rslt
|
|
131
137
|
end
|
|
132
138
|
|
|
133
139
|
|
data/lib/orientdb4r/version.rb
CHANGED
|
@@ -2,6 +2,7 @@ module Orientdb4r
|
|
|
2
2
|
|
|
3
3
|
# Version history.
|
|
4
4
|
VERSION_HISTORY = [
|
|
5
|
+
['0.2.3', '2012-06-24', "Documents received by a query are kind of Orientdb4r::DocumentMetadata"],
|
|
5
6
|
# https://groups.google.com/forum/?fromgroups#!topic/orient-database/jK4EZd068AE
|
|
6
7
|
# https://groups.google.com/forum/?fromgroups#!topic/orient-database/nJOAsgwSnKI
|
|
7
8
|
['0.2.2', '2012-06-23', "Added support for server version detection [r5913]"],
|
data/test/test_ddo.rb
CHANGED
|
@@ -44,6 +44,7 @@ class TestDdo < Test::Unit::TestCase
|
|
|
44
44
|
assert_instance_of Array, clazz.clusters
|
|
45
45
|
assert !clazz.clusters.empty?
|
|
46
46
|
assert_not_nil clazz.default_cluster
|
|
47
|
+
assert clazz.kind_of? Orientdb4r::OClass
|
|
47
48
|
# test Property
|
|
48
49
|
prop = clazz.property :password
|
|
49
50
|
assert_equal 'password', prop.name
|
|
@@ -52,6 +53,7 @@ class TestDdo < Test::Unit::TestCase
|
|
|
52
53
|
assert prop.not_null
|
|
53
54
|
assert_nil prop.min
|
|
54
55
|
assert_nil prop.min
|
|
56
|
+
assert prop.kind_of? Orientdb4r::Property
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
|
data/test/test_dmo.rb
CHANGED
|
@@ -60,7 +60,11 @@ class TestDmo < Test::Unit::TestCase
|
|
|
60
60
|
@client.command "INSERT INTO #{CLASS} (prop1, prop2, friends) VALUES (#{i}, 'string#{i}', [#{@admin['@rid']}])"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
entries = @client.query("SELECT FROM #{CLASS}")
|
|
64
|
+
assert_instance_of Array, entries
|
|
65
|
+
assert_equal 10, entries.size
|
|
66
|
+
entries.each { |doc| assert doc.kind_of? Orientdb4r::DocumentMetadata }
|
|
67
|
+
|
|
64
68
|
assert_equal 1, @client.query("SELECT FROM #{CLASS} WHERE prop1 = 1").size
|
|
65
69
|
assert_equal 0, @client.query("SELECT FROM #{CLASS} WHERE prop1 = 11").size
|
|
66
70
|
# graph
|
data/test/test_document_crud.rb
CHANGED
|
@@ -79,6 +79,7 @@ class TestDocumentCrud < Test::Unit::TestCase
|
|
|
79
79
|
assert_equal 1, doc['prop1']
|
|
80
80
|
assert_equal 'text', doc['prop2']
|
|
81
81
|
assert_nil doc['unknown_property']
|
|
82
|
+
assert doc.kind_of? Orientdb4r::DocumentMetadata
|
|
82
83
|
|
|
83
84
|
# not existing RID
|
|
84
85
|
rid1 = rid.sub(/[0-9]+$/, (rid.split(':')[1].to_i + 1).to_s) # '#6:0' > '#6:1' or '#6:11' > '#6:12'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: orientdb4r
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-06-
|
|
12
|
+
date: 2012-06-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|