active_cmis 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  t.options = ["--default-return", "::Object", "--query", "!@private", "--hide-void-return"]
10
10
  end
11
11
  rescue LoadError
12
- puts "Yard, or a dependency, not available. Install it with gem install jeweler"
12
+ puts "Yard, or a dependency, not available. Install it with gem install yard"
13
13
  end
14
14
 
15
15
  begin
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.1.10
@@ -143,7 +143,7 @@ module ActiveCMIS
143
143
 
144
144
  private
145
145
  def self_link(options = {})
146
- Internal::Utils.add_parameters(@self_link, options)
146
+ Internal::Utils.append_parameters(@self_link, options)
147
147
  end
148
148
 
149
149
  def conn
@@ -48,8 +48,6 @@ module ActiveCMIS
48
48
  repository.authenticate(auth_type, user_name, password)
49
49
  end
50
50
  return repository
51
- elsif config.nil?
52
- raise "Configuration not found in file"
53
51
  else
54
52
  raise "Configuration does not have correct format (not a hash)"
55
53
  end
@@ -77,8 +75,11 @@ module ActiveCMIS
77
75
 
78
76
  config = YAML.load_file(file)
79
77
  if config.is_a? Hash
80
- config = config[config_name]
81
- connect(config[config_name])
78
+ if config = config[config_name]
79
+ connect(config)
80
+ else
81
+ raise "Configuration not found in file"
82
+ end
82
83
  else
83
84
  raise "Configuration file does not have right format (not a hash)"
84
85
  end
@@ -130,7 +130,7 @@ module ActiveCMIS
130
130
  to_a.reverse
131
131
  end
132
132
 
133
- # @return [void]
133
+ ## @return [void]
134
134
  def reload
135
135
  @pages = []
136
136
  @elements = []
@@ -138,6 +138,37 @@ module ActiveCMIS
138
138
  __reload
139
139
  end
140
140
 
141
+ # Attempts to delete the collection.
142
+ # This may not work on every collection, ActiveCMIS does not (yet) try to check this client side.
143
+ #
144
+ # For folder collections 2 options are available, again no client side checking
145
+ # is done to see whether the collection can handle these options
146
+ #
147
+ # @param [Hash] options
148
+ # @option options [String] :unfileObjects Parameter valid for items collection of folder
149
+ # "delete" (default): Delete all fileable objects
150
+ # "unfile": unfile all fileable objects
151
+ # "deleteSingleFiled": Delete all fileable objects, whose only parent folder is the current folder. Unfile all other objects from this folder
152
+ # @option options [Bool] :continueOnFailure default = false, if false abort on failure of single document/folder, else try to continue with deleting child folders/documents
153
+ def destroy(options = {})
154
+ if options.empty?
155
+ conn.delete(@url)
156
+ else
157
+ unfileObjects = options.delete(:unfileObjects)
158
+ continueOnFailure = options.delete(:continueOnFailure)
159
+ raise ArgumentError("Unknown parameters #{options.keys.join(', ')}") unless options.empty?
160
+
161
+
162
+ # XXX: have less cumbersome code, more generic and more efficient code
163
+ new_url = @url
164
+ new_url = Internal::Utils.append_parameters(new_url, :unfileObjects => unfileObjects) unless unfileObjects.nil?
165
+ new_url = Internal::Utils.append_parameters(new_url, :continueOnFailure => continueOnFailure) unless continueOnFailure.nil?
166
+
167
+ # TODO: check that we can handle 200,202,204 responses correctly
168
+ conn.delete(@url)
169
+ end
170
+ end
171
+
141
172
  private
142
173
 
143
174
  def sanitize_index(index)
@@ -77,6 +77,15 @@ module ActiveCMIS
77
77
  handle_request(uri, req)
78
78
  end
79
79
 
80
+ # @private
81
+ def delete(url, headers = {})
82
+ uri = normalize_url(url)
83
+
84
+ req = Net::HTTP::Put.new(uri.request_uri)
85
+ headers.each {|k,v| req.add_field k, v}
86
+ handle_request(uri, req)
87
+ end
88
+
80
89
  # @private
81
90
  def post(url, body, headers = {})
82
91
  uri = normalize_url(url)
@@ -288,6 +288,15 @@ module ActiveCMIS
288
288
  end
289
289
  end
290
290
 
291
+ # Tries to delete the object
292
+ # To delete all versions of a Document try #all_versions.delete
293
+ #
294
+ # For policies this may just remove the policy from the policy group
295
+ # of a document, this depends on how you retrieved the policy. Be careful
296
+ def destroy
297
+ conn.delete(self_link)
298
+ end
299
+
291
300
  private
