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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
102
103
104
105
106
107
108
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 102
def method_missing(method, *args, &block)
if /.*_url$/.match?(method.to_s)
checked_endpoint(method.to_s.gsub("_url", ""))
else
super
end
end
|
Instance Method Details
#available? ⇒ Boolean
34
35
36
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 34
def available?
public? || same_institution?
end
|
#checked_endpoint(type) ⇒ Object
Provides a convenience method to access a SolrDocument’s References endpoint url without having to check and see if it is available :type => a string which if its a Geoblacklight::Constants::URI key
will return a coresponding Geoblacklight::Reference
95
96
97
98
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 95
def checked_endpoint(type)
type = references.public_send(type)
type.endpoint if type.present?
end
|
#data_dictionary_download ⇒ Object
70
71
72
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 70
def data_dictionary_download
references.data_dictionary.to_hash if references.data_dictionary.present?
end
|
#direct_download ⇒ Object
54
55
56
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 54
def direct_download
references.download.to_hash if references.download.present?
end
|
#downloadable? ⇒ Boolean
46
47
48
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 46
def downloadable?
(direct_download || download_types.present? || iiif_download) && available?
end
|
#external_url ⇒ Object
74
75
76
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 74
def external_url
references.url&.endpoint
end
|
#geometry ⇒ Object
86
87
88
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 86
def geometry
@geometry ||= Geoblacklight::Geometry.new(geom_field)
end
|
#iiif_download ⇒ Object
66
67
68
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 66
def iiif_download
references.iiif.to_hash if references.iiif.present?
end
|
#item_viewer ⇒ Object
78
79
80
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 78
def item_viewer
ItemViewer.new(references)
end
|
#itemtype ⇒ Object
82
83
84
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 82
def itemtype
"http://schema.org/Dataset"
end
|
#oembed ⇒ Object
58
59
60
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 58
def oembed
references.oembed.endpoint if references.oembed.present?
end
|
#public? ⇒ Boolean
38
39
40
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 38
def public?
rights_field_data&.casecmp?("public")
end
|
#references ⇒ Object
50
51
52
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 50
def references
References.new(self)
end
|
#restricted? ⇒ Boolean
42
43
44
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 42
def restricted?
!rights_field_data || rights_field_data.casecmp?("restricted")
end
|
#same_institution? ⇒ Boolean
62
63
64
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 62
def same_institution?
provider&.casecmp?(Settings.INSTITUTION.downcase)
end
|