Sha256: e63ff3e6eab5ac4067d6dab8beb5753ad530cf58b05b3900f34968521b4f46d9
Contents?: true
Size: 1.07 KB
Versions: 11
Compression:
Stored size: 1.07 KB
Contents
module IIIFManifest class ManifestBuilder class ResourceBuilder attr_reader :display_image, :iiif_resource_factory, :image_service_builder_factory def initialize(display_image, iiif_resource_factory:, image_service_builder_factory:) @display_image = display_image @iiif_resource_factory = iiif_resource_factory @image_service_builder_factory = image_service_builder_factory end def apply(annotation) resource['@id'] = display_image.url resource['@type'] = 'dctypes:Image' resource['height'] = display_image.height resource['width'] = display_image.width resource['format'] = display_image.format image_service_builder.apply(resource) if iiif_endpoint annotation.resource = resource end private def resource @resource ||= iiif_resource_factory.new end def iiif_endpoint display_image.try(:iiif_endpoint) end def image_service_builder image_service_builder_factory.new(iiif_endpoint) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems