rubydora 0.1.6 → 0.1.7

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.6
1
+ 0.1.7
@@ -67,6 +67,7 @@ module Rubydora
67
67
  _run_initialize_callbacks do
68
68
  self.pid = pid
69
69
  @repository = repository
70
+ @new = true
70
71
 
71
72
  options.each do |key, value|
72
73
  self.send(:"#{key}=", value)
@@ -85,7 +86,8 @@ module Rubydora
85
86
  # Does this object already exist?
86
87
  # @return [Boolean]
87
88
  def new?
88
- self.profile.empty?
89
+ self.profile ### Make sure we've checked the repository at least once
90
+ @new
89
91
  end
90
92
 
91
93
  # Retrieve the object profile as a hash (and cache it)
@@ -109,9 +111,10 @@ module Rubydora
109
111
  next if key == "objModels"
110
112
  h[key] = value.first
111
113
  end
114
+ @new = false
112
115
 
113
116
  h
114
- rescue
117
+ rescue Exception => e
115
118
  {}
116
119
  end
117
120
  end
@@ -126,7 +126,7 @@ module Rubydora
126
126
  def datastream_versions options = {}
127
127
  pid = options.delete(:pid)
128
128
  dsid = options.delete(:dsid)
129
- raise "" unless dsid
129
+ raise ArgumentError, "Must supply dsid" unless dsid
130
130
  options[:format] ||= 'xml'
131
131
  client[url_for(datastream_url(pid, dsid) + "/versions", options)].get
132
132
  end
@@ -19,6 +19,13 @@ describe "Integration testing against a live Fedora repository" do
19
19
  obj.new?.should == false
20
20
  end
21
21
 
22
+ it "new should not return true until the profile is read" do
23
+ obj = @repository.find('test:1')
24
+ obj.save
25
+ new_obj = Rubydora::DigitalObject.new('test:1', @repository)
26
+ new_obj.new?.should == false
27
+ end
28
+
22
29
  it "should have default datastreams" do
23
30
  obj = @repository.find('test:1')
24
31
  obj.datastreams.keys.should include("DC")
metadata CHANGED
@@ -1,155 +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.6
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 7
10
+ version: 0.1.7
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-10-05 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: fastercsv
16
- requirement: &2169065080 !ruby/object:Gem::Requirement
17
+
18
+ date: 2011-10-14 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ name: fastercsv
22
32
  type: :runtime
23
33
  prerelease: false
24
- version_requirements: *2169065080
25
- - !ruby/object:Gem::Dependency
26
- name: rest-client
27
- requirement: &2169064620 !ruby/object:Gem::Requirement
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
28
37
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ name: rest-client
33
46
  type: :runtime
34
47
  prerelease: false
35
- version_requirements: *2169064620
36
- - !ruby/object:Gem::Dependency
37
- name: nokogiri
38
- requirement: &2169063900 !ruby/object:Gem::Requirement
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
39
51
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ name: nokogiri
44
60
  type: :runtime
45
61
  prerelease: false
46
- version_requirements: *2169063900
47
- - !ruby/object:Gem::Dependency
48
- name: mime-types
49
- requirement: &2169063060 !ruby/object:Gem::Requirement
62
+ requirement: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ version_requirements: &id004 !ruby/object:Gem::Requirement
50
65
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ name: mime-types
55
74
  type: :runtime
56
75
  prerelease: false
57
- version_requirements: *2169063060
58
- - !ruby/object:Gem::Dependency
59
- name: activesupport
60
- requirement: &2169062620 !ruby/object:Gem::Requirement
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ version_requirements: &id005 !ruby/object:Gem::Requirement
61
79
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ name: activesupport
66
88
  type: :runtime
67
89
  prerelease: false
68
- version_requirements: *2169062620
69
- - !ruby/object:Gem::Dependency
70
- name: activemodel
71
- requirement: &2169062160 !ruby/object:Gem::Requirement
90
+ requirement: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ version_requirements: &id006 !ruby/object:Gem::Requirement
72
93
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ name: activemodel
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *2169062160
80
- - !ruby/object:Gem::Dependency
81
- name: savon
82
- requirement: &2169061680 !ruby/object:Gem::Requirement
104
+ requirement: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ version_requirements: &id007 !ruby/object:Gem::Requirement
83
107
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ name: savon
88
116
  type: :runtime
