active_cmis 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/active_cmis/rendition.rb +15 -3
  3. metadata +32 -49
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -36,12 +36,25 @@ module ActiveCMIS
36
36
  @rel.nil?
37
37
  end
38
38
 
39
- # Returns a hash with the name of the file to which was written, the lenthe, and the content type
39
+ # Returns a hash with the name of the file to which was written, the length, and the content type
40
40
  #
41
41
  # *WARNING*: this loads the complete file in memory and dumps it at once, this should be fixed
42
42
  # @param [String] filename Location to store the content.
43
43
  # @return [Hash]
44
44
  def get_file(file_name)
45
+ response = get_data
46
+ File.open(file_name, "w") {|f| f.syswrite response.delete(:data) }
47
+ response.merge!(:file_name => file_name)
48
+ end
49
+
50
+ # Returns a hash with the data of te rendition, the length and the content type
51
+ #
52
+ # *WARNING*: this loads all the data in memory
53
+ # Possible future enhancement could be to allow a block to which data is passed in chunks?r
54
+ # Not sure that is possible with Net::HTTP though.
55
+ # @param [String] filename Location to store the content.
56
+ # @return [Hash]
57
+ def get_data
45
58
  if @url
46
59
  response = repository.conn.get_response(@url)
47
60
  status = response.code.to_i
@@ -57,9 +70,8 @@ module ActiveCMIS
57
70
  content_type = @format
58
71
  content_length = @data.length
59
72
  end
60
- File.open(file_name, "w") {|f| f.syswrite data }
61
73
 
62
- {:file => file_name, :content_type => content_type, :content_length => content_length}
74
+ {:data => data, :content_type => content_type, :content_length => content_length}
63
75
  end
64
76
  end
65
77
  end
metadata CHANGED
@@ -1,47 +1,38 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: active_cmis
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Joeri Samson
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-02-28 00:00:00 +01:00
12
+ date: 2011-03-01 00:00:00.000000000 +01:00
18
13
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
21
16
  name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 4
30
- - 1
17
+ requirement: &67303860 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
31
22
  version: 1.4.1
32
23
  type: :runtime
33
- version_requirements: *id001
34
- description: A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS.
24
+ prerelease: false
25
+ version_requirements: *67303860
26
+ description: A CMIS library implementing both reading and updating capabilities through
27
+ the AtomPub/REST binding to CMIS.
35
28
  email: joeri@xaop.com
36
29
  executables: []
37
-
38
30
  extensions: []
39
-
40
- extra_rdoc_files:
31
+ extra_rdoc_files:
41
32
  - LICENSE
42
33
  - README.md
43
34
  - TODO
44
- files:
35
+ files:
45
36
  - LICENSE
46
37
  - README.md
47
38
  - Rakefile
@@ -73,34 +64,26 @@ files:
73
64
  has_rdoc: true
74
65
  homepage: http://xaop.com/labs/activecmis/
75
66
  licenses: []
76
-
77
67
  post_install_message:
78
68
  rdoc_options: []
79
-
80
- require_paths:
69
+ require_paths:
81
70
  - lib
82
- required_ruby_version: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- segments:
87
- - 1
88
- - 8
89
- - 6
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
90
76
  version: 1.8.6
91
- required_rubygems_version: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- segments:
96
- - 0
97
- version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
98
83
  requirements: []
99
-
100
84
  rubyforge_project:
101
- rubygems_version: 1.3.6
85
+ rubygems_version: 1.5.3
102
86
  signing_key:
103
87
  specification_version: 3
104
88
  summary: A library to interact with CMIS repositories through the AtomPub/REST binding
105
89
  test_files: []
106
-