Class: Spotlight::Resources::IiifHarvester

Inherits:
Spotlight::Resource show all
Defined in:
app/models/spotlight/resources/iiif_harvester.rb

Overview

harvest Images from IIIF Manifest and turn them into a Spotlight::Resource Note: IIIF API : iiif.io/api/presentation/2.0

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spotlight::Resource

#document_model, #reindex_later, #save_and_index

Class Method Details

.indexing_pipelineObject



18
19
20
21
22
23
24
25
26
# File 'app/models/spotlight/resources/iiif_harvester.rb', line 18

def self.indexing_pipeline
  @indexing_pipeline ||= super.dup.tap do |pipeline|
    pipeline.sources = [Spotlight::Etl::Sources::SourceMethodSource(:iiif_manifests)]

    pipeline.transforms = [
      ->(data, p) { data.merge(p.source.to_solr(exhibit: p.context.resource.exhibit)) }
    ] + pipeline.transforms
  end
end

Instance Method Details

#iiif_manifestsObject



14
15
16
# File 'app/models/spotlight/resources/iiif_harvester.rb', line 14

def iiif_manifests
  @iiif_manifests ||= IiifService.parse(url)
end