active_cmis 0.3.2 → 0.3.3
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/active_cmis.gemspec +2 -2
- data/lib/active_cmis/atomic_types.rb +2 -2
- data/lib/active_cmis/document.rb +8 -6
- data/lib/active_cmis/object.rb +9 -9
- data/lib/active_cmis/version.rb +1 -1
- metadata +8 -8
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.3"
|
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 = "
|
12
|
+
s.date = "2013-05-08"
|
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 = [
|
@@ -89,14 +89,14 @@ module ActiveCMIS
|
|
89
89
|
value.text.to_i
|
90
90
|
end
|
91
91
|
def _rb2cmis(xml, value)
|
92
|
-
v = value.
|
92
|
+
v = value.to_i
|
93
93
|
if (min_value && v < min_value) || (max_value && v > max_value)
|
94
94
|
raise Error::InvalidArgument.new("OutOfBounds: #{v} should be between #{min_value} and #{max_value}")
|
95
95
|
end
|
96
96
|
xml["c"].value("%i" % v)
|
97
97
|
end
|
98
98
|
def can_handle?(value)
|
99
|
-
value.respond_to?(:
|
99
|
+
value.respond_to?(:to_i)
|
100
100
|
end
|
101
101
|
|
102
102
|
private :_cmis2rb, :_rb2cmis
|
data/lib/active_cmis/document.rb
CHANGED
@@ -233,12 +233,14 @@ module ActiveCMIS
|
|
233
233
|
|
234
234
|
result = super
|
235
235
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
236
|
+
if !key.nil? && !updated_contents.nil?
|
237
|
+
if checkin
|
238
|
+
# Update the content stream before checking in
|
239
|
+
result.unshift(:message => :save_content_stream, :parameters => [updated_contents])
|
240
|
+
else
|
241
|
+
# TODO: check that the content stream is updateable
|
242
|
+
result << {:message => :save_content_stream, :parameters => [updated_contents]}
|
243
|
+
end
|
242
244
|
end
|
243
245
|
|
244
246
|
result
|
data/lib/active_cmis/object.rb
CHANGED
@@ -346,15 +346,15 @@ module ActiveCMIS
|
|
346
346
|
def render_atom_entry(properties = self.class.attributes, attributes = self.attributes, options = {})
|
347
347
|
builder = Nokogiri::XML::Builder.new do |xml|
|
348
348
|
xml.entry(NS::COMBINED) do
|
349
|
-
xml.parent.
|
350
|
-
xml
|
351
|
-
xml
|
349
|
+
xml.parent.default_namespace = NS::COMBINED["xmlns:at"]
|
350
|
+
xml.author do
|
351
|
+
xml.name conn.user # FIXME: find reliable way to set author?
|
352
352
|
end
|
353
|
-
xml
|
353
|
+
xml.title attributes["cmis:name"]
|
354
354
|
if attributes["cmis:objectId"]
|
355
|
-
xml
|
355
|
+
xml.id_ attributes["cmis:objectId"]
|
356
356
|
else
|
357
|
-
xml
|
357
|
+
xml.id_ "random-garbage"
|
358
358
|
end
|
359
359
|
xml["cra"].object do
|
360
360
|
xml["c"].properties do
|
@@ -398,7 +398,7 @@ module ActiveCMIS
|
|
398
398
|
|
399
399
|
if result.empty? && checkin
|
400
400
|
# NOTE: this needs some thinking through: in particular this may not work well if there would be an updated content stream
|
401
|
-
result << {:message => :save_attributes, :parameters => [
|
401
|
+
result << {:message => :save_attributes, :parameters => [{}, {}, checkin]}
|
402
402
|
end
|
403
403
|
|
404
404
|
result
|
@@ -433,7 +433,7 @@ module ActiveCMIS
|
|
433
433
|
if attributes.empty? && checkin.nil?
|
434
434
|
raise "Error: saving attributes but nothing to do"
|
435
435
|
end
|
436
|
-
properties = self.class.attributes.
|
436
|
+
properties = self.class.attributes.select {|key,_| updated_attributes.include?(key)}
|
437
437
|
body = render_atom_entry(properties, values, :checkin => checkin)
|
438
438
|
|
439
439
|
if checkin.nil?
|
@@ -457,7 +457,7 @@ module ActiveCMIS
|
|
457
457
|
end
|
458
458
|
|
459
459
|
uri = self_link(parameters)
|
460
|
-
response = conn.put(uri, body)
|
460
|
+
response = conn.put(uri, body, "Content-Type" => "application/atom+xml;type=entry")
|
461
461
|
|
462
462
|
data = Nokogiri::XML.parse(response, nil, nil, Nokogiri::XML::ParseOptions::STRICT).xpath("at:entry", NS::COMBINED)
|
463
463
|
if data.xpath("cra:object/c:properties/c:propertyId[@propertyDefinitionId = 'cmis:objectId']/c:value", NS::COMBINED).text == id
|
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.3
|
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:
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70197899383240 !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: *70197899383240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ntlm-http
|
27
|
-
requirement: &
|
27
|
+
requirement: &70197899382120 !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: *70197899382120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: require_relative
|
38
|
-
requirement: &
|
38
|
+
requirement: &70197899381480 !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: *70197899381480
|
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
|