Sha256: 66486c6846481cff6644d0846e4f9cc056586c909a8cf7996500b4729e702cda

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

module GeoConcerns
  module Discovery
    class AbstractDocument
      attr_accessor :id, :provenance, :creator, :subject, :spatial, :temporal,
                    :title, :identifier, :description, :access_rights, :language,
                    :publisher, :slug, :solr_coverage, :geo_rss_coverage, :layer_year,
                    :date_modified, :geom_type, :format, :resource_type, :wxs_identifier,
                    :dct_references, :fgdc, :iso19139, :mods, :download, :url, :thumbnail

      # Cleans the document hash by removing unused fields.
      # @param [Hash] document hash
      # @return [Hash] cleaned document hash
      def clean_document(hash)
        hash.delete_if do |_k, v|
          begin
            v.nil? || v.empty?
          rescue
            false
          end
        end
      end

      def to_hash(_arg)
        raise 'this method should be overriden and return the document as a hash'
      end

      def to_json(_arg)
        raise 'this method should be overriden and return the document as json'
      end

      def to_xml(_arg)
        raise 'this method should be overriden and return the document as xml'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geo_concerns-0.0.7 app/services/geo_concerns/discovery/abstract_document.rb
geo_concerns-0.0.6 app/services/geo_concerns/discovery/abstract_document.rb
geo_concerns-0.0.5 app/services/geo_concerns/discovery/abstract_document.rb