cirneco 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cirneco/utils.rb +8 -14
- data/lib/cirneco/version.rb +1 -1
- data/lib/cirneco/work.rb +0 -6
- data/spec/work_spec.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f55d250fbc2819ba6dcb0e149578dfae54d66f
|
4
|
+
data.tar.gz: c2901c9c035c9e90733446082cbc792ad21a024f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16557958449568427784eafa7c5c19ddc02330d44cacc7a65ccd887e8f4ac732a094c77210d5f638c9cd77b05879f3dfa2fcac0e423449a0131a5a23efa7cc9
|
7
|
+
data.tar.gz: 0ecc5a7b6c286de088191953894f41a11e6acd401925a8337c0bf32f4987d6c96dd6ece1f36f224544620038406108f1632beca6aca845db867731b30c6809c7
|
data/Gemfile.lock
CHANGED
data/lib/cirneco/utils.rb
CHANGED
@@ -192,13 +192,10 @@ module Cirneco
|
|
192
192
|
def register_work_for_metadata(metadata)
|
193
193
|
work = Cirneco::Work.new(metadata)
|
194
194
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
puts work.validation_errors
|
200
|
-
puts work.inspect
|
201
|
-
end
|
195
|
+
filename = metadata["doi"].split("/", 2).last + ".xml"
|
196
|
+
IO.write(filename, work.data)
|
197
|
+
|
198
|
+
puts work.validation_errors if work.validation_errors.present?
|
202
199
|
|
203
200
|
work
|
204
201
|
end
|
@@ -206,13 +203,10 @@ module Cirneco
|
|
206
203
|
def unregister_work_for_metadata(metadata)
|
207
204
|
work = Cirneco::Work.new(metadata)
|
208
205
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
puts work.validation_errors
|
214
|
-
puts work.inspect
|
215
|
-
end
|
206
|
+
filename = metadata["doi"].split("/", 2).last + ".xml"
|
207
|
+
File.delete(filename) if File.exist?(filename)
|
208
|
+
|
209
|
+
puts work.validation_errors if work.validation_errors.present?
|
216
210
|
|
217
211
|
work
|
218
212
|
end
|
data/lib/cirneco/version.rb
CHANGED
data/lib/cirneco/work.rb
CHANGED
@@ -36,13 +36,7 @@ module Cirneco
|
|
36
36
|
|
37
37
|
SCHEMA = File.expand_path("../../../resources/kernel-4.0/metadata.xsd", __FILE__)
|
38
38
|
|
39
|
-
def has_required_elements?
|
40
|
-
doi && creators && title && publisher && publication_year && resource_type
|
41
|
-
end
|
42
|
-
|
43
39
|
def data
|
44
|
-
return nil unless has_required_elements?
|
45
|
-
|
46
40
|
Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
|
47
41
|
xml.send(:'resource', root_attributes) do
|
48
42
|
insert_work(xml)
|
data/spec/work_spec.rb
CHANGED
@@ -50,7 +50,8 @@ describe Cirneco::Work, vcr: true do
|
|
50
50
|
|
51
51
|
it 'validates work without title with errors' do
|
52
52
|
subject.title = nil
|
53
|
-
expect(subject.validation_errors).to eq(["The
|
53
|
+
expect(subject.validation_errors).to eq(["Element '{http://datacite.org/schema/kernel-4}title': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.",
|
54
|
+
"Element '{http://datacite.org/schema/kernel-4}title': '' is not a valid value of the atomic type '{http://datacite.org/schema/kernel-4}nonemptycontentStringType'."])
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|