Module: Geoblacklight::SolrDocument

Extended by:
ActiveSupport::Concern, Blacklight::Solr::Document
Includes:
Arcgis, Citation, Finder, Inspection
Defined in:
app/models/concerns/geoblacklight/solr_document.rb,
app/models/concerns/geoblacklight/solr_document/arcgis.rb,
app/models/concerns/geoblacklight/solr_document/finder.rb,
app/models/concerns/geoblacklight/solr_document/citation.rb,
app/models/concerns/geoblacklight/solr_document/inspection.rb

Overview

Extends Blacklight::Solr::Document for GeoBlacklight specific functionality

Defined Under Namespace

Modules: Arcgis, Citation, Finder, Inspection

Instance Method Summary collapse

Methods included from Citation

#geoblacklight_citation

Methods included from Arcgis

#arcgis_urls

Methods included from Inspection

#inspectable?

Methods included from Finder

#blacklight_solr

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 35

def available?
  public? || same_institution?
end

#data_dictionary_downloadObject



79
80
81
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 79

def data_dictionary_download
  references.data_dictionary.to_hash if references.data_dictionary.present?
end

#direct_downloadObject



63
64
65
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 63

def direct_download
  references.download.to_hash if references.download.present?
end

#downloadable?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 47

def downloadable?
  (direct_download || iiif_download) && available?
end

#external_urlObject



83
84
85
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 83

def external_url
  references.url&.endpoint
end

#geometryObject



95
96
97
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 95

def geometry
  @geometry ||= Geoblacklight::Geometry.new(geom_field)
end

#iiif_downloadObject



75
76
77
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 75

def iiif_download
  references.iiif.to_hash if references.iiif.present?
end

#iiif_preview?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 51

def iiif_preview?
  viewer_protocol == "iiif" || viewer_protocol == "iiif_manifest"
end

#item_viewerObject



87
88
89
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 87

def item_viewer
  ItemViewer.new(references)
end

#itemtypeObject



91
92
93
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 91

def itemtype
  "http://schema.org/Dataset"
end

#oembedObject



67
68
69
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 67

def oembed
  references.oembed.endpoint if references.oembed.present?
end

#previewable?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 55

def previewable?
  viewer_endpoint.present?
end

#public?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 39

def public?
  rights_field_data&.casecmp?("public")
end

#referencesObject



59
60
61
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 59

def references
  References.new(self)
end

#restricted?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 43

def restricted?
  !rights_field_data || rights_field_data.casecmp?("restricted")
end

#same_institution?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 71

def same_institution?
  provider&.casecmp?(Geoblacklight.configuration.institution.downcase)
end