active_cmis 0.3.3 → 0.3.4
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/AUTHORS +9 -0
- data/README.md +11 -5
- data/active_cmis.gemspec +3 -2
- data/lib/active_cmis/document.rb +63 -11
- data/lib/active_cmis/internal/caching.rb +2 -2
- data/lib/active_cmis/internal/connection.rb +1 -1
- data/lib/active_cmis/rendition.rb +1 -1
- data/lib/active_cmis/version.rb +1 -1
- metadata +9 -8
data/AUTHORS
ADDED
data/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
# ActiveCMIS Release 0.3.
|
|
2
|
-
**Homepage**: <http://xaop.com/labs/activecmis>
|
|
1
|
+
# ActiveCMIS Release 0.3.4 #
|
|
3
2
|
**Git**: <http://github.com/xaop/activecmis>
|
|
4
3
|
**Documentation**: <http://rdoc.info/github/xaop/activecmis/master/frames>
|
|
5
|
-
**Author**: XAOP bvba
|
|
4
|
+
**Author**: XAOP bvba
|
|
6
5
|
**Copyright**: 2011
|
|
7
6
|
**License**: MIT License
|
|
8
7
|
## Synopsis ##
|
|
@@ -12,6 +11,15 @@ ActiveCMIS is Ruby library aimed at easing the interaction with various CMIS pro
|
|
|
12
11
|
- Write support and the ability to create new objects.
|
|
13
12
|
- Support for paging
|
|
14
13
|
|
|
14
|
+
## Changes since 0.3.3 ##
|
|
15
|
+
- added #set_versioning_state for documents (thanks to @zedtux)
|
|
16
|
+
- improve checking method to make more parameters optional (and use set_versioning_state when possible)
|
|
17
|
+
|
|
18
|
+
## Changes since 0.3.2 ##
|
|
19
|
+
- Fix for header of PUT request (thanks to @linzhixing)
|
|
20
|
+
- Improvement for integer conversion (thanks to @kennethgeerts)
|
|
21
|
+
- Correctly set the default namespace (reported by @brunospy)
|
|
22
|
+
|
|
15
23
|
## Changes since 0.3.1 ##
|
|
16
24
|
- Does not require ntlm-http unless needed for authentication
|
|
17
25
|
- Fix some issues with authentication (thanks to @beno)
|
|
@@ -39,5 +47,3 @@ If you actually need NTLM authentication you can use https://github.com/xaop/ntl
|
|
|
39
47
|
And so on ...
|
|
40
48
|
|
|
41
49
|
Full documentation of the API can be found at [rdoc.info](http://rdoc.info/projects/xaop/activecmis)
|
|
42
|
-
|
|
43
|
-
A tutorial can be found at [the xaop site](http://xaop.com/labs/activecmis "tutorial")
|
data/active_cmis.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "active_cmis"
|
|
8
|
-
s.version = "0.3.
|
|
8
|
+
s.version = "0.3.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Joeri Samson"]
|
|
12
|
-
s.date = "2013-
|
|
12
|
+
s.date = "2013-06-11"
|
|
13
13
|
s.description = "A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS."
|
|
14
14
|
s.email = "joeri@xaop.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
"TODO"
|
|
19
19
|
]
|
|
20
20
|
s.files = [
|
|
21
|
+
"AUTHORS",
|
|
21
22
|
"LICENSE",
|
|
22
23
|
"README.md",
|
|
23
24
|
"Rakefile",
|
data/lib/active_cmis/document.rb
CHANGED
|
@@ -65,6 +65,25 @@ module ActiveCMIS
|
|
|
65
65
|
@updated_contents = options
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
# Sets versioning state.
|
|
69
|
+
# Only possible on new documents, or PWC documents
|
|
70
|
+
#
|
|
71
|
+
# @param ["major", "minor", "none", "checkedout"] state A string of the desired versioning state
|
|
72
|
+
#
|
|
73
|
+
# @return [void]
|
|
74
|
+
def set_versioning_state(state)
|
|
75
|
+
raise Error::Constraint.new("Can only set a different version state on PWC documents, or unsaved new documents") unless key.nil? || working_copy?
|
|
76
|
+
raise ArgumentError, "You must pass a String" unless state.is_a?(String)
|
|
77
|
+
if key.nil?
|
|
78
|
+
possible_values = %w[major minor none checkedout]
|
|
79
|
+
else
|
|
80
|
+
possible_values = %w[major minor]
|
|
81
|
+
end
|
|
82
|
+
raise ArgumentError, "Given state is invalid. Possible values are #{possible_values.join(", ")}" unless possible_values.include?(state)
|
|
83
|
+
|
|
84
|
+
@versioning_state = state
|
|
85
|
+
end
|
|
86
|
+
|
|
68
87
|
# Returns all documents in the version series of this document.
|
|
69
88
|
# Uses self to represent the version of this document
|
|
70
89
|
# @return [Collection<Document>, Array(self)]
|
|
@@ -180,21 +199,58 @@ module ActiveCMIS
|
|
|
180
199
|
end
|
|
181
200
|
end
|
|
182
201
|
|
|
183
|
-
#
|
|
184
|
-
#
|
|
202
|
+
# @overload checkin(major, comment = "", updated_attributes = {})
|
|
203
|
+
# Check in the private working copy. Raises a constraint error when the
|
|
204
|
+
# document is not a working copy
|
|
185
205
|
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
|
|
206
|
+
# @param [Boolean] major Whether the document will be checked in as a major version
|
|
207
|
+
# @param [String] comment An optional comment to use when creating the new version
|
|
208
|
+
# @param [Hash] updated_attributes A hash with updated attributes
|
|
209
|
+
# @return [Document] The final version that results from the checkin
|
|
210
|
+
# @overload checkin(comment = "", updated_attributes = {})
|
|
211
|
+
# Check in the private working copy. Raises a constraint error when the
|
|
212
|
+
# document is not a working copy
|
|
213
|
+
# The version will be the version set by set_versioning_state (default is
|
|
214
|
+
# a major version)
|
|
215
|
+
#
|
|
216
|
+
# @param [String] comment An optional comment to use when creating the new version
|
|
217
|
+
# @param [Hash] updated_attributes A hash with updated attributes
|
|
218
|
+
# @return [Document] The final version that results from the checkin
|
|
219
|
+
# @overload checkin(updated_attributes = {})
|
|
220
|
+
# Check in the private working copy with an empty message.
|
|
221
|
+
# Raises a constraint error when the document is not a working copy
|
|
222
|
+
# The version will be the version set by set_versioning_state (default is
|
|
223
|
+
# a major version)
|
|
224
|
+
#
|
|
225
|
+
# @param [Hash] updated_attributes A hash with updated attributes
|
|
226
|
+
# @return [Document] The final version that results from the checkin
|
|
227
|
+
def checkin(*options)
|
|
228
|
+
if options.length > 3
|
|
229
|
+
raise ArgumentError, "Too many arguments for checkin"
|
|
230
|
+
else
|
|
231
|
+
major, comment, updated_attributes = *options
|
|
232
|
+
if Boolean === major
|
|
233
|
+
# Nothing changes: only defaults need to be filled in (if necessary)
|
|
234
|
+
elsif String === major
|
|
235
|
+
updated_attributes = comment
|
|
236
|
+
comment = major
|
|
237
|
+
# major will be true if: @versioning_state == "major", or if it's not set
|
|
238
|
+
major = @versioning_state != "minor"
|
|
239
|
+
end
|
|
240
|
+
comment ||= ""
|
|
241
|
+
updated_attributes ||= {}
|
|
242
|
+
end
|
|
243
|
+
|
|
189
244
|
if working_copy?
|
|
190
245
|
update(updated_attributes)
|
|
191
246
|
result = self
|
|
192
247
|
updated_aspects([true, major, comment]).each do |hash|
|
|
193
248
|
result = result.send(hash[:message], *hash[:parameters])
|
|
194
249
|
end
|
|
250
|
+
@versioning_state = nil
|
|
195
251
|
result
|
|
196
252
|
else
|
|
197
|
-
raise "Not a working copy"
|
|
253
|
+
raise Error::Constraint, "Not a working copy"
|
|
198
254
|
end
|
|
199
255
|
end
|
|
200
256
|
|
|
@@ -261,11 +317,7 @@ module ActiveCMIS
|
|
|
261
317
|
def create_url
|
|
262
318
|
if f = parent_folders.first
|
|
263
319
|
url = f.items.url
|
|
264
|
-
|
|
265
|
-
url
|
|
266
|
-
else
|
|
267
|
-
Internal::Utils.append_parameters(url, "versioningState" => "none")
|
|
268
|
-
end
|
|
320
|
+
Internal::Utils.append_parameters(url, "versioningState" => (self.class.versionable ? (@versioning_state || "major") : "none"))
|
|
269
321
|
else
|
|
270
322
|
raise Error::NotSupported.new("Creating an unfiled document is not supported by CMIS")
|
|
271
323
|
# Can't create documents that are unfiled, CMIS does not support it (note this means exceptions should not actually be NotSupported)
|
|
@@ -11,7 +11,7 @@ module ActiveCMIS
|
|
|
11
11
|
# Creates a proxy method for the given method names that caches the result.
|
|
12
12
|
#
|
|
13
13
|
# Parameters are passed and ignored, cached values will be returned regardless of the parameters.
|
|
14
|
-
# @param [Symbol, <Symbol>] Names of methods that will be cached
|
|
14
|
+
# @param [Symbol, <Symbol>] names Names of methods that will be cached
|
|
15
15
|
# @return [void]
|
|
16
16
|
def cache(*names)
|
|
17
17
|
(@cached_methods ||= []).concat(names).uniq!
|
|
@@ -41,7 +41,7 @@ module ActiveCMIS
|
|
|
41
41
|
#
|
|
42
42
|
# If the given attribute does not yet exist the method #load_from_data will be called
|
|
43
43
|
#
|
|
44
|
-
# @param [Symbol, <Symbol>] Names of desired attributes
|
|
44
|
+
# @param [Symbol, <Symbol>] names Names of desired attributes
|
|
45
45
|
# @return [void]
|
|
46
46
|
def cached_reader(*names)
|
|
47
47
|
(@cached_methods ||= []).concat(names).uniq!
|
|
@@ -7,7 +7,7 @@ module ActiveCMIS
|
|
|
7
7
|
# @return [Logger] A logger used to send debug and info messages
|
|
8
8
|
attr_reader :logger
|
|
9
9
|
|
|
10
|
-
# @param [Logger] Initialize with a logger of your choice
|
|
10
|
+
# @param [Logger] logger Initialize with a logger of your choice
|
|
11
11
|
def initialize(logger)
|
|
12
12
|
@logger = logger || ActiveCMIS.default_logger
|
|
13
13
|
end
|
|
@@ -42,7 +42,7 @@ module ActiveCMIS
|
|
|
42
42
|
# Returns a hash with the name of the file to which was written, the length, and the content type
|
|
43
43
|
#
|
|
44
44
|
# *WARNING*: this loads the complete file in memory and dumps it at once, this should be fixed
|
|
45
|
-
# @param [String]
|
|
45
|
+
# @param [String] file_name Location to store the content.
|
|
46
46
|
# @return [Hash]
|
|
47
47
|
def get_file(file_name)
|
|
48
48
|
response = get_data
|
data/lib/active_cmis/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_cmis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70212875587800 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: 1.4.1
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70212875587800
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: ntlm-http
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70212872366220 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: 0.1.1
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70212872366220
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: require_relative
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70212872387680 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ~>
|
|
@@ -43,7 +43,7 @@ dependencies:
|
|
|
43
43
|
version: 1.0.2
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70212872387680
|
|
47
47
|
description: A CMIS library implementing both reading and updating capabilities through
|
|
48
48
|
the AtomPub/REST binding to CMIS.
|
|
49
49
|
email: joeri@xaop.com
|
|
@@ -54,6 +54,7 @@ extra_rdoc_files:
|
|
|
54
54
|
- README.md
|
|
55
55
|
- TODO
|
|
56
56
|
files:
|
|
57
|
+
- AUTHORS
|
|
57
58
|
- LICENSE
|
|
58
59
|
- README.md
|
|
59
60
|
- Rakefile
|