Hydra::Ezid Version Build Status Dependency Status

A Ruby gem providing EZID services for Hydra applications

Installation

Add this line to your application's Gemfile:

gem 'hydra-ezid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hydra-ezid

Usage

Make your Models Identifiable by EZID

First, add a config file to your app in config/ezid.yml that looks like the following:

doi:
  user: "foo"
  pass: "bar"
  scheme: "doi"
  shoulder: "sldr1"
  naa: "10.1000"

ark:
  user: "foo"
  pass: "quux"
  scheme: "ark"
  shoulder: "sldr2"
  naa: "98765"

Add include Hydra::Ezid::Identifiable to the models you want EZIDs for.

Example:

class GenericFile < ActiveFedora::Base
  include Hydra::Ezid::Identifiable
  ezid_config do
    store_doi at: :descMetadata, in: :my_doi
    store_ark at: :properties, in: :some_ark
    find_creator at: :descMetadata, in: :author
    find_title at: :properties
    find_publisher at: :properties
    find_publication_year at: :descMetadata, in: :pubYear
end

And then you can mint EZIDs on your model instances:

gf = GenericFile.find('id:123')
gf.mint_ezid # will mint both a DOI and an ARK per the snippet above
gf.mint_ezid(Hydra::Ezid.config(except_keys: :doi)) # will mint only an ARK
gf.mint_doi # shortcut version of prior method
gf.mint_ezid(Hydra::Ezid.config(except_keys: :ark)) # will mint only a DOI
gf.mint_ark # shortcut version of prior method

Developers

In order to make modifications to the gem code and run the tests, clone the repository then

    $ bundle install
    $ git submodule init
    $ git submodule update
    $ rake jetty:config
    $ rake jetty:start
    $ rake clean
    $ rake spec

License

The hydra-ezid source code is freely available under the Apache 2.0 license. Read the copyright statement and license.

Acknowledgements

This software has been developed by and is brought to you by the Hydra community. Learn more at the Project Hydra website

Project Hydra Logo