Skip to content

Commit 3f47348

Browse files
committed
Document DSpace serialization methods
1 parent 6889c88 commit 3f47348

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

app/models/dspace_metadata.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,33 @@ def add_metadata(key, value)
102102
@metadata_entries << { 'key' => key, 'value' => value }
103103
end
104104

105+
# DSpace 6 expects metadata to be sent as a flat array of key/value pairs under
106+
# a top-level "metadata" key (added by serialize_dss_metadata).
107+
#
108+
# Example returned by this method:
109+
# [
110+
# { 'key' => 'dc.title', 'value' => 'My Thesis' },
111+
# { 'key' => 'dc.contributor.author', 'value' => 'Student, Second' },
112+
# { 'key' => 'dc.contributor.author', 'value' => 'Student, Third' }
113+
# ]
105114
def serialize_dspace6
106115
@metadata_entries
107116
end
108117

118+
# DSpace 8 expects top-level metadata keys, where each key maps to an array of
119+
# value objects. We convert from our internal flat entries so both DSpace 6 and
120+
# DSpace 8 serializers can share the same source data.
121+
#
122+
# Example returned by this method:
123+
# {
124+
# 'dc.title' => [{ 'value' => 'My Thesis' }],
125+
# 'dc.contributor.author' => [
126+
# { 'value' => 'Student, Second' },
127+
# { 'value' => 'Student, Third' }
128+
# ]
129+
# }
130+
#
131+
# Note: language is intentionally omitted for now (out of scope).
109132
def serialize_dspace8
110133
result = {}
111134

0 commit comments

Comments
 (0)