Sha256: 33fd40dd579872ddf38908562a90c3c63af44daf0565788bad353a91bd665f80
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
module Geoblacklight # References is a geoblacklight-schema dct:references parser class References attr_reader :refs def initialize(document) @document = document @refs = parse_references.map { |ref| Reference.new(ref) } end def method_missing(m, *args, &b) if Geoblacklight::Constants::URI.key?(m) references m else super end end def format @document[:dc_format_s] end def references(ref_type) @refs.find { |reference| reference.type == ref_type } end def parse_references if @document[:dct_references_s].nil? Hash.new else JSON.parse(@document[:dct_references_s]) end end def preferred_download return file_download unless download.blank? end def file_download { file_download: download.to_hash } end def downloads_by_format case format when 'Shapefile' if wfs && wms { shapefile: wfs.to_hash, kmz: wms.to_hash, geojson: wfs.to_hash } if wms.present? && wfs.present? end when 'GeoTIFF' { geotiff: wms.to_hash } if wms.present? when 'ArcGRID' { arcgrid: wms.to_hash } if wms.present? end end def download_types downloads_by_format end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geoblacklight-0.3.1 | lib/geoblacklight/references.rb |
geoblacklight-0.3.0 | lib/geoblacklight/references.rb |