cmis-ruby 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c85de59348d7d68b1ac987ff4a92a3a2599d1688
4
- data.tar.gz: e2a07a45fe8c8fd066a3a1ef18fb341cfbc36d88
3
+ metadata.gz: 6a5b7dba3bdd82dff165929d23c3fe1a57079cd7
4
+ data.tar.gz: 3ce7e1681ce8334146de701205207f80ff000062
5
5
  SHA512:
6
- metadata.gz: 281f082357a490cd9e1e01ac7491b59c31d257bb5db42e29f4da3f9952ee0f65d4f3f71db052ac274897c25ed5cd356c6c0090c2daaab7d5eaf1962d224ad89f
7
- data.tar.gz: 595f089c12c975ed27a8860e33104ce4a6b3c340c46408176b39dcfce8ca992fc4fbe94e0ecce5cc78c3995d557a5356f808bf0a8032ac62b83bb68d3a2a5240
6
+ metadata.gz: ebc9804922b1fcaa162a8c761559675b5fe0cad122b35a6fab78220cff8a3ff6eb40f44e0094985118f7d07855c0d2efe21d03483ac7632e8a826c2338540173
7
+ data.tar.gz: 9ed41c507a6dee6f03f582a350bd70c60ad6693f24b84a128b987450769f4b1f44e355495b688804cc246bfc16ee352a83ae729ac7e341c0d6904b0797fd8f61
data/lib/cmis/document.rb CHANGED
@@ -49,6 +49,11 @@ module CMIS
49
49
  end
50
50
  end
51
51
 
52
+ def content_url
53
+ root_folder_url = server.connection.send(:infer_url, repository.id, true)
54
+ "#{root_folder_url}?cmisselector=content&objectId=#{cmis_object_id}"
55
+ end
56
+
52
57
  def content=(opts = {})
53
58
  opts.symbolize_keys!
54
59
  content = { stream: opts.delete(:stream),
@@ -115,7 +115,7 @@ module CMIS
115
115
 
116
116
  def count_objects(type_id, properties = {}, opts = {})
117
117
  opts.merge!(page_size: 0)
118
- statement = Utils.build_query_statement(type_id, properties)
118
+ statement = Utils.build_query_statement(type_id, properties, 'cmis:objectId')
119
119
  query(statement, opts).total
120
120
  end
121
121
 
data/lib/cmis/server.rb CHANGED
@@ -4,6 +4,10 @@ module CMIS
4
4
  @options = options.symbolize_keys
5
5
  end
6
6
 
7
+ def connection
8
+ @connection ||= Connection.new(@options)
9
+ end
10
+
7
11
  def execute!(params = {}, options = {})
8
12
  params.symbolize_keys!
9
13
 
@@ -43,10 +47,6 @@ module CMIS
43
47
 
44
48
  private
45
49
 
46
- def connection
47
- @connection ||= Connection.new(@options)
48
- end
49
-
50
50
  def marshal_dump
51
51
  @options
52
52
  end
data/lib/cmis/utils.rb CHANGED
@@ -2,18 +2,20 @@ module CMIS
2
2
  module Utils
3
3
  module_function
4
4
 
5
- def build_query_statement(type_id, properties)
6
- QueryStatementBuilder.new(type_id, properties).build
5
+ def build_query_statement(type_id, properties, *queried_properties)
6
+ QueryStatementBuilder.new(type_id, properties, queried_properties).build
7
7
  end
8
8
 
9
9
  class QueryStatementBuilder
10
- def initialize(type_id, properties)
10
+ def initialize(type_id, properties, queried_properties)
11
11
  @type_id = type_id
12
12
  @properties = properties
13
+ @queried_properties = Array(queried_properties).join(', ')
14
+ @queried_properties = '*' if @queried_properties.empty?
13
15
  end
14
16
 
15
17
  def build
16
- statement = "select * from #{@type_id}"
18
+ statement = "select #{@queried_properties} from #{@type_id}"
17
19
  clause = @properties.map { |k, v| "#{k}=#{normalize(v)}" }.join(' and ')
18
20
  statement << " where #{clause}" unless clause.empty?
19
21
  statement
data/lib/cmis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CMIS
2
- VERSION = '0.5.6'
2
+ VERSION = '0.5.7'
3
3
  end
@@ -77,6 +77,9 @@ module CMIS
77
77
  document = repository.new_document
78
78
  document.name = 'test_document'
79
79
  document.object_type_id = 'cmis:document'
80
+ document.content = { stream: 'Apple is a fruit',
81
+ mime_type: 'text/plain',
82
+ filename: 'apple.txt' }
80
83
  repository.root.create(document)
81
84
  end
82
85
  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.6
4
+ version: 0.5.7
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: 2014-06-05 00:00:00.000000000 Z
12
+ date: 2014-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday