Sha256: 0f218a459ce79ec9c6896ac11afb147a5fbe5dc30cddcd56c92d4f3db3941f09

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

module GeoWorks
  module Discovery
    class AbstractDocument
      attr_accessor :identifier, :provenance, :creator, :subject, :spatial, :temporal,
                    :title, :description, :access_rights, :language, :issued,
                    :publisher, :slug, :solr_coverage, :layer_year,
                    :layer_modified, :geom_type, :format, :resource_type, :wxs_identifier,
                    :dct_references, :fgdc, :iso19139, :mods, :download, :url, :thumbnail,
                    :wxs_identifier, :wms_path, :wfs_path

      # 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

6 entries across 6 versions & 1 rubygems

Version Path
geo_works-0.2.0 app/services/geo_works/discovery/abstract_document.rb
geo_works-0.1.4 app/services/geo_works/discovery/abstract_document.rb
geo_works-0.1.3 app/services/geo_works/discovery/abstract_document.rb
geo_works-0.1.2 app/services/geo_works/discovery/abstract_document.rb
geo_works-0.1.1 app/services/geo_works/discovery/abstract_document.rb
geo_works-0.1.0 app/services/geo_works/discovery/abstract_document.rb