lib/bolognese/datacite_utils.rb in bolognese-0.6.4 vs lib/bolognese/datacite_utils.rb in bolognese-0.6.5
- old
+ new
@@ -44,17 +44,18 @@
end
end.to_xml
end
def as_datacite
- if schema.validate(Nokogiri::XML(datacite_xml))
+ if validation_errors.blank?
datacite_xml
end
end
def validation_errors
@validation_errors ||= schema.validate(Nokogiri::XML(datacite_xml))
+ .map { |error| error.to_s }
end
def insert_work(xml)
insert_identifier(xml)
insert_creators(xml)
@@ -217,10 +218,12 @@
def insert_rights_list(xml)
return xml unless license.present?
xml.rightsList do
- xml.rights(LICENSE_NAMES[license], 'rightsURI' => license)
+ Array.wrap(license).each do |lic|
+ xml.rights(LICENSE_NAMES[lic], 'rightsURI' => lic)
+ end
end
end
def insert_descriptions(xml)
return xml unless description.present?