Sha256: 445dbb5f3ce0db3eb1b98fce64892d4560a10a751a4c50a2496d503c2c147a05

Contents?: true

Size: 783 Bytes

Versions: 2

Compression:

Stored size: 783 Bytes

Contents

module Duracloud
  class Manifest

    BAGIT = "BAGIT".freeze
    TSV   = "TSV".freeze

    attr_reader :space_id, :store_id

    def initialize(space_id, store_id = nil)
      @space_id = space_id
      @store_id = store_id
      @tsv_response = nil
      @bagit_response = nil
    end

    def csv(opts = {})
      CSVReader.call(tsv, opts)
    end

    def tsv
      tsv_response.body
    end

    def bagit
      bagit_response.body
    end

    private

    def tsv_response
      @tsv_response ||= get_response(TSV)
    end

    def bagit_response
      @bagit_response ||= get_response(BAGIT)
    end

    def get_response(format)
      Client.get_manifest(space_id, query(format))
    end

    def query(format)
      { storeID: store_id, format: format }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
duracloud-client-0.1.1 lib/duracloud/manifest.rb
duracloud-client-0.1.0 lib/duracloud/manifest.rb