Class: GeoConcerns::Discovery::GeoblacklightDocument

Inherits:
AbstractDocument show all
Defined in:
app/services/geo_concerns/discovery/geoblacklight_document.rb

Overview

For details on the schema,

Constant Summary collapse

GEOBLACKLIGHT_RELEASE_VERSION =
'v1.1.2'.freeze
GEOBLACKLIGHT_SCHEMA =
JSON.parse(open("https://raw.githubusercontent.com/geoblacklight/geoblacklight/#{GEOBLACKLIGHT_RELEASE_VERSION}/schema/geoblacklight-schema.json").read).freeze

Instance Attribute Summary

Attributes inherited from AbstractDocument

#access_rights, #creator, #dct_references, #description, #download, #fgdc, #format, #geom_type, #identifier, #iso19139, #issued, #language, #layer_modified, #layer_year, #mods, #provenance, #publisher, #resource_type, #slug, #solr_coverage, #spatial, #subject, #temporal, #thumbnail, #title, #url, #wfs_path, #wms_path, #wxs_identifier

Instance Method Summary collapse

Methods inherited from AbstractDocument

#clean_document, #to_xml

Instance Method Details

#to_hash(_args = nil) ⇒ Hash

Implements the to_hash method on the abstract document.

Parameters:

  • _args (Array<Object>) (defaults to: nil)

    arguments needed for the renderer, unused here

Returns:

  • (Hash)

    geoblacklight document as a hash



15
16
17
18
# File 'app/services/geo_concerns/discovery/geoblacklight_document.rb', line 15

def to_hash(_args = nil)
  return {} unless rights
  document
end

#to_json(_args = nil) ⇒ String

Implements the to_json method on the abstract document.

Parameters:

  • _args (Array<Object>) (defaults to: nil)

    arguments needed for the json renderer, unused here

Returns:

  • (String)

    geoblacklight document as a json string



23
24
25
26
# File 'app/services/geo_concerns/discovery/geoblacklight_document.rb', line 23

def to_json(_args = nil)
  return '{}' unless rights
  document.to_json
end