Class: IIIFManifest::ManifestBuilder::RecordPropertyBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_manifest/manifest_builder/record_property_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, iiif_search_service_factory:, iiif_autocomplete_service_factory:) ⇒ RecordPropertyBuilder

Returns a new instance of RecordPropertyBuilder.



5
6
7
8
9
# File 'lib/iiif_manifest/manifest_builder/record_property_builder.rb', line 5

def initialize(record, iiif_search_service_factory:, iiif_autocomplete_service_factory:)
  @record = record
  @iiif_search_service_factory = iiif_search_service_factory
  @iiif_autocomplete_service_factory = iiif_autocomplete_service_factory
end

Instance Attribute Details

#iiif_autocomplete_service_factoryObject (readonly)

Returns the value of attribute iiif_autocomplete_service_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/record_property_builder.rb', line 4

def iiif_autocomplete_service_factory
  @iiif_autocomplete_service_factory
end

#iiif_search_service_factoryObject (readonly)

Returns the value of attribute iiif_search_service_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/record_property_builder.rb', line 4

def iiif_search_service_factory
  @iiif_search_service_factory
end

#recordObject (readonly)

Returns the value of attribute record.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/record_property_builder.rb', line 4

def record
  @record
end

Instance Method Details

#apply(manifest) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/iiif_manifest/manifest_builder/record_property_builder.rb', line 11

def apply(manifest)
  manifest['@id'] = record.manifest_url.to_s
  label = Array(::IIIFManifest.config.manifest_value_for(record, property: :label)).first
  manifest.label = label
  description = Array(::IIIFManifest.config.manifest_value_for(record, property: :description)).first
  manifest.description = description
  manifest.viewing_hint = viewing_hint if viewing_hint.present?
  manifest.viewing_direction = viewing_direction if viewing_direction.present?
  manifest. = record. if valid_metadata?
  manifest.service = services if search_service.present?
  manifest
end