Class: Cocina::Models::Validators::CatalogLinksValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/validators/catalog_links_validator.rb

Overview

Validates that only a single CatalogLink has refresh set to true

Constant Summary collapse

1

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clazz, attributes) ⇒ CatalogLinksValidator

Returns a new instance of CatalogLinksValidator.



14
15
16
17
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 14

def initialize(clazz, attributes)
  @clazz = clazz
  @attributes = attributes
end

Class Method Details

.validate(clazz, attributes) ⇒ Object



10
11
12
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 10

def self.validate(clazz, attributes)
  new(clazz, attributes).validate
end

Instance Method Details

#validateObject



19
20
21
22
23
24
# File 'lib/cocina/models/validators/catalog_links_validator.rb', line 19

def validate
  return unless meets_preconditions?

  validate_catalog('symphony')
  validate_catalog('folio')
end