lib/bolognese/datacite_utils.rb in bolognese-1.0.2 vs lib/bolognese/datacite_utils.rb in bolognese-1.0.3
- old
+ new
@@ -91,16 +91,16 @@
def insert_publication_year(xml)
xml.publicationYear(publication_year)
end
def res_type
- { "resource_type_general" => resource_type_general || Metadata::SO_TO_DC_TRANSLATIONS[type] || "Other",
- "__content__" => additional_type || type }
+ { "resource_type_general" => types["resource_type_general"] || Metadata::SO_TO_DC_TRANSLATIONS[types["type"]] || "Other",
+ "__content__" => types["resource_type"] || types["type"] }
end
def insert_resource_type(xml)
- return xml unless type.present?
+ return xml unless types["type"].present?
xml.resourceType(res_type["__content__"],
'resourceTypeGeneral' => res_type["resource_type_general"])
end
@@ -113,17 +113,16 @@
end
end
end
def insert_dates(xml)
+ return xml unless Array.wrap(dates).present?
+
xml.dates do
- insert_date(xml, date_published, 'Issued') if date_published.present?
- insert_date(xml, date_modified, 'Updated') if date_modified.present?
+ Array.wrap(dates).each do |date|
+ xml.date(date["date"], 'dateType' => date["date_type"] || "Issued")
+ end
end
- end
-
- def insert_date(xml, date, date_type)
- xml.date(date, 'dateType' => date_type)
end
def insert_funding_references(xml)
return xml unless Array.wrap(funding_references).present?