lib/bolognese/datacite_utils.rb in bolognese-0.9.8 vs lib/bolognese/datacite_utils.rb in bolognese-0.9.9

- old
+ new

@@ -12,13 +12,13 @@ insert_work(xml) end end.to_xml end - def datacite - datacite_xml - end + # def datacite + # datacite_xml + # end def datacite_errors schema.validate(Nokogiri::XML(datacite, nil, 'UTF-8')).map { |error| error.to_s }.unwrap rescue Nokogiri::XML::SyntaxError => e e.message @@ -86,11 +86,11 @@ def insert_title(xml) xml.title(title) end def insert_publisher(xml) - xml.publisher(container_title) + xml.publisher(publisher) end def insert_publication_year(xml) xml.publicationYear(publication_year) end @@ -162,14 +162,15 @@ xml.version(version) end def rel_identifier Array.wrap(related_identifier).map do |r| + related_identifier_type = r["issn"].present? ? "ISSN" : validate_url(r["id"]) { "__content__" => r["id"], - "related_identifier_type" => validate_url(r["id"]), + "related_identifier_type" => related_identifier_type, "relation_type" => r["relationType"], - "resource_type_general" => r["resourceTypeGeneral"] } + "resource_type_general" => r["resourceTypeGeneral"] }.compact end end def insert_related_identifiers(xml) return xml unless rel_identifier.present? @@ -188,10 +189,10 @@ def insert_rights_list(xml) return xml unless license.present? xml.rightsList do Array.wrap(license).each do |lic| - xml.rights(lic["name"], 'rightsURI' => lic["url"]) + xml.rights(lic["name"], 'rightsURI' => lic["id"]) end end end def insert_descriptions(xml)