Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Export contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Dec 15, 2020
1 parent 202cdf2 commit 015aaa3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/export-items
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ list = Hydrus::Item.all
def serialize(item)
creator = item.roleMetadata.ng_xml.xpath('//role/person/identifier').text
related_items = item.related_items.map { |rel| { link_title: rel.title.presence, url: rel.url.presence }.compact }.reject(&:blank?)
contributors = item.contributors.
map { |contrib| { full_name: contrib.name, role: contrib.role, name_type: contrib.name_type }}.
reject { |contrib| contrib[:full_name].blank? }

{
druid: item.id,
Expand All @@ -26,7 +29,8 @@ def serialize(item)
object_status: item.object_status,
item_type: item.item_type,
citation: item.preferred_citation,
related_items: related_items
related_items: related_items,
contributors: contributors
}
end

Expand Down

0 comments on commit 015aaa3

Please sign in to comment.