Class: Cocina::Models::Mapping::FromMods::Access
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::Access
- Defined in:
- lib/cocina/models/mapping/from_mods/access.rb
Overview
Maps access conditions
Constant Summary collapse
- ACCESS_CONDITION_TYPES =
rubocop:disable Metrics/ClassLength
{ 'restriction on access' => 'access restriction', 'restrictionOnAccess' => 'access restriction', 'restrictionsOnAccess' => 'access restriction', 'useAndReproduction' => 'use and reproduction' }.freeze
Class Method Summary collapse
-
.build(resource_element:, description_builder:, purl: nil) ⇒ Hash
A hash that can be mapped to a cocina model.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(resource_element:, description_builder:, purl:) ⇒ Access
constructor
A new instance of Access.
Constructor Details
#initialize(resource_element:, description_builder:, purl:) ⇒ Access
Returns a new instance of Access.
24 25 26 27 28 |
# File 'lib/cocina/models/mapping/from_mods/access.rb', line 24 def initialize(resource_element:, description_builder:, purl:) @resource_element = resource_element @notifier = description_builder.notifier @purl = purl end |
Class Method Details
.build(resource_element:, description_builder:, purl: nil) ⇒ Hash
Returns a hash that can be mapped to a cocina model.
20 21 22 |
# File 'lib/cocina/models/mapping/from_mods/access.rb', line 20 def self.build(resource_element:, description_builder:, purl: nil) new(resource_element: resource_element, description_builder: description_builder, purl: purl).build end |
Instance Method Details
#build ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cocina/models/mapping/from_mods/access.rb', line 30 def build {}.tap do |access| physical_locations = physical_location + shelf_location + xlink_location access[:physicalLocation] = physical_locations.presence access[:digitalLocation] = digital_location.presence access[:accessContact] = access_contact.presence access[:url] = url.presence access[:note] = (note + purl_note).presence end.compact.presence end |