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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47f171c85515c4c795738a660fb29b2527d35d08
4
- data.tar.gz: c32a9251c03471ffd630d6decc55442bb8485f18
3
+ metadata.gz: 856289cf9e1f5487a8468bbdb5ce0840e871eb9f
4
+ data.tar.gz: 9a110ca5f85e0801ba036f5ee2817e0ee9ee934e
5
5
  SHA512:
6
- metadata.gz: ab5378d827738725ed2e1f4e1c3fde09e5f36cb34f55e09f5969127da3a42a905e1bf45df9de37e507254d2dcd36e8b32614c8f11bb96e0e5e8f3a08d99ae51c
7
- data.tar.gz: 1fa6e27d539787bfd05004d790f397d14d1ef800c6dc30c1af8ef5de62fe4a5e32a6238991a9db479dffbae16115b42ecac390cb65875dbd2c518a0c31d90d45
6
+ metadata.gz: 34c6c4229ea641c199f36c5582c5ecf11c7fa1f0b5093aa402d4a3a4cc0effedb5d5f6187fe34a319a5af89dbe1315c960c21e2750a324bd164910459213eead
7
+ data.tar.gz: 7be66e7907459373b7f63289eba6a4a50b80e5a366a5a94f557f066626ed5f021c3ccb73cea06d222a6a776f839b25cac5f0f6565033913de20730d61314972f
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'date'
2
3
 
3
4
  module CMIS
4
5
  class Connection
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
- clause = @properties.map { |k, v| build_predicate(k, v) }.join(' and ')
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
@@ -1,3 +1,3 @@
1
1
  module CMIS
2
- VERSION = '0.5.22'
2
+ VERSION = '0.5.23'
3
3
  end
@@ -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.22
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-07-15 00:00:00.000000000 Z
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