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.



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

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.



6
7
8
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 6

def collection
  @collection
end

Instance Method Details

#compound_idObject



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

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

#to_solrObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 14

def to_solr
  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



26
27
28
# File 'app/models/spotlight/resources/iiif_manifest.rb', line 26

def with_exhibit(e)
  @exhibit = e
end