89
117
  prerelease: false
90
- version_requirements: *2169061680
91
- - !ruby/object:Gem::Dependency
92
- name: rake
93
- requirement: &2169060960 !ruby/object:Gem::Requirement
118
+ requirement: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ version_requirements: &id008 !ruby/object:Gem::Requirement
94
121
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ name: rake
99
130
  type: :development
100
131
  prerelease: false
101
- version_requirements: *2169060960
102
- - !ruby/object:Gem::Dependency
103
- name: shoulda
104
- requirement: &2169060480 !ruby/object:Gem::Requirement
132
+ requirement: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ version_requirements: &id009 !ruby/object:Gem::Requirement
105
135
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ name: shoulda
110
144
  type: :development
111
145
  prerelease: false
112
- version_requirements: *2169060480
113
- - !ruby/object:Gem::Dependency
114
- name: bundler
115
- requirement: &2169060020 !ruby/object:Gem::Requirement
146
+ requirement: *id009
147
+ - !ruby/object:Gem::Dependency
148
+ version_requirements: &id010 !ruby/object:Gem::Requirement
116
149
  none: false
117
- requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
120
- version: '0'
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ name: bundler
121
158
  type: :development
122
159
  prerelease: false
123
- version_requirements: *2169060020
124
- - !ruby/object:Gem::Dependency
125
- name: rspec
126
- requirement: &2169059580 !ruby/object:Gem::Requirement
160
+ requirement: *id010
161
+ - !ruby/object:Gem::Dependency
162
+ version_requirements: &id011 !ruby/object:Gem::Requirement
127
163
  none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
171
+ name: rspec
132
172
  type: :development
133
173
  prerelease: false
134
- version_requirements: *2169059580
135
- - !ruby/object:Gem::Dependency
136
- name: yard
137
- requirement: &2169059080 !ruby/object:Gem::Requirement
174
+ requirement: *id011
175
+ - !ruby/object:Gem::Dependency
176
+ version_requirements: &id012 !ruby/object:Gem::Requirement
138
177
  none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: '0'
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ name: yard
143
186
  type: :development
144
187
  prerelease: false
145
- version_requirements: *2169059080
146
- description: ! 'Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+'
147
- email:
188
+ requirement: *id012
189
+ description: "Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+"
190
+ email:
148
191
  - chris@cbeer.info
149
192
  executables: []
193
+
150
194
  extensions: []
195
+
151
196
  extra_rdoc_files: []
152
- files:
197
+
198
+ files:
153
199
  - .gitignore
154
200
  - Gemfile
155
201
  - LICENSE.txt
@@ -185,37 +231,41 @@ files:
185
231
  - spec/rest_api_client_spec.rb
186
232
  - spec/soap_spec.rb
187
233
  - spec/spec_helper.rb
234
+ has_rdoc: true
188
235
  homepage: http://github.com/cbeer/rubydora
189
236
  licenses: []
237
+
190
238
  post_install_message:
191
239
  rdoc_options: []
192
- require_paths:
240
+
241
+ require_paths:
193
242
  - lib
194
- required_ruby_version: !ruby/object:Gem::Requirement
243
+ required_ruby_version: !ruby/object:Gem::Requirement
195
244
  none: false
196
- requirements:
197
- - - ! '>='
198
- - !ruby/object:Gem::Version
199
- version: '0'
200
- segments:
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ hash: 3
249
+ segments:
201
250
  - 0
202
- hash: -3218713441882461883
203
- required_rubygems_version: !ruby/object:Gem::Requirement
251
+ version: "0"
252
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
253
  none: false
205
- requirements:
206
- - - ! '>='
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- segments:
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ hash: 3
258
+ segments:
210
259
  - 0
211
- hash: -3218713441882461883
260
+ version: "0"
212
261
  requirements: []
262
+
213
263
  rubyforge_project:
214
- rubygems_version: 1.8.10
264
+ rubygems_version: 1.6.2
215
265
  signing_key:
216
266
  specification_version: 3
217
267
  summary: Fedora Commons REST API ruby library
218
- test_files:
268
+ test_files:
219
269
  - spec/datastream_spec.rb
220
270
  - spec/digital_object_spec.rb
221
271
  - spec/ext_model_loader_spec.rb