cocina-models 0.89.0 → 0.90.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -1
- data/.rubocop_todo.yml +10 -32
- data/Gemfile.lock +11 -11
- data/README.md +1 -1
- data/lib/cocina/models/file_set.rb +0 -4
- data/lib/cocina/models/file_set_type.rb +0 -4
- data/lib/cocina/models/folio_catalog_link.rb +1 -1
- data/lib/cocina/models/mapping/from_mods/subject_authority_codes.rb +2 -0
- data/lib/cocina/models/mapping/normalizers/mods/subject_normalizer.rb +1 -5
- data/lib/cocina/models/request_file_set.rb +0 -4
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models.rb +13 -4
- data/lib/cocina/rspec/factories.rb +12 -2
- data/openapi.yml +3 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b9b6b1b7c20ec706258be8c9ece8408096195d6f82e35557f77d66ef513b806
|
4
|
+
data.tar.gz: 8ab0c377065f728a79f6dc88d5fcd8be80f8b913773a77811db8fc716ce86fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a3b581d427489cd9f280c0d0e9a086cfcb37d97ff43a983cde52302eb09fa537730c650fa429b3f4310621b25972790505c103366b109bba47bdf23e0ceb0df
|
7
|
+
data.tar.gz: 5219483d1199ea3ea2ab6014c6e4bb9c8ca63c5a3bd601aa9cc18424b30f98cdfa47b3078cf7429db88503478187b2712a68189a34a29c7426c3fc3524f8850f
|
data/.rubocop.yml
CHANGED
@@ -101,7 +101,6 @@ Metrics/MethodLength:
|
|
101
101
|
- 'lib/cocina/models/mapping/normalizers/mods/subject_normalizer.rb'
|
102
102
|
- 'lib/cocina/models/mapping/normalizers/mods_normalizer.rb'
|
103
103
|
|
104
|
-
|
105
104
|
# Offense count: 37
|
106
105
|
# Configuration parameters: IgnoredMethods.
|
107
106
|
Metrics/PerceivedComplexity:
|
@@ -111,6 +110,10 @@ Metrics/PerceivedComplexity:
|
|
111
110
|
- 'lib/cocina/models/mapping/to_mods/*'
|
112
111
|
- 'lib/cocina/models/mapping/normalizers/**/*'
|
113
112
|
|
113
|
+
Naming/PredicateName:
|
114
|
+
ForbiddenPrefixes:
|
115
|
+
- is_
|
116
|
+
|
114
117
|
# ----- RSpec ------
|
115
118
|
|
116
119
|
RSpec/BeEq: # new in 2.9.0
|
@@ -394,3 +397,16 @@ RSpec/Rails/MinitestAssertions: # new in 2.17
|
|
394
397
|
Enabled: true
|
395
398
|
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
396
399
|
Enabled: true
|
400
|
+
|
401
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
402
|
+
Enabled: true
|
403
|
+
Style/DirEmpty: # new in 1.48
|
404
|
+
Enabled: true
|
405
|
+
Style/FileEmpty: # new in 1.48
|
406
|
+
Enabled: true
|
407
|
+
RSpec/RedundantAround: # new in 2.19
|
408
|
+
Enabled: true
|
409
|
+
RSpec/SkipBlockInsideExample: # new in 2.19
|
410
|
+
Enabled: true
|
411
|
+
RSpec/Rails/TravelAround: # new in 2.19
|
412
|
+
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-03-13 15:58:18 UTC using RuboCop version 1.48.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -9,7 +9,6 @@
|
|
9
9
|
# Offense count: 3
|
10
10
|
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
11
11
|
# SupportedStyles: Gemfile, gems.rb, gemspec
|
12
|
-
# AllowedGems: bundler
|
13
12
|
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
14
13
|
Gemspec/DevelopmentDependencies:
|
15
14
|
Exclude:
|
@@ -20,14 +19,6 @@ Lint/NoReturnInBeginEndBlocks:
|
|
20
19
|
Exclude:
|
21
20
|
- 'lib/cocina/models/mapping/to_mods/description.rb'
|
22
21
|
|
23
|
-
# Offense count: 2
|
24
|
-
# This cop supports safe autocorrection (--autocorrect).
|
25
|
-
# Configuration parameters: AllowedMethods.
|
26
|
-
# AllowedMethods: present?, blank?, presence, try, try!, in?
|
27
|
-
Lint/SafeNavigationChain:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/cocina/generator/schema_base.rb'
|
30
|
-
|
31
22
|
# Offense count: 13
|
32
23
|
# This cop supports safe autocorrection (--autocorrect).
|
33
24
|
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
@@ -45,30 +36,16 @@ Lint/UnusedMethodArgument:
|
|
45
36
|
- 'lib/cocina/models/mapping/from_mods/subject.rb'
|
46
37
|
- 'lib/cocina/models/mapping/to_mods/event.rb'
|
47
38
|
|
48
|
-
# Offense count:
|
49
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns,
|
39
|
+
# Offense count: 98
|
40
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
50
41
|
Metrics/AbcSize:
|
51
42
|
Max: 40
|
52
43
|
|
53
44
|
# Offense count: 43
|
54
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
45
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
55
46
|
Metrics/CyclomaticComplexity:
|
56
47
|
Max: 12
|
57
48
|
|
58
|
-
# Offense count: 1
|
59
|
-
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
60
|
-
Metrics/MethodLength:
|
61
|
-
Exclude:
|
62
|
-
- 'spec/cocina/models/file_access_spec.rb'
|
63
|
-
- 'spec/cocina/models/dro_access_spec.rb'
|
64
|
-
- 'lib/cocina/rspec/factories.rb'
|
65
|
-
- 'lib/cocina/models/mapping/to_mods/*'
|
66
|
-
- 'lib/cocina/models/mapping/from_mods/*'
|
67
|
-
- 'lib/cocina/models/mapping/normalizers/mods/origin_info_normalizer.rb'
|
68
|
-
- 'lib/cocina/models/mapping/normalizers/mods/subject_normalizer.rb'
|
69
|
-
- 'lib/cocina/models/mapping/normalizers/mods_normalizer.rb'
|
70
|
-
- 'lib/cocina/generator/schema_base.rb'
|
71
|
-
|
72
49
|
# Offense count: 1
|
73
50
|
# Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
|
74
51
|
Metrics/ParameterLists:
|
@@ -83,7 +60,7 @@ RSpec/DescribeClass:
|
|
83
60
|
# Offense count: 87
|
84
61
|
# Configuration parameters: CountAsOne.
|
85
62
|
RSpec/ExampleLength:
|
86
|
-
Max:
|
63
|
+
Max: 103
|
87
64
|
|
88
65
|
# Offense count: 10
|
89
66
|
# Configuration parameters: Max, AllowedGroups.
|
@@ -92,11 +69,12 @@ RSpec/NestedGroups:
|
|
92
69
|
- 'spec/cocina/models/mapping/normalizers/mods/origin_info_normalizer_spec.rb'
|
93
70
|
- 'spec/cocina/models/validators/date_time_validator_spec.rb'
|
94
71
|
|
95
|
-
# Offense count:
|
72
|
+
# Offense count: 24
|
96
73
|
RSpec/PendingWithoutReason:
|
97
74
|
Exclude:
|
98
75
|
- 'spec/cocina/models/mapping/descriptive/mods/name_spec.rb'
|
99
76
|
- 'spec/cocina/models/mapping/descriptive/mods/origin_info_place_spec.rb'
|
77
|
+
- 'spec/cocina/models/mapping/descriptive/mods/part_spec.rb'
|
100
78
|
- 'spec/cocina/models/mapping/descriptive/mods/physical_description_spec.rb'
|
101
79
|
- 'spec/cocina/models/mapping/descriptive/mods/record_info_spec.rb'
|
102
80
|
- 'spec/cocina/models/mapping/descriptive/mods/subject_classification_spec.rb'
|
@@ -122,9 +100,9 @@ Style/MultilineBlockChain:
|
|
122
100
|
- 'lib/cocina/models/mapping/to_mods/form.rb'
|
123
101
|
- 'lib/cocina/models/mapping/to_mods/subject.rb'
|
124
102
|
|
125
|
-
# Offense count:
|
103
|
+
# Offense count: 239
|
126
104
|
# This cop supports safe autocorrection (--autocorrect).
|
127
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns
|
105
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
128
106
|
# URISchemes: http, https
|
129
107
|
Layout/LineLength:
|
130
|
-
Max:
|
108
|
+
Max: 267
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocina-models (0.
|
4
|
+
cocina-models (0.90.0)
|
5
5
|
activesupport
|
6
6
|
deprecation
|
7
7
|
dry-struct (~> 1.0)
|
@@ -20,7 +20,7 @@ PATH
|
|
20
20
|
GEM
|
21
21
|
remote: https://rubygems.org/
|
22
22
|
specs:
|
23
|
-
activesupport (7.0.4.
|
23
|
+
activesupport (7.0.4.3)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 1.6, < 2)
|
26
26
|
minitest (>= 5.1)
|
@@ -69,7 +69,7 @@ GEM
|
|
69
69
|
jsonpath (1.1.2)
|
70
70
|
multi_json
|
71
71
|
mini_portile2 (2.8.1)
|
72
|
-
minitest (5.
|
72
|
+
minitest (5.18.0)
|
73
73
|
multi_json (1.15.0)
|
74
74
|
nokogiri (1.14.2)
|
75
75
|
mini_portile2 (~> 2.8.0)
|
@@ -79,12 +79,12 @@ GEM
|
|
79
79
|
openapi_parser (0.15.0)
|
80
80
|
optimist (3.0.1)
|
81
81
|
parallel (1.22.1)
|
82
|
-
parser (3.2.1.
|
82
|
+
parser (3.2.1.1)
|
83
83
|
ast (~> 2.4.1)
|
84
84
|
patience_diff (1.2.0)
|
85
85
|
optimist (~> 3.0)
|
86
86
|
racc (1.6.2)
|
87
|
-
rack (3.0.
|
87
|
+
rack (3.0.7)
|
88
88
|
rainbow (3.1.1)
|
89
89
|
rake (13.0.6)
|
90
90
|
regexp_parser (2.7.0)
|
@@ -98,7 +98,7 @@ GEM
|
|
98
98
|
rspec-expectations (3.12.2)
|
99
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
100
100
|
rspec-support (~> 3.12.0)
|
101
|
-
rspec-mocks (3.12.
|
101
|
+
rspec-mocks (3.12.4)
|
102
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
103
103
|
rspec-support (~> 3.12.0)
|
104
104
|
rspec-support (3.12.0)
|
@@ -106,7 +106,7 @@ GEM
|
|
106
106
|
rspec-core (>= 2, < 4, != 2.12.0)
|
107
107
|
rss (0.2.9)
|
108
108
|
rexml
|
109
|
-
rubocop (1.
|
109
|
+
rubocop (1.48.1)
|
110
110
|
json (~> 2.3)
|
111
111
|
parallel (~> 1.10)
|
112
112
|
parser (>= 3.2.0.0)
|
@@ -116,23 +116,23 @@ GEM
|
|
116
116
|
rubocop-ast (>= 1.26.0, < 2.0)
|
117
117
|
ruby-progressbar (~> 1.7)
|
118
118
|
unicode-display_width (>= 2.4.0, < 3.0)
|
119
|
-
rubocop-ast (1.
|
119
|
+
rubocop-ast (1.28.0)
|
120
120
|
parser (>= 3.2.1.0)
|
121
121
|
rubocop-capybara (2.17.1)
|
122
122
|
rubocop (~> 1.41)
|
123
123
|
rubocop-rake (0.6.0)
|
124
124
|
rubocop (~> 1.0)
|
125
|
-
rubocop-rspec (2.
|
125
|
+
rubocop-rspec (2.19.0)
|
126
126
|
rubocop (~> 1.33)
|
127
127
|
rubocop-capybara (~> 2.17)
|
128
|
-
ruby-progressbar (1.
|
128
|
+
ruby-progressbar (1.13.0)
|
129
129
|
simplecov (0.22.0)
|
130
130
|
docile (~> 1.1)
|
131
131
|
simplecov-html (~> 0.11)
|
132
132
|
simplecov_json_formatter (~> 0.1)
|
133
133
|
simplecov-html (0.12.3)
|
134
134
|
simplecov_json_formatter (0.1.4)
|
135
|
-
super_diff (0.
|
135
|
+
super_diff (0.10.0)
|
136
136
|
attr_extras (>= 6.2.4)
|
137
137
|
diff-lcs
|
138
138
|
patience_diff
|
data/README.md
CHANGED
@@ -132,7 +132,7 @@ The release process is much like any other gem. First bump the version in `lib/c
|
|
132
132
|
```
|
133
133
|
bundle exec rake release
|
134
134
|
```
|
135
|
-
which pushes the gem to rubygems.org.
|
135
|
+
which pushes the gem to rubygems.org.
|
136
136
|
|
137
137
|
### Step 2: Update client gems coupled to the models
|
138
138
|
|
@@ -11,14 +11,10 @@ module Cocina
|
|
11
11
|
'https://cocina.sul.stanford.edu/models/resources/document',
|
12
12
|
'https://cocina.sul.stanford.edu/models/resources/file',
|
13
13
|
'https://cocina.sul.stanford.edu/models/resources/image',
|
14
|
-
'https://cocina.sul.stanford.edu/models/resources/main-augmented',
|
15
|
-
'https://cocina.sul.stanford.edu/models/resources/main-original',
|
16
14
|
'https://cocina.sul.stanford.edu/models/resources/media',
|
17
15
|
'https://cocina.sul.stanford.edu/models/resources/object',
|
18
16
|
'https://cocina.sul.stanford.edu/models/resources/page',
|
19
|
-
'https://cocina.sul.stanford.edu/models/resources/permissions',
|
20
17
|
'https://cocina.sul.stanford.edu/models/resources/preview',
|
21
|
-
'https://cocina.sul.stanford.edu/models/resources/supplement',
|
22
18
|
'https://cocina.sul.stanford.edu/models/resources/3d',
|
23
19
|
'https://cocina.sul.stanford.edu/models/resources/thumb',
|
24
20
|
'https://cocina.sul.stanford.edu/models/resources/video'].freeze
|
@@ -10,14 +10,10 @@ module Cocina
|
|
10
10
|
property :document
|
11
11
|
property :file
|
12
12
|
property :image
|
13
|
-
property :'main-augmented'
|
14
|
-
property :'main-original'
|
15
13
|
property :media
|
16
14
|
property :object
|
17
15
|
property :page
|
18
|
-
property :permissions
|
19
16
|
property :preview
|
20
|
-
property :supplement
|
21
17
|
property :thumb
|
22
18
|
property :video
|
23
19
|
end
|
@@ -7,7 +7,7 @@ module Cocina
|
|
7
7
|
# Catalog that is the source of the linked record.
|
8
8
|
# example: folio
|
9
9
|
attribute :catalog, Types::Strict::String.enum('folio', 'previous folio')
|
10
|
-
# Only one of the
|
10
|
+
# Only one of the Folio instance HRIDs should be designated for refreshing. This means that this HRID is the one used to pull metadata from the catalog if there is more than one HRID present.
|
11
11
|
attribute :refresh, Types::Strict::Bool.default(false)
|
12
12
|
# Record identifier that is unique within the context of the linked record's catalog.
|
13
13
|
attribute :catalogRecordId, MigratedFromSymphonyIdentifier | MigratedFromVoyagerIdentifier | CreatedInFolioIdentifier
|
@@ -6,6 +6,7 @@ module Cocina
|
|
6
6
|
module Mapping
|
7
7
|
module FromMods
|
8
8
|
# Helper class - provides subject authority codes
|
9
|
+
# rubocop:disable Metrics/CollectionLiteralLength
|
9
10
|
class SubjectAuthorityCodes
|
10
11
|
# Subject codes: https://id.loc.gov/vocabulary/subjectSchemes.html
|
11
12
|
# curl https://id.loc.gov/vocabulary/subjectSchemes.madsrdf.json | jq '[.[0]."http://www.loc.gov/mads/rdf/v1#hasMADSSchemeMember"[]."@id"[44:]]'
|
@@ -787,6 +788,7 @@ module Cocina
|
|
787
788
|
+ CARTOGRAPHIC_CODES + OCCUPATION_CODES + COUNTRY_CODES + GEOGRAPHIC_CODES \
|
788
789
|
+ ISO_CODES + MARC_CODES + PARKER + OTHER_CODES
|
789
790
|
end
|
791
|
+
# rubocop:enable Metrics/CollectionLiteralLength
|
790
792
|
end
|
791
793
|
end
|
792
794
|
end
|
@@ -108,7 +108,6 @@ module Cocina
|
|
108
108
|
# rubocop:enable Metrics/CyclomaticComplexity
|
109
109
|
# rubocop:enable Metrics/AbcSize
|
110
110
|
|
111
|
-
# rubocop:disable Naming/PredicateName
|
112
111
|
def has_authority?(nodes)
|
113
112
|
nodes_to_a(nodes).all? { |node| node[:authority] }
|
114
113
|
end
|
@@ -116,7 +115,6 @@ module Cocina
|
|
116
115
|
def has_same_authority?(nodes, same_node)
|
117
116
|
nodes_to_a(nodes).all? { |node| same_node[:authority] == node[:authority] || (lcsh_or_naf?(same_node) && lcsh_or_naf?(node)) }
|
118
117
|
end
|
119
|
-
# rubocop:enable Naming/PredicateName
|
120
118
|
|
121
119
|
def lcsh_or_naf?(node)
|
122
120
|
%w[lcsh naf].include?(node[:authority])
|
@@ -136,7 +134,6 @@ module Cocina
|
|
136
134
|
end
|
137
135
|
|
138
136
|
# rubocop:disable Naming/MethodName
|
139
|
-
# rubocop:disable Naming/PredicateName
|
140
137
|
def has_authorityURI?(nodes)
|
141
138
|
nodes_to_a(nodes).all? { |node| node[:authorityURI] }
|
142
139
|
end
|
@@ -156,9 +153,8 @@ module Cocina
|
|
156
153
|
def add_valueURI(nodes, from_node)
|
157
154
|
nodes_to_a(nodes).each { |node| node[:valueURI] = from_node[:valueURI] }
|
158
155
|
end
|
159
|
-
# rubocop:enable Naming/MethodName
|
160
|
-
# rubocop:enable Naming/PredicateName
|
161
156
|
|
157
|
+
# rubocop:enable Naming/MethodName
|
162
158
|
def nodes_to_a(nodes)
|
163
159
|
nodes.is_a?(Nokogiri::XML::NodeSet) ? nodes : [nodes]
|
164
160
|
end
|
@@ -10,14 +10,10 @@ module Cocina
|
|
10
10
|
'https://cocina.sul.stanford.edu/models/resources/document',
|
11
11
|
'https://cocina.sul.stanford.edu/models/resources/file',
|
12
12
|
'https://cocina.sul.stanford.edu/models/resources/image',
|
13
|
-
'https://cocina.sul.stanford.edu/models/resources/main-augmented',
|
14
|
-
'https://cocina.sul.stanford.edu/models/resources/main-original',
|
15
13
|
'https://cocina.sul.stanford.edu/models/resources/media',
|
16
14
|
'https://cocina.sul.stanford.edu/models/resources/object',
|
17
15
|
'https://cocina.sul.stanford.edu/models/resources/page',
|
18
|
-
'https://cocina.sul.stanford.edu/models/resources/permissions',
|
19
16
|
'https://cocina.sul.stanford.edu/models/resources/preview',
|
20
|
-
'https://cocina.sul.stanford.edu/models/resources/supplement',
|
21
17
|
'https://cocina.sul.stanford.edu/models/resources/3d',
|
22
18
|
'https://cocina.sul.stanford.edu/models/resources/thumb',
|
23
19
|
'https://cocina.sul.stanford.edu/models/resources/video'].freeze
|
data/lib/cocina/models.rb
CHANGED
@@ -75,6 +75,8 @@ module Cocina
|
|
75
75
|
end
|
76
76
|
# rubocop:enable Naming/MethodName
|
77
77
|
|
78
|
+
METADATA_KEYS = %i[created modified lock].freeze
|
79
|
+
|
78
80
|
# @param [Hash] dyn a ruby hash representation of the JSON serialization of a collection or DRO
|
79
81
|
# @param [boolean] validate
|
80
82
|
# @return [DRO,Collection,AdminPolicy]
|
@@ -84,11 +86,11 @@ module Cocina
|
|
84
86
|
def self.build(dyn, validate: true)
|
85
87
|
clazz = case type_for(dyn)
|
86
88
|
when *DRO::TYPES
|
87
|
-
DRO
|
89
|
+
has_metadata?(dyn) ? DROWithMetadata : DRO
|
88
90
|
when *Collection::TYPES
|
89
|
-
Collection
|
91
|
+
has_metadata?(dyn) ? ColectionWithMetadata : Collection
|
90
92
|
when *AdminPolicy::TYPES
|
91
|
-
AdminPolicy
|
93
|
+
has_metadata?(dyn) ? AdminPolicyWithMetadata : AdminPolicy
|
92
94
|
else
|
93
95
|
raise UnknownTypeError, "Unknown type: '#{dyn.with_indifferent_access.fetch('type')}'"
|
94
96
|
end
|
@@ -119,7 +121,7 @@ module Cocina
|
|
119
121
|
# @param [DROWithMetadata,CollectionWithMetadata,AdminPolicyWithMetadata] cocina_object
|
120
122
|
# @return [DRO,Collection,AdminPolicy]
|
121
123
|
def self.without_metadata(cocina_object)
|
122
|
-
build(cocina_object.to_h.except(
|
124
|
+
build(cocina_object.to_h.except(*METADATA_KEYS), validate: false)
|
123
125
|
end
|
124
126
|
|
125
127
|
# Adds metadata to a DRO, Collection, AdminPolicy
|
@@ -158,6 +160,13 @@ module Cocina
|
|
158
160
|
end
|
159
161
|
private_class_method :type_for
|
160
162
|
|
163
|
+
def self.has_metadata?(dyn)
|
164
|
+
# Intentionally checking both string- and symbol-type keys in the hash via `#[]`
|
165
|
+
# instead of `#with_indifferent_access` (and/or `#fetch`) in order to be more memory-efficient
|
166
|
+
METADATA_KEYS.any? { |key| dyn[key] || dyn[key.to_s] }
|
167
|
+
end
|
168
|
+
private_class_method :has_metadata?
|
169
|
+
|
161
170
|
def self.druid_regex
|
162
171
|
@druid_regex ||= begin
|
163
172
|
str = Openapi3Parser.load_file('openapi.yml').components.schemas['Druid'].pattern
|
@@ -90,7 +90,7 @@ module Cocina
|
|
90
90
|
|
91
91
|
# rubocop:disable Metrics/ParameterLists
|
92
92
|
def self.build_request_dro_properties(type:, version:, label:, title:, source_id:, admin_policy_id:,
|
93
|
-
barcode: nil, catkeys: [], collection_ids: [])
|
93
|
+
barcode: nil, catkeys: [], folio_instance_hrids: [], collection_ids: [])
|
94
94
|
{
|
95
95
|
type: type,
|
96
96
|
version: version,
|
@@ -112,6 +112,11 @@ module Cocina
|
|
112
112
|
{ catalog: 'symphony', catalogRecordId: catkey, refresh: index.zero? }
|
113
113
|
end
|
114
114
|
end
|
115
|
+
if folio_instance_hrids.present?
|
116
|
+
props[:identification][:catalogLinks] = folio_instance_hrids.map.with_index do |folio_id, index|
|
117
|
+
{ catalog: 'folio', catalogRecordId: folio_id, refresh: index.zero? }
|
118
|
+
end
|
119
|
+
end
|
115
120
|
props[:identification][:barcode] = barcode if barcode
|
116
121
|
end
|
117
122
|
end
|
@@ -130,7 +135,7 @@ module Cocina
|
|
130
135
|
end
|
131
136
|
|
132
137
|
# rubocop:disable Metrics/ParameterLists
|
133
|
-
def self.build_request_collection_properties(type:, version:, label:, title:, admin_policy_id:, source_id: nil, catkeys: [])
|
138
|
+
def self.build_request_collection_properties(type:, version:, label:, title:, admin_policy_id:, source_id: nil, catkeys: [], folio_instance_hrids: [])
|
134
139
|
{
|
135
140
|
type: type,
|
136
141
|
version: version,
|
@@ -147,6 +152,11 @@ module Cocina
|
|
147
152
|
{ catalog: 'symphony', catalogRecordId: catkey, refresh: index.zero? }
|
148
153
|
end
|
149
154
|
end
|
155
|
+
if folio_instance_hrids.present?
|
156
|
+
props[:identification][:catalogLinks] = folio_instance_hrids.map.with_index do |folio_id, index|
|
157
|
+
{ catalog: 'folio', catalogRecordId: folio_id, refresh: index.zero? }
|
158
|
+
end
|
159
|
+
end
|
150
160
|
props[:identification][:sourceId] = source_id if source_id
|
151
161
|
end
|
152
162
|
end
|
data/openapi.yml
CHANGED
@@ -1109,14 +1109,10 @@ components:
|
|
1109
1109
|
- 'https://cocina.sul.stanford.edu/models/resources/document'
|
1110
1110
|
- 'https://cocina.sul.stanford.edu/models/resources/file'
|
1111
1111
|
- 'https://cocina.sul.stanford.edu/models/resources/image'
|
1112
|
-
- 'https://cocina.sul.stanford.edu/models/resources/main-augmented'
|
1113
|
-
- 'https://cocina.sul.stanford.edu/models/resources/main-original'
|
1114
1112
|
- 'https://cocina.sul.stanford.edu/models/resources/media'
|
1115
1113
|
- 'https://cocina.sul.stanford.edu/models/resources/object'
|
1116
1114
|
- 'https://cocina.sul.stanford.edu/models/resources/page'
|
1117
|
-
- 'https://cocina.sul.stanford.edu/models/resources/permissions'
|
1118
1115
|
- 'https://cocina.sul.stanford.edu/models/resources/preview'
|
1119
|
-
- 'https://cocina.sul.stanford.edu/models/resources/supplement'
|
1120
1116
|
- 'https://cocina.sul.stanford.edu/models/resources/3d'
|
1121
1117
|
- 'https://cocina.sul.stanford.edu/models/resources/thumb'
|
1122
1118
|
- 'https://cocina.sul.stanford.edu/models/resources/video'
|
@@ -1158,9 +1154,9 @@ components:
|
|
1158
1154
|
- previous folio
|
1159
1155
|
example: folio
|
1160
1156
|
refresh:
|
1161
|
-
description: Only one of the
|
1162
|
-
This means that this
|
1163
|
-
if there is more than one
|
1157
|
+
description: Only one of the Folio instance HRIDs should be designated for refreshing.
|
1158
|
+
This means that this HRID is the one used to pull metadata from the catalog
|
1159
|
+
if there is more than one HRID present.
|
1164
1160
|
type: boolean
|
1165
1161
|
default: false
|
1166
1162
|
catalogRecordId:
|
@@ -1813,14 +1809,10 @@ components:
|
|
1813
1809
|
- 'https://cocina.sul.stanford.edu/models/resources/document'
|
1814
1810
|
- 'https://cocina.sul.stanford.edu/models/resources/file'
|
1815
1811
|
- 'https://cocina.sul.stanford.edu/models/resources/image'
|
1816
|
-
- 'https://cocina.sul.stanford.edu/models/resources/main-augmented'
|
1817
|
-
- 'https://cocina.sul.stanford.edu/models/resources/main-original'
|
1818
1812
|
- 'https://cocina.sul.stanford.edu/models/resources/media'
|
1819
1813
|
- 'https://cocina.sul.stanford.edu/models/resources/object'
|
1820
1814
|
- 'https://cocina.sul.stanford.edu/models/resources/page'
|
1821
|
-
- 'https://cocina.sul.stanford.edu/models/resources/permissions'
|
1822
1815
|
- 'https://cocina.sul.stanford.edu/models/resources/preview'
|
1823
|
-
- 'https://cocina.sul.stanford.edu/models/resources/supplement'
|
1824
1816
|
- 'https://cocina.sul.stanford.edu/models/resources/3d'
|
1825
1817
|
- 'https://cocina.sul.stanford.edu/models/resources/thumb'
|
1826
1818
|
- 'https://cocina.sul.stanford.edu/models/resources/video'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.90.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -533,7 +533,7 @@ homepage: https://github.com/sul-dlss/cocina-models
|
|
533
533
|
licenses: []
|
534
534
|
metadata:
|
535
535
|
rubygems_mfa_required: 'true'
|
536
|
-
post_install_message:
|
536
|
+
post_install_message:
|
537
537
|
rdoc_options: []
|
538
538
|
require_paths:
|
539
539
|
- lib
|
@@ -548,8 +548,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
548
548
|
- !ruby/object:Gem::Version
|
549
549
|
version: '0'
|
550
550
|
requirements: []
|
551
|
-
rubygems_version: 3.
|
552
|
-
signing_key:
|
551
|
+
rubygems_version: 3.2.32
|
552
|
+
signing_key:
|
553
553
|
specification_version: 4
|
554
554
|
summary: Data models for the SDR
|
555
555
|
test_files: []
|