Class: Spotlight::Resources::IiifManifest
- Inherits:
-
Object
- Object
- Spotlight::Resources::IiifManifest
- 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
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Instance Method Summary collapse
- #compound_id ⇒ Object
-
#initialize(attrs = {}) ⇒ IiifManifest
constructor
A new instance of IiifManifest.
- #to_solr(exhibit: nil) ⇒ Object
- #with_exhibit(e) ⇒ Object
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
#collection ⇒ Object (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_id ⇒ Object
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 |