Module: Geoblacklight::SolrDocument
- Extended by:
- Blacklight::Solr::Document
- Includes:
- Arcgis, Carto, Finder, Inspection
- Defined in:
- app/models/concerns/geoblacklight/solr_document.rb,
app/models/concerns/geoblacklight/solr_document/carto.rb,
app/models/concerns/geoblacklight/solr_document/arcgis.rb,
app/models/concerns/geoblacklight/solr_document/finder.rb,
app/models/concerns/geoblacklight/solr_document/inspection.rb
Overview
Extends Blacklight::Solr::Document for GeoBlacklight specific functionalit
Defined Under Namespace
Modules: Arcgis, Carto, Finder, Inspection
Instance Method Summary
collapse
Methods included from Arcgis
#arcgis_urls
Methods included from Inspection
#inspectable?
Methods included from Carto
#carto_reference, #cartodb_reference
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
101
102
103
104
105
106
107
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 101
def method_missing(method, *args, &block)
if /.*_url$/ =~ method.to_s
checked_endpoint(method.to_s.gsub('_url', ''))
else
super
end
end
|
Instance Method Details
#available? ⇒ Boolean
15
16
17
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 15
def available?
public? || same_institution?
end
|
#bounding_box_as_wsen ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 67
def bounding_box_as_wsen
geom_field = fetch(Settings.FIELDS.GEOMETRY, '')
exp = /^\s*ENVELOPE\(
\s*([-\.\d]+)\s*,
\s*([-\.\d]+)\s*,
\s*([-\.\d]+)\s*,
\s*([-\.\d]+)\s*
\)\s*$/x bbox_match = exp.match(geom_field)
return geom_field unless bbox_match w, e, n, s = bbox_match.captures
"#{w} #{s} #{e} #{n}"
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
94
95
96
97
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 94
def checked_endpoint(type)
type = references.send(type)
type.endpoint if type.present?
end
|
#data_dictionary_download ⇒ Object
51
52
53
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 51
def data_dictionary_download
references.data_dictionary.to_hash unless references.data_dictionary.blank?
end
|
#direct_download ⇒ Object
35
36
37
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 35
def direct_download
references.download.to_hash unless references.download.blank?
end
|
#downloadable? ⇒ Boolean
27
28
29
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 27
def downloadable?
(direct_download || download_types.present? || iiif_download) && available?
end
|
#external_url ⇒ Object
55
56
57
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 55
def external_url
references.url.endpoint if references.url
end
|
85
86
87
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 85
def file_format
fetch(Settings.FIELDS.FILE_FORMAT)
end
|
#hgl_download ⇒ Object
39
40
41
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 39
def hgl_download
references.hgl.to_hash unless references.hgl.blank?
end
|
#iiif_download ⇒ Object
47
48
49
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 47
def iiif_download
references.iiif.to_hash unless references.iiif.blank?
end
|
#item_viewer ⇒ Object
59
60
61
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 59
def item_viewer
ItemViewer.new(references)
end
|
#itemtype ⇒ Object
63
64
65
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 63
def itemtype
'http://schema.org/Dataset'
end
|
#public? ⇒ Boolean
19
20
21
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 19
def public?
fetch(Settings.FIELDS.RIGHTS).casecmp('public').zero?
end
|
#references ⇒ Object
31
32
33
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 31
def references
References.new(self)
end
|
#restricted? ⇒ Boolean
23
24
25
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 23
def restricted?
fetch(Settings.FIELDS.RIGHTS).casecmp('restricted').zero?
end
|
#same_institution? ⇒ Boolean
43
44
45
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 43
def same_institution?
fetch(Settings.FIELDS.PROVENANCE).casecmp(Settings.INSTITUTION.downcase).zero?
end
|
#wxs_identifier ⇒ Object
81
82
83
|
# File 'app/models/concerns/geoblacklight/solr_document.rb', line 81
def wxs_identifier
fetch(Settings.FIELDS.WXS_IDENTIFIER, '')
end
|