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.7.14 lib/dwc-archive/metadata.rb
dwc-archive-0.7.13 lib/dwc-archive/metadata.rb
dwc-archive-0.7.12 lib/dwc-archive/metadata.rb
dwc-archive-0.7.11 lib/dwc-archive/metadata.rb
dwc-archive-0.7.10 lib/dwc-archive/metadata.rb
dwc-archive-0.7.9 lib/dwc-archive/metadata.rb
dwc-archive-0.7.8 lib/dwc-archive/metadata.rb
dwc-archive-0.7.7 lib/dwc-archive/metadata.rb
dwc-archive-0.7.6 lib/dwc-archive/metadata.rb
dwc-archive-0.7.5 lib/dwc-archive/metadata.rb
dwc-archive-0.7.4 lib/dwc-archive/metadata.rb
dwc-archive-0.7.3 lib/dwc-archive/metadata.rb
dwc-archive-0.7.2 lib/dwc-archive/metadata.rb
dwc-archive-0.7.1 lib/dwc-archive/metadata.rb
dwc-archive-0.7.0 lib/dwc-archive/metadata.rb
dwc-archive-0.6.0 lib/dwc-archive/metadata.rb
dwc-archive-0.5.18 lib/dwc-archive/metadata.rb
dwc-archive-0.5.17 lib/dwc-archive/metadata.rb
dwc-archive-0.5.16 lib/dwc-archive/metadata.rb
dwc-archive-0.5.15 lib/dwc-archive/metadata.rb