292
301
  # Internal value, not meant for common-day use
293
302
  # @private
metadata CHANGED
@@ -1,89 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: active_cmis
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.9
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.1.10
6
6
  platform: ruby
7
- authors:
8
- - Joeri Samson
7
+ authors:
8
+ - Joeri Samson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-03-09 00:00:00.000000000 +01:00
12
+
13
+ date: 2011-04-06 00:00:00 +02:00
13
14
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: nokogiri
17
- requirement: &69652550 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: 1.4.1
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: *69652550
26
- description: A CMIS library implementing both reading and updating capabilities through
27
- the AtomPub/REST binding to CMIS.
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: nokogiri
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.4.1
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS.
28
28
  email: joeri@xaop.com
29
29
  executables: []
30
+
30
31
  extensions: []
31
- extra_rdoc_files:
32
- - LICENSE
33
- - README.md
34
- - TODO
35
- files:
36
- - LICENSE
37
- - README.md
38
- - Rakefile
39
- - TODO
40
- - VERSION
41
- - lib/active_cmis.rb
42
- - lib/active_cmis/acl.rb
43
- - lib/active_cmis/acl_entry.rb
44
- - lib/active_cmis/active_cmis.rb
45
- - lib/active_cmis/atomic_types.rb
46
- - lib/active_cmis/attribute_prefix.rb
47
- - lib/active_cmis/collection.rb
48
- - lib/active_cmis/document.rb
49
- - lib/active_cmis/exceptions.rb
50
- - lib/active_cmis/folder.rb
51
- - lib/active_cmis/internal/caching.rb
52
- - lib/active_cmis/internal/connection.rb
53
- - lib/active_cmis/internal/utils.rb
54
- - lib/active_cmis/ns.rb
55
- - lib/active_cmis/object.rb
56
- - lib/active_cmis/policy.rb
57
- - lib/active_cmis/property_definition.rb
58
- - lib/active_cmis/rel.rb
59
- - lib/active_cmis/relationship.rb
60
- - lib/active_cmis/rendition.rb
61
- - lib/active_cmis/repository.rb
62
- - lib/active_cmis/server.rb
63
- - lib/active_cmis/type.rb
32
+
33
+ extra_rdoc_files:
34
+ - LICENSE
35
+ - README.md
36
+ - TODO
37
+ files:
38
+ - LICENSE
39
+ - README.md
40
+ - Rakefile
41
+ - TODO
42
+ - VERSION
43
+ - lib/active_cmis.rb
44
+ - lib/active_cmis/acl.rb
45
+ - lib/active_cmis/acl_entry.rb
46
+ - lib/active_cmis/active_cmis.rb
47
+ - lib/active_cmis/atomic_types.rb
48
+ - lib/active_cmis/attribute_prefix.rb
49
+ - lib/active_cmis/collection.rb
50
+ - lib/active_cmis/document.rb
51
+ - lib/active_cmis/exceptions.rb
52
+ - lib/active_cmis/folder.rb
53
+ - lib/active_cmis/internal/caching.rb
54
+ - lib/active_cmis/internal/connection.rb
55
+ - lib/active_cmis/internal/utils.rb
56
+ - lib/active_cmis/ns.rb
57
+ - lib/active_cmis/object.rb
58
+ - lib/active_cmis/policy.rb
59
+ - lib/active_cmis/property_definition.rb
60
+ - lib/active_cmis/rel.rb
61
+ - lib/active_cmis/relationship.rb
62
+ - lib/active_cmis/rendition.rb
63
+ - lib/active_cmis/repository.rb
64
+ - lib/active_cmis/server.rb
65
+ - lib/active_cmis/type.rb
64
66
  has_rdoc: true
65
67
  homepage: http://xaop.com/labs/activecmis/
66
68
  licenses: []
69
+
67
70
  post_install_message:
68
71
  rdoc_options: []
69
- require_paths:
70
- - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
72
76
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: 1.8.6
77
- required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.8.6
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
82
  none: false
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
83
87
  requirements: []
88
+
84
89
  rubyforge_project:
85
- rubygems_version: 1.5.3
90
+ rubygems_version: 1.5.1
86
91
  signing_key:
87
92
  specification_version: 3
88
93
  summary: A library to interact with CMIS repositories through the AtomPub/REST binding
89
94
  test_files: []
95
+