cmis-ruby 0.5.22 → 0.5.23
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/lib/cmis/connection/request_modifier.rb +1 -0
- data/lib/cmis/utils.rb +11 -1
- data/lib/cmis/version.rb +1 -1
- data/spec/cmis-ruby/utils_spec.rb +19 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 856289cf9e1f5487a8468bbdb5ce0840e871eb9f
|
4
|
+
data.tar.gz: 9a110ca5f85e0801ba036f5ee2817e0ee9ee934e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c6c4229ea641c199f36c5582c5ecf11c7fa1f0b5093aa402d4a3a4cc0effedb5d5f6187fe34a319a5af89dbe1315c960c21e2750a324bd164910459213eead
|
7
|
+
data.tar.gz: 7be66e7907459373b7f63289eba6a4a50b80e5a366a5a94f557f066626ed5f021c3ccb73cea06d222a6a776f839b25cac5f0f6565033913de20730d61314972f
|
data/lib/cmis/utils.rb
CHANGED
@@ -15,8 +15,18 @@ module CMIS
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def build
|
18
|
+
sec_types = @properties.select { |k, v| v.is_a? Hash }.keys
|
18
19
|
statement = "select #{@queried_properties} from #{@type_id}"
|
19
|
-
|
20
|
+
if sec_types.first # TODO Support multiple secondary types
|
21
|
+
statement << " join #{sec_types.first} as X on cmis:objectId = X.cmis:objectId"
|
22
|
+
end
|
23
|
+
clause = @properties.map do |k, v|
|
24
|
+
if v.is_a? Hash
|
25
|
+
v.map { |kk, vv| build_predicate(kk, vv) }
|
26
|
+
else
|
27
|
+
build_predicate(k, v)
|
28
|
+
end
|
29
|
+
end.flatten.join(' and ')
|
20
30
|
statement << " where #{clause}" unless clause.empty?
|
21
31
|
statement
|
22
32
|
end
|
data/lib/cmis/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CMIS
|
4
|
+
describe Utils do
|
5
|
+
describe '#build_query_statement' do
|
6
|
+
def qs(*args)
|
7
|
+
CMIS::Utils.build_query_statement(*args)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'builds the correct query statement' do
|
11
|
+
expect(qs('T', {})).to eq 'select * from T'
|
12
|
+
expect(qs('T', foo: 'bar')).to eq "select * from T where foo = 'bar'"
|
13
|
+
expect(qs('T', bar: 'baz', pif: 'poef')).to eq "select * from T where bar = 'baz' and pif = 'poef'"
|
14
|
+
expect(qs('T', foo: { bar: 'baz', pif: 'poef' })).to eq "select * from T join foo as X on cmis:objectId = X.cmis:objectId where bar = 'baz' and pif = 'poef'"
|
15
|
+
expect(qs('T', a: 'b', c: 'd', foo: { bar: 'baz', pif: 'poef' })).to eq "select * from T join foo as X on cmis:objectId = X.cmis:objectId where a = 'b' and c = 'd' and bar = 'baz' and pif = 'poef'"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmis-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Geerts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- spec/cmis-ruby/relationship_spec.rb
|
90
90
|
- spec/cmis-ruby/repository_spec.rb
|
91
91
|
- spec/cmis-ruby/server_spec.rb
|
92
|
+
- spec/cmis-ruby/utils_spec.rb
|
92
93
|
- spec/config.yml
|
93
94
|
- spec/rspec.opts
|
94
95
|
- spec/spec_helper.rb
|
@@ -124,6 +125,7 @@ test_files:
|
|
124
125
|
- spec/cmis-ruby/relationship_spec.rb
|
125
126
|
- spec/cmis-ruby/repository_spec.rb
|
126
127
|
- spec/cmis-ruby/server_spec.rb
|
128
|
+
- spec/cmis-ruby/utils_spec.rb
|
127
129
|
- spec/config.yml
|
128
130
|
- spec/rspec.opts
|
129
131
|
- spec/spec_helper.rb
|