cocina_display 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocina_display/cocina_record.rb +2 -4
- data/lib/cocina_display/concerns/contributors.rb +2 -2
- data/lib/cocina_display/concerns/events.rb +4 -10
- data/lib/cocina_display/concerns/identifiers.rb +1 -0
- data/lib/cocina_display/dates/date.rb +6 -0
- data/lib/cocina_display/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f613a3974d14946081f09d45797c2be75475c2b37fedf4ebe51a9c7eef2de10
|
|
4
|
+
data.tar.gz: 6dc64d8348e652ac4bea87a904519029ed580cc498c6e584d2a196a079293141
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56874880d8a3fff624afb2306aeffab7792b59f678901a5f8632bd77beca3eeaab388053ddcc3790d6f1c5dfe687ee6588cd83eafe5cc143893eb8d551ed617f
|
|
7
|
+
data.tar.gz: d39907bb6d250a06ab01b5127fc98223ac6225e2e346ea9eaadaa91874ff20b807e2ded45453e5ed10cfb9515eba4b3da11ab5fb8ee7b42718ac670ab4cde95f
|
|
@@ -18,16 +18,14 @@ module CocinaDisplay
|
|
|
18
18
|
include CocinaDisplay::Concerns::RelatedResources
|
|
19
19
|
|
|
20
20
|
# Fetch a public Cocina document from PURL and create a CocinaRecord.
|
|
21
|
-
# @note This is intended to be used in development or testing only.
|
|
22
21
|
# @param druid [String] The bare DRUID of the object to fetch.
|
|
23
22
|
# @param purl_url [String] The base url for the purl service.
|
|
24
23
|
# @param deep_compact [Boolean] If true, compact the JSON to remove blank values.
|
|
25
24
|
# @return [CocinaDisplay::CocinaRecord]
|
|
26
|
-
# :nocov:
|
|
27
25
|
def self.fetch(druid, deep_compact: true, purl_url: "https://purl.stanford.edu")
|
|
28
|
-
|
|
26
|
+
response = Net::HTTP.get_response(URI("#{purl_url}/#{druid}.json"))
|
|
27
|
+
from_json(response.body, deep_compact: deep_compact) if response.is_a?(Net::HTTPSuccess)
|
|
29
28
|
end
|
|
30
|
-
# :nocov:
|
|
31
29
|
|
|
32
30
|
# Create a CocinaRecord from a JSON string.
|
|
33
31
|
# @param cocina_json [String]
|
|
@@ -80,11 +80,11 @@ module CocinaDisplay
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
# DisplayData for Contributors, one per role.
|
|
83
|
+
# DisplayData for Contributors, one per role (excluding publisher).
|
|
84
84
|
# Contributors with no role are grouped under a default heading.
|
|
85
85
|
# @return [Array<DisplayData>]
|
|
86
86
|
def contributor_display_data
|
|
87
|
-
contributors_by_role.map do |role, contributors|
|
|
87
|
+
contributors_by_role.except("publisher").map do |role, contributors|
|
|
88
88
|
label = I18n.t(role, scope: "cocina_display.contributor.role",
|
|
89
89
|
default: role&.capitalize || I18n.t("default", scope: "cocina_display.contributor.role"))
|
|
90
90
|
DisplayData.new(label: label, objects: contributors)
|
|
@@ -12,19 +12,13 @@ module CocinaDisplay
|
|
|
12
12
|
return unless (date = pub_date(ignore_qualified: ignore_qualified))
|
|
13
13
|
|
|
14
14
|
if date.is_a? CocinaDisplay::Dates::DateRange
|
|
15
|
-
|
|
16
|
-
edtf_date = date.start.date
|
|
17
|
-
elsif !date.stop.date.is_a? EDTF::Unknown
|
|
18
|
-
edtf_date = date.stop.date
|
|
19
|
-
end
|
|
20
|
-
else
|
|
21
|
-
edtf_date = date.date
|
|
15
|
+
date = date.start&.known? ? date.start : date.stop
|
|
22
16
|
end
|
|
23
17
|
|
|
24
|
-
return
|
|
25
|
-
return
|
|
18
|
+
return unless date&.known?
|
|
19
|
+
return date.date.from if date.date.is_a?(EDTF::Interval)
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
date.date
|
|
28
22
|
end
|
|
29
23
|
|
|
30
24
|
# The earliest preferred publication year as an integer.
|
|
@@ -143,6 +143,12 @@ module CocinaDisplay
|
|
|
143
143
|
qualifier.present?
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
# Does this represent a known date?
|
|
147
|
+
# @return [Boolean]
|
|
148
|
+
def known?
|
|
149
|
+
!date.is_a?(EDTF::Unknown)
|
|
150
|
+
end
|
|
151
|
+
|
|
146
152
|
# Was an encoding declared for this date?
|
|
147
153
|
# @return [Boolean]
|
|
148
154
|
def encoding?
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocina_display
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Budak
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
10
|
+
date: 2025-12-05 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: janeway-jsonpath
|
|
@@ -212,7 +211,6 @@ dependencies:
|
|
|
212
211
|
- - "~>"
|
|
213
212
|
- !ruby/object:Gem::Version
|
|
214
213
|
version: '3.1'
|
|
215
|
-
description:
|
|
216
214
|
email:
|
|
217
215
|
- budak@stanford.edu
|
|
218
216
|
executables: []
|
|
@@ -284,7 +282,6 @@ licenses:
|
|
|
284
282
|
metadata:
|
|
285
283
|
homepage_uri: https://sul-dlss.github.io/cocina_display/
|
|
286
284
|
source_code_uri: https://github.com/sul-dlss/cocina_display
|
|
287
|
-
post_install_message:
|
|
288
285
|
rdoc_options: []
|
|
289
286
|
require_paths:
|
|
290
287
|
- lib
|
|
@@ -299,8 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
299
296
|
- !ruby/object:Gem::Version
|
|
300
297
|
version: '0'
|
|
301
298
|
requirements: []
|
|
302
|
-
rubygems_version: 3.
|
|
303
|
-
signing_key:
|
|
299
|
+
rubygems_version: 3.6.2
|
|
304
300
|
specification_version: 4
|
|
305
301
|
summary: Helpers for rendering Cocina metadata
|
|
306
302
|
test_files: []
|