Class: Zizia::PreIngestWork
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Zizia::PreIngestWork
- Defined in:
- app/models/zizia/pre_ingest_work.rb
Instance Method Summary collapse
-
#thumbnails ⇒ Array<String>
Returns thumbnail urls based on the work’s deduplication_key.
-
#title ⇒ String
Returns the title based on the deduplication_key if the work has been indexed to solr.
Instance Method Details
#thumbnails ⇒ Array<String>
Returns thumbnail urls based on the work’s deduplication_key
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/zizia/pre_ingest_work.rb', line 18 def thumbnails thumbnail_urls = [] return thumbnail_urls if deduplication_key.nil? file_sets = ActiveFedora::SolrService.get("deduplication_key_tesim:#{deduplication_key}") .dig('response', 'docs', 0, 'file_set_ids_ssim') return thumbnail_urls unless file_sets file_sets.each do |file_set_id| thumbnail_urls.push(ActiveFedora::SolrService.get("id:#{file_set_id}") .dig('response', 'docs', 0, 'thumbnail_path_ss')) end thumbnail_urls end |
#title ⇒ String
Returns the title based on the deduplication_key if the work has been indexed to solr
8 9 10 11 12 13 14 |
# File 'app/models/zizia/pre_ingest_work.rb', line 8 def title return 'This work does not have a deduplication key.' if deduplication_key.nil? solr_title = ActiveFedora::SolrService.get("deduplication_key_tesim:#{deduplication_key}") .dig('response', 'docs', 0, 'title_tesim', 0) return solr_title unless solr_title.nil? 'This work\'s metadata has not been indexed yet.' end |