Sha256: 24455920a714a958afbf2e709a691428293efd6e6717b3b56c4a670bdcaac2a9

Contents?: true

Size: 1 KB

Versions: 52

Compression:

Stored size: 1 KB

Contents

class DarwinCore
  class Metadata
    def initialize(archive = nil)
      @archive = archive
      @metadata = @archive.eml
    end

    def data
      @metadata
    end

    def id
      @metadata[:eml][:dataset][:attributes][:id] rescue nil
    end

    def title
      @metadata[:eml][:dataset][:title] rescue nil
    end

    def authors
      return nil unless defined?(@metadata[:eml][:dataset][:creator])
      @metadata[:eml][:dataset][:creator] = [@metadata[:eml][:dataset][:creator]] unless @metadata[:eml][:dataset][:creator].class == Array 
      @metadata[:eml][:dataset][:creator].map {|c| {:first_name => c[:individualName][:givenName], :last_name => c[:individualName][:surName], :email => c[:electronicMailAddress]}}
    end

    def abstract
      @metadata[:eml][:dataset][:abstract] rescue nil
    end

    def citation
      @metadata[:eml][:additionalMetadata][:metadata][:citation] rescue nil
    end

    def url
      @metadata[:eml][:dataset][:distribution][:online][:url] rescue nil
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
dwc-archive-0.4.9 lib/dwc-archive/metadata.rb
dwc-archive-0.4.8 lib/dwc-archive/metadata.rb
dwc-archive-0.4.7 lib/dwc-archive/metadata.rb
dwc-archive-0.4.6 lib/dwc-archive/metadata.rb
dwc-archive-0.4.5 lib/dwc-archive/metadata.rb
dwc-archive-0.4.4 lib/dwc-archive/metadata.rb
dwc-archive-0.4.3 lib/dwc-archive/metadata.rb
dwc-archive-0.4.2 lib/dwc-archive/metadata.rb
dwc-archive-0.4.1 lib/dwc-archive/metadata.rb
dwc-archive-0.4.0 lib/dwc-archive/metadata.rb
dwc-archive-0.3.1 lib/dwc-archive/metadata.rb
dwc-archive-0.3.0 lib/dwc-archive/metadata.rb