Sha256: 4a6f3521f5da0809cab7fd32819d547fc7da1340208bbc4652bb81fbf972d5c6

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

module BlacklightOaiProvider
  module SolrDocument
    extend ActiveSupport::Concern

    def timestamp
      timestamp = get(self.class.timestamp_key)
      raise BlacklightOaiProvider::Exceptions::MissingTimestamp if timestamp.blank?
      Time.zone.parse(timestamp) # Solr timestamps are all in UTC.
    end

    def to_oai_dc
      export_as('oai_dc_xml')
    end

    def sets
      BlacklightOaiProvider::SolrSet.sets_for(self)
    end

    module ClassMethods
      attr_writer :timestamp_key

      def timestamp_key
        @timestamp_key ||= 'timestamp'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight_oai_provider-5.0.0 app/models/concerns/blacklight_oai_provider/solr_document.rb
blacklight_oai_provider-5.0.0.pre1 app/models/concerns/blacklight_oai_provider/solr_document.rb