cmis-ruby 0.5.11 → 0.5.12

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: 9d2d4ac04b9c8fa478e27d08f3acfd0a99bd4c4a
4
- data.tar.gz: 8c50066f231536e87a56a8c38041cb65ca58d57b
3
+ metadata.gz: 8730379664b933adbdf0a0c3315a59986548966b
4
+ data.tar.gz: d7b5e6e1a2a37f8e1a910d7f3277251a0600819e
5
5
  SHA512:
6
- metadata.gz: 8f3fe2922b129273f6e1116cdb20e19939f1273e0ed49b7896ac6641449392e12faaa1e2d67d163c1ba81badba49fbe709759c86d138f11662de5153c56de2a7
7
- data.tar.gz: 28bbc75ed037c441f30a6660b01ffa4d1ecbc52857825370687056f1f7540610a73b3e69113d8c48f6afbc0f89c0267f591780824af74ad004432f3f32005ef5
6
+ metadata.gz: 5fa75b47da1f042b3d01f3ec68b31854478d22a49721df0eaca54bfd2d45011ab9e95f00d50adef63409e511455c0b58f9ab2581293eda55172eb40813ffb4bc
7
+ data.tar.gz: 20b1cc0cc493a193fbe99185845e36f75838bbcceccadfc244e5a6e21102101466959db1b6cd62e5e14683a5f2cec1d3f7c0c287a2fb86467f029bd710f140a1
@@ -1,20 +1,20 @@
1
1
  module CMIS
2
2
  module Exceptions
3
- InvalidArgument = Class.new(Exception)
4
- NotSupported = Class.new(Exception)
5
- ObjectNotFound = Class.new(Exception)
6
- PermissionDenied = Class.new(Exception)
7
- Runtime = Class.new(Exception)
8
- Constraint = Class.new(Exception)
9
- ContentAlreadyExists = Class.new(Exception)
10
- FilterNotValid = Class.new(Exception)
11
- NameConstraintViolation = Class.new(Exception)
12
- Storage = Class.new(Exception)
13
- StreamNotSupported = Class.new(Exception)
14
- UpdateConflict = Class.new(Exception)
15
- Versioning = Class.new(Exception)
3
+ InvalidArgument = Class.new(StandardError)
4
+ NotSupported = Class.new(StandardError)
5
+ ObjectNotFound = Class.new(StandardError)
6
+ PermissionDenied = Class.new(StandardError)
7
+ Runtime = Class.new(StandardError)
8
+ Constraint = Class.new(StandardError)
9
+ ContentAlreadyExists = Class.new(StandardError)
10
+ FilterNotValid = Class.new(StandardError)
11
+ NameConstraintViolation = Class.new(StandardError)
12
+ Storage = Class.new(StandardError)
13
+ StreamNotSupported = Class.new(StandardError)
14
+ UpdateConflict = Class.new(StandardError)
15
+ Versioning = Class.new(StandardError)
16
16
 
17
17
  # Non-CMIS
18
- Unauthorized = Class.new(Exception)
18
+ Unauthorized = Class.new(StandardError)
19
19
  end
20
20
  end
data/lib/cmis/object.rb CHANGED
@@ -35,13 +35,17 @@ module CMIS
35
35
  delete(opts)
36
36
  end
37
37
 
38
- def update_properties(properties, opts = {})
39
- with_change_token do
40
- server.execute!({ cmisaction: 'update',
41
- repositoryId: repository.id,
42
- objectId: cmis_object_id,
43
- properties: properties,
44
- changeToken: change_token }, opts)
38
+ def update_properties(props, opts = {})
39
+ if detached?
40
+ properties.merge!(props)
41
+ else
42
+ with_change_token do
43
+ server.execute!({ cmisaction: 'update',
44
+ repositoryId: repository.id,
45
+ objectId: cmis_object_id,
46
+ properties: props,
47
+ changeToken: change_token }, opts)
48
+ end
45
49
  end
46
50
  end
47
51
 
@@ -80,11 +80,7 @@ module CMIS
80
80
  end
81
81
 
82
82
  def create_type(type, opts = {})
83
- result = server.execute!({ cmisaction: 'createType',
84
- repositoryId: id,
85
- type: JSON.generate(type.to_hash) }, opts)
86
-
87
- Type.new(result, self)
83
+ type.create(opts)
88
84
  end
89
85
 
90
86
  def create_relationship(object, opts = {})
data/lib/cmis/type.rb CHANGED
@@ -31,11 +31,21 @@ module CMIS
31
31
  end
32
32
 
33
33
  def create(opts = {})
34
- repository.create_type(self, opts)
34
+ opts.symbolize_keys!
35
+
36
+ type_hash = to_hash
37
+ type_hash.merge!(opts.delete(:extensions) || {})
38
+
39
+ result = server.execute!({ cmisaction: 'createType',
40
+ repositoryId: repository.id,
41
+ type: JSON.generate(type_hash) }, opts)
42
+
43
+ Type.new(result, repository)
35
44
  end
36
45
 
37
46
  def update(changed_property_defs, opts = {})
38
47
  changed_property_defs.map!(&:deep_stringify_keys)
48
+ opts.symbolize_keys!
39
49
 
40
50
  new_defs = changed_property_defs.map(&:to_hash).reduce({}) do |result, element|
41
51
  result[element['id']] = element
@@ -44,6 +54,7 @@ module CMIS
44
54
 
45
55
  hash = to_hash
46
56
  hash['propertyDefinitions'] = new_defs
57
+ hash.merge!(opts.delete(:extensions) || {})
47
58
 
48
59
  result = server.execute!({ cmisaction: 'updateType',
49
60
  repositoryId: repository.id,
data/lib/cmis/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module CMIS
3
- VERSION = '0.5.11'
3
+ VERSION = '0.5.12'
4
4
  end
@@ -59,8 +59,10 @@ module CMIS
59
59
 
60
60
  describe '#unfile' do
61
61
  it 'unfiles it from the parent folder' do
62
- @document.unfile
63
- expect(@document.parents).to be_empty
62
+ if repository.capabilities['capabilityUnfiling']
63
+ @document.unfile
64
+ expect(@document.parents).to be_empty
65
+ end
64
66
  end
65
67
  end
66
68
 
@@ -1,11 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module CMIS
4
- PRIMARY_BASE_TYPES = %w( cmis:document
5
- cmis:folder
6
- cmis:relationship
7
- cmis:policy
8
- cmis:item )
4
+ PRIMARY_BASE_TYPES = [
5
+ 'cmis:document',
6
+ 'cmis:folder',
7
+ 'cmis:relationship',
8
+ # 'cmis:policy',
9
+ 'cmis:item'
10
+ ]
9
11
 
10
12
  describe Repository do
11
13
  it 'is supported by the library' do
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.11
4
+ version: 0.5.12
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-07-22 00:00:00.000000000 Z
12
+ date: 2014-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday