Class: Spotlight::Resources::IiifManifest

Inherits:
Object
  • Object
show all
Defined in:
app/models/spotlight/resources/iiif_manifest.rb

Overview

A PORO to construct a solr hash for a given IiifManifest

Defined Under Namespace

Classes: Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ IiifManifest

Returns a new instance of IiifManifest.



10
11
12
13
14
15
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 10

def initialize(attrs = {})
  @url = attrs[:url]
  @manifest = attrs[:manifest]
  @collection = attrs[:collection]
  @solr_hash = {}
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



8
9
10
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 8

def collection
  @collection
end

Instance Method Details

#compound_idObject



35
36
37
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 35

def compound_id
  Digest::MD5.hexdigest("#{exhibit.id}-#{url}")
end

#to_solr(exhibit: nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 17

def to_solr(exhibit: nil)
  @exhibit = exhibit if exhibit

  add_document_id
  add_label
  add_thumbnail_url
  add_full_image_urls
  add_manifest_url
  add_image_urls
  
  add_collection_id
  solr_hash
end

#with_exhibit(e) ⇒ Object



31
32
33
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 31

def with_exhibit(e)
  @exhibit = e
end