Sha256: 5923ff6d5b46d7783202ae1512d7d7bd0847ee8dd369f09bdb7e8decb2b90af4

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

module Geoblacklight
  # Extends Blacklight::Solr::Document for GeoBlacklight specific functionalit
  module SolrDocument
    extend Blacklight::Solr::Document

    def available?
      public? || same_institution?
    end

    def public?
      get(:dc_rights_s).downcase == 'public'
    end

    def restricted?
      get(:dc_rights_s).downcase == 'restricted'
    end

    def downloadable?
      download_types.present? && available?
    end

    def download_types
      references.download_types
    end

    def references
      References.new(self)
    end

    def direct_download
      return references.download.to_hash unless references.download.blank?
    end

    def same_institution?
      get(:dct_provenance_s).downcase == Settings.INSTITUTION.downcase
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoblacklight-0.2.0 lib/geoblacklight/solr_document.rb
geoblacklight-0.1.0 lib/geoblacklight/solr_document.rb