cocina-models 0.103.1 → 0.103.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 439375f55b48b22cc891dde1fb31519f9b08a42b9128894cf04f643a5644a027
4
- data.tar.gz: 7f7a68b92f272e867d6243485d4ed68c1741128c6e93785a1879b811ca0ece63
3
+ metadata.gz: 3f188de5945ca2439b3d06d14e7c865f0736671751a0044c34c7adffd0a4016f
4
+ data.tar.gz: 1be0ac881f5b0a809416b87a4670682070cefb8b60b0bae4f52c4a2980a77cb1
5
5
  SHA512:
6
- metadata.gz: e23f7d1949ee04c1dba3bea6b64620f0ad816bde8ee02666e8af6b3c3057c86d326f586f696572e8cf0f3ba01c191444cd7501f81a8eede6fcaa45682b69fdfb
7
- data.tar.gz: 1b215531fa86e0f049f7c38bd8819c3ae47f849d66b7217da376761e09131f1c23e60b448ae404c66ee6024f6b4f570966a07398719360739182c99e5a2649d1
6
+ metadata.gz: df26365562311ea6a65c2a9f9f6110eb40b6ee51a18d83d7090b0bb5278300739972bde4521647999b18a6b1e16ef71edad16ffd6d1b17a912b5feef6f9c6e5a
7
+ data.tar.gz: 4fbb2e7d9f267f29ca928b414f3e1b8070e44307b8df78660c2dbe86427f5bfb302d8d127fdb6a8cf591aa38924f57748a7181d6351d39f5d889c0a393130901
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.103.1)
4
+ cocina-models (0.103.2)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -43,10 +43,10 @@ GEM
43
43
  openapi_parser (~> 1.0)
44
44
  rack (>= 1.5)
45
45
  concurrent-ruby (1.3.5)
46
- connection_pool (2.5.2)
46
+ connection_pool (2.5.3)
47
47
  deprecation (1.1.0)
48
48
  activesupport
49
- diff-lcs (1.6.1)
49
+ diff-lcs (1.6.2)
50
50
  docile (1.4.1)
51
51
  drb (2.2.1)
52
52
  dry-core (1.1.0)
@@ -101,7 +101,7 @@ GEM
101
101
  optimist (~> 3.0)
102
102
  prism (1.4.0)
103
103
  racc (1.8.1)
104
- rack (3.1.13)
104
+ rack (3.1.14)
105
105
  rainbow (3.1.1)
106
106
  rake (13.2.1)
107
107
  regexp_parser (2.10.0)
@@ -111,16 +111,16 @@ GEM
111
111
  rspec-mocks (~> 3.13.0)
112
112
  rspec-core (3.13.3)
113
113
  rspec-support (~> 3.13.0)
114
- rspec-expectations (3.13.3)
114
+ rspec-expectations (3.13.4)
115
115
  diff-lcs (>= 1.2.0, < 2.0)
116
116
  rspec-support (~> 3.13.0)
117
- rspec-mocks (3.13.2)
117
+ rspec-mocks (3.13.4)
118
118
  diff-lcs (>= 1.2.0, < 2.0)
119
119
  rspec-support (~> 3.13.0)
120
- rspec-support (3.13.2)
120
+ rspec-support (3.13.3)
121
121
  rspec_junit_formatter (0.6.0)
122
122
  rspec-core (>= 2, < 4, != 2.12.0)
123
- rubocop (1.75.3)
123
+ rubocop (1.75.5)
124
124
  json (~> 2.3)
125
125
  language_server-protocol (~> 3.17.0.2)
126
126
  lint_roller (~> 1.1.0)
@@ -10,13 +10,15 @@ module Cocina
10
10
  class Description
11
11
  # @param [Cocina::Models::Description] description
12
12
  # @param [string] druid
13
+ # @param [Cocina::Models::Identification] identification
13
14
  # @return [Nokogiri::XML::Document]
14
- def self.transform(description, druid)
15
- new(description, druid).transform
15
+ def self.transform(description, druid, identification: nil)
16
+ new(description, druid, identification).transform
16
17
  end
17
18
 
18
- def initialize(description, druid)
19
+ def initialize(description, druid, identification)
19
20
  @description = description
21
+ @identification = identification
20
22
  @druid = druid
21
23
  end
22
24
 
@@ -24,14 +26,14 @@ module Cocina
24
26
  def transform
25
27
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
26
28
  xml.mods(mods_attributes) do
27
- ModsWriter.write(xml: xml, description: description, druid: druid)
29
+ ModsWriter.write(xml: xml, description: description, druid: druid, identification: identification)
28
30
  end
29
31
  end.doc
30
32
  end
31
33
 
32
34
  private
33
35
 
34
- attr_reader :description, :druid
36
+ attr_reader :description, :druid, :identification
35
37
 
36
38
  def mods_version
37
39
  @mods_version ||= begin
@@ -9,11 +9,13 @@ module Cocina
9
9
  # @params [Nokogiri::XML::Builder] xml
10
10
  # @param [Cocina::Models::Description] description
11
11
  # @param [string] druid
12
- def self.write(xml:, description:, druid:, id_generator: IdGenerator.new)
12
+ # @param [Cocina::Models::Identification] identification
13
+ def self.write(xml:, description:, druid:, id_generator: IdGenerator.new, identification: nil)
13
14
  # ID Generator makes sure that different writers create unique altRepGroups and nameTitleGroups.
14
15
  if description.title
16
+ catalog_links = identification&.catalogLinks.present? ? identification.catalogLinks.select { |link| link.catalog == 'folio' } : []
15
17
  Title.write(xml: xml, titles: description.title, contributors: description.contributor,
16
- id_generator: id_generator)
18
+ id_generator: id_generator, catalog_links: catalog_links)
17
19
  end
18
20
  Contributor.write(xml: xml, contributors: description.contributor, titles: description.title,
19
21
  id_generator: id_generator)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.103.1'
5
+ VERSION = '0.103.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.103.1
4
+ version: 0.103.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-04-29 00:00:00.000000000 Z
10
+ date: 2025-05-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport