cocina-models 0.87.1 → 0.88.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90ae20c8c80e4bbcf51179f0c6cba44c76f3f1551962f4da938d297c152ed77d
4
- data.tar.gz: b71a9f5c05e153ebdf93f623164a7a77c12aeae2de32b96757096a7d2f747cfa
3
+ metadata.gz: bc554199583e2b12406431ed5078bae08509c75989a7aafdcf22715530f3d5da
4
+ data.tar.gz: f2bd63b4b242d7f48156499fdf729935bccc728635c692628cd1e3ebb0c84cd5
5
5
  SHA512:
6
- metadata.gz: 26f2fe285a9249a70015b31b7fb30983d3f4fff6befe671508f56ac57d6bbcb901f5740290fcd3bcfb6a5e7ccc9697ccf8032b0d3aa07d6a743485ce34cb9c1d
7
- data.tar.gz: cf8992389b7097a416f5050d196758145dd958abeef155a672fa21ffdef382f5e025e6b101dd2f26baf427aef2b195b43b93431b9faaae569d1386efe9cafb1d
6
+ metadata.gz: afaca98ac0c7260962d483ed4ff4bc0a4c9bf1c3aa538b1571541b98b2ef6d6efd9a00e0575fffd3117adc8dbd75426b4e4dffeb1ebfae4a46fa0db1c1a3e3b1
7
+ data.tar.gz: '090a1137f535c219c96966b44a8af03a9a60bdf9dd871c4b6024a033d4323ffc3f000132835d71d55aa60a80f38b7601663b6403b05e6df69a699395ccdf9f99'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.87.1)
4
+ cocina-models (0.88.0)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -51,11 +51,11 @@ GEM
51
51
  dry-types (>= 1.7, < 2)
52
52
  ice_nine (~> 0.11)
53
53
  zeitwerk (~> 2.6)
54
- dry-types (1.7.0)
54
+ dry-types (1.7.1)
55
55
  concurrent-ruby (~> 1.0)
56
- dry-core (~> 1.0, < 2)
57
- dry-inflector (~> 1.0, < 2)
58
- dry-logic (>= 1.4, < 2)
56
+ dry-core (~> 1.0)
57
+ dry-inflector (~> 1.0)
58
+ dry-logic (~> 1.4)
59
59
  zeitwerk (~> 2.6)
60
60
  edtf (3.1.1)
61
61
  activesupport (>= 3.0, < 8.0)
@@ -118,7 +118,7 @@ GEM
118
118
  unicode-display_width (>= 2.4.0, < 3.0)
119
119
  rubocop-ast (1.26.0)
120
120
  parser (>= 3.2.1.0)
121
- rubocop-capybara (2.17.0)
121
+ rubocop-capybara (2.17.1)
122
122
  rubocop (~> 1.41)
123
123
  rubocop-rake (0.6.0)
124
124
  rubocop (~> 1.0)
@@ -19,22 +19,33 @@ module Cocina
19
19
  def validate
20
20
  return unless meets_preconditions?
21
21
 
22
+ validate_catalog('symphony')
23
+ validate_catalog('folio')
24
+ end
25
+
26
+ private
27
+
28
+ attr_reader :clazz, :attributes
29
+
30
+ def validate_catalog(catalog)
31
+ refresh_catalog_links = refresh_catalog_links_for(catalog)
32
+
22
33
  return if refresh_catalog_links.length <= MAX_REFRESH_CATALOG_LINKS
23
34
 
24
35
  raise ValidationError, "Multiple catalog links have 'refresh' property set to true " \
25
36
  "(only one allowed) #{refresh_catalog_links}"
26
37
  end
27
38
 
28
- private
29
-
30
- attr_reader :clazz, :attributes
39
+ def catalog_links
40
+ @catalog_links ||= Array(attributes.dig(:identification, :catalogLinks))
41
+ end
31
42
 
32
43
  def meets_preconditions?
33
- (dro? || collection?) && Array(attributes.dig(:identification, :catalogLinks)).any?
44
+ (dro? || collection?) && catalog_links.any?
34
45
  end
35
46
 
36
- def refresh_catalog_links
37
- attributes.dig(:identification, :catalogLinks).select { |catalog_link| catalog_link[:refresh] }
47
+ def refresh_catalog_links_for(catalog)
48
+ catalog_links.select { |catalog_link| catalog_link[:catalog] == catalog && catalog_link[:refresh] }
38
49
  end
39
50
 
40
51
  def dro?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.87.1'
5
+ VERSION = '0.88.0'
6
6
  end
7
7
  end
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.87.1
4
+ version: 0.88.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-02-16 00:00:00.000000000 Z
11
+ date: 2023-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -531,7 +531,7 @@ homepage: https://github.com/sul-dlss/cocina-models
531
531
  licenses: []
532
532
  metadata:
533
533
  rubygems_mfa_required: 'true'
534
- post_install_message:
534
+ post_install_message:
535
535
  rdoc_options: []
536
536
  require_paths:
537
537
  - lib
@@ -547,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
547
547
  version: '0'
548
548
  requirements: []
549
549
  rubygems_version: 3.3.7
550
- signing_key:
550
+ signing_key:
551
551
  specification_version: 4
552
552
  summary: Data models for the SDR
553
553
  test_files: []