rubydora 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -15,7 +15,7 @@ module Rubydora
15
15
  # mapping datastream attributes (and api parameters) to datastream profile names
16
16
  DS_ATTRIBUTES = {:controlGroup => :dsControlGroup, :dsLocation => :dsLocation, :altIDs => nil, :dsLabel => :dsLabel, :versionable => :dsVersionable, :dsState => :dsState, :formatURI => :dsFormatURI, :checksumType => :dsChecksumType, :checksum => :dsChecksum, :mimeType => :dsMIME, :logMessage => nil, :ignoreContent => nil, :lastModifiedDate => nil, :file => nil}
17
17
 
18
- define_attribute_methods DS_ATTRIBUTES.keys
18
+ define_attribute_methods DS_ATTRIBUTES.keys + [:content]
19
19
 
20
20
  # accessors for datastream attributes
21
21
  DS_ATTRIBUTES.each do |attribute, profile_name|
@@ -64,7 +64,10 @@ module Rubydora
64
64
  # Retrieve the content of the datastream (and cache it)
65
65
  # @return [String]
66
66
  def content
67
- @content ||= repository.datastream_dissemination :pid => pid, :dsid => dsid
67
+ begin
68
+ @content ||= repository.datastream_dissemination :pid => pid, :dsid => dsid
69
+ rescue RestClient::ResourceNotFound
70
+ end
68
71
  end
69
72
  alias_method :read, :content
70
73
 
@@ -78,6 +81,7 @@ module Rubydora
78
81
  # @param [String or IO]
79
82
  # @return [String or IO]
80
83
  def content= content
84
+ content_will_change!
81
85
  @file = content
82
86
  @content = content.dup
83
87
  @content &&= @content.read if @content.respond_to? :read
@@ -93,6 +93,13 @@ describe Rubydora::Datastream do
93
93
  @datastream.save
94
94
  end
95
95
 
