Class: Cocina::Models::Builders::RightsDescriptionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/builders/rights_description_builder.rb

Overview

RightsDescriptionBuilder

Direct Known Subclasses

DroRightsDescriptionBuilder

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cocina_object) ⇒ RightsDescriptionBuilder

Returns a new instance of RightsDescriptionBuilder.



13
14
15
# File 'lib/cocina/models/builders/rights_description_builder.rb', line 13

def initialize(cocina_object)
  @cocina = cocina_object
end

Class Method Details

.build(cocina_object) ⇒ Object

Parameters:



9
10
11
# File 'lib/cocina/models/builders/rights_description_builder.rb', line 9

def self.build(cocina_object)
  new(cocina_object).build
end

Instance Method Details

#buildObject



23
24
25
26
27
28
29
# File 'lib/cocina/models/builders/rights_description_builder.rb', line 23

def build
  return 'controlled digital lending' if object_access.controlledDigitalLending

  return ['dark'] if object_access.view == 'dark'

  object_level_access
end

#object_accessCocina::Models::AdminPolicyDefaultAccess

This is set up to work for APOs, but this method is to be overridden on sub classes

Returns:

  • (Cocina::Models::AdminPolicyDefaultAccess)


19
20
21
# File 'lib/cocina/models/builders/rights_description_builder.rb', line 19

def object_access
  @object_access ||= cocina.administrative.accessTemplate
end