Sha256: 4717a644c9febc0ae5acd3595c4f556f868d804c30ca242f9cb44e8aef0bd5bb

Contents?: true

Size: 935 Bytes

Versions: 7

Compression:

Stored size: 935 Bytes

Contents

require 'ezid-client'

module Ddr::IngestTools::ManifestArkMinter
  class Minter

    DEFAULT_EXPORT  = 'no'.freeze
    DEFAULT_PROFILE = 'dc'.freeze
    DEFAULT_STATUS  = Ezid::Status::RESERVED

    def initialize
      configure_ark
      configure_client
    end

    def mint
      Ezid::Identifier.mint
    end

    private

    def configure_ark
      Ezid::Identifier.defaults = {
          export: DEFAULT_EXPORT,
          profile: DEFAULT_PROFILE,
          status: DEFAULT_STATUS
      }
    end

    def configure_client
      Ezid::Client.configure do |config|
        config.default_shoulder = module_configuration.ezid_default_shoulder
        config.password = module_configuration.ezid_password
        config.user = module_configuration.ezid_user
        config.logger = Logger.new(File::NULL)
      end
    end

    def module_configuration
      Ddr::IngestTools::ManifestArkMinter.configuration
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.6.0 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.5.0 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.5.0.rc3 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.5.0.rc2 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.5.0.rc1 lib/ddr/ingesttools/manifest_ark_minter/minter.rb
ddr-ingesttools-0.4.0 lib/ddr/ingesttools/manifest_ark_minter/minter.rb