96
+ it "should be marked as changed when the content is updated" do
97
+ @datastream.changed?.should be_false
98
+ @mock_repository.should_receive(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
99
+ @datastream.content = "test"
100
+ @datastream.changed?.should be_true
101
+ end
102
+
96
103
  end
97
104
 
98
105
  end
metadata CHANGED
@@ -1,156 +1,201 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubydora
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 4
10
+ version: 0.1.4
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Chris Beer
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-08-30 00:00:00.000000000 -04:00
17
+
18
+ date: 2011-10-04 00:00:00 -05:00
13
19
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: fastercsv
17
- requirement: &2160489700 !ruby/object:Gem::Requirement
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
18
23
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ name: fastercsv
23
32
  type: :runtime
24
33
  prerelease: false
25
- version_requirements: *2160489700
26
- - !ruby/object:Gem::Dependency
27
- name: rest-client
28
- requirement: &2160489140 !ruby/object:Gem::Requirement
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
29
37
  none: false
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ name: rest-client
34
46
  type: :runtime
35
47
  prerelease: false
36
- version_requirements: *2160489140
37
- - !ruby/object:Gem::Dependency
38
- name: nokogiri
39
- requirement: &2160488580 !ruby/object:Gem::Requirement
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
40
51
  none: false
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: '0'
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ name: nokogiri
45
60
  type: :runtime
46
61
  prerelease: false
47
- version_requirements: *2160488580
48
- - !ruby/object:Gem::Dependency
49
- name: mime-types
50
- requirement: &2160488140 !ruby/object:Gem::Requirement
62
+ requirement: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
51
65
  none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ name: mime-types
56
74
  type: :runtime
57
75
  prerelease: false
58
- version_requirements: *2160488140
59
- - !ruby/object:Gem::Dependency
60
- name: activesupport
61
- requirement: &2160487500 !ruby/object:Gem::Requirement
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ version_requirements: &id005 !ruby/object:Gem::Requirement
62
79
  none: false
63
- requirements:
64
- - - ! '>='
65
- - !ruby/object:Gem::Version
66
- version: '0'
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ name: activesupport
67
88
  type: :runtime
68
89
  prerelease: false
69
- version_requirements: *2160487500
70
- - !ruby/object:Gem::Dependency
71
- name: activemodel
72
- requirement: &2160482940 !ruby/object:Gem::Requirement
90
+ requirement: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ version_requirements: &id006 !ruby/object:Gem::Requirement
73
93
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ name: activemodel
78
102
  type: :runtime
79
103
  prerelease: false
80
- version_requirements: *2160482940
81
- - !ruby/object:Gem::Dependency
82
- name: savon
83
- requirement: &2160482400 !ruby/object:Gem::Requirement
104
+ requirement: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ version_requirements: &id007 !ruby/object:Gem::Requirement
84
107
  none: false
85
- requirements:
86
- - - ! '>='
87
- - !ruby/object:Gem::Version
88
- version: '0'
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ name: savon
89
116
  type: :runtime
90
117
  prerelease: false
91
- version_requirements: *2160482400
92
- - !ruby/object:Gem::Dependency
93
- name: rake
94
- requirement: &2160481860 !ruby/object:Gem::Requirement
118
+ requirement: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ version_requirements: &id008 !ruby/object:Gem::Requirement
95
121
  none: false
96
- requirements:
97
- - - ! '>='
98
- - !ruby/object:Gem::Version
99
- version: '0'
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ name: rake
100
130
  type: :development
101
131
  prerelease: false
102
- version_requirements: *2160481860
103
- - !ruby/object:Gem::Dependency
104
- name: shoulda
105
- requirement: &2160481260 !ruby/object:Gem::Requirement
132
+ requirement: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ version_requirements: &id009 !ruby/object:Gem::Requirement
106
135
  none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ name: shoulda
111
144
  type: :development
112
145
  prerelease: false
113
- version_requirements: *2160481260
114
- - !ruby/object:Gem::Dependency
115
- name: bundler
116
- requirement: &2160480780 !ruby/object:Gem::Requirement
146
+ requirement: *id009
147
+ - !ruby/object:Gem::Dependency
148
+ version_requirements: &id010 !ruby/object:Gem::Requirement
117
149
  none: false
118
- requirements:
119
- - - ! '>='
120
- - !ruby/object:Gem::Version
121
- version: '0'
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ name: bundler
122
158
  type: :development
123
159
  prerelease: false
124
- version_requirements: *2160480780
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
- requirement: &2160480220 !ruby/object:Gem::Requirement
160
+ requirement: *id010
161
+ - !ruby/object:Gem::Dependency
162
+ version_requirements: &id011 !ruby/object:Gem::Requirement
128
163
  none: false
129
- requirements:
130
- - - ! '>='
131
- - !ruby/object:Gem::Version
132
- version: '0'
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
171
+ name: rspec
133
172
  type: :development
134
173
  prerelease: false
135
- version_requirements: *2160480220
136
- - !ruby/object:Gem::Dependency
137
- name: yard
138
- requirement: &2160479760 !ruby/object:Gem::Requirement
174
+ requirement: *id011
175
+ - !ruby/object:Gem::Dependency
176
+ version_requirements: &id012 !ruby/object:Gem::Requirement
139
177
  none: false
140
- requirements:
141
- - - ! '>='
142
- - !ruby/object:Gem::Version
143
- version: '0'
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ name: yard
144
186
  type: :development
145
187
  prerelease: false
146
- version_requirements: *2160479760
147
- description: ! 'Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+'
148
- email:
188
+ requirement: *id012
189
+ description: "Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+"
190
+ email:
149
191
  - chris@cbeer.info
150
192
  executables: []
193
+
151
194
  extensions: []
195
+
152
196
  extra_rdoc_files: []
153
- files:
197
+
198
+ files:
154
199
  - .gitignore
155
200
  - Gemfile
156
201
  - LICENSE.txt
@@ -189,35 +234,38 @@ files:
189
234
  has_rdoc: true
190
235
  homepage: http://github.com/cbeer/rubydora
191
236
  licenses: []
237
+
192
238
  post_install_message:
193
239
  rdoc_options: []
194
- require_paths:
240
+
241
+ require_paths:
195
242
  - lib
196
- required_ruby_version: !ruby/object:Gem::Requirement
243
+ required_ruby_version: !ruby/object:Gem::Requirement
197
244
  none: false
198
- requirements:
199
- - - ! '>='
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- segments:
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ hash: 3
249
+ segments:
203
250
  - 0
204
- hash: -4272510233954143371
205
- required_rubygems_version: !ruby/object:Gem::Requirement
251
+ version: "0"
252
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
253
  none: false
207
- requirements:
208
- - - ! '>='
209
- - !ruby/object:Gem::Version
210
- version: '0'
211
- segments:
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ hash: 3
258
+ segments:
212
259
  - 0
213
- hash: -4272510233954143371
260
+ version: "0"
214
261
  requirements: []
262
+
215
263
  rubyforge_project:
216
264
  rubygems_version: 1.6.2
217
265
  signing_key:
218
266
  specification_version: 3
219
267
  summary: Fedora Commons REST API ruby library
220
- test_files:
268
+ test_files:
221
269
  - spec/datastream_spec.rb
222
270
  - spec/digital_object_spec.rb
223
271
  - spec/ext_model_loader_spec.rb