README.md in hydra-ezid-0.0.1 vs README.md in hydra-ezid-0.0.2

- old
+ new

@@ -1,8 +1,8 @@ # Hydra::Ezid [![Version](https://badge.fury.io/rb/hydra-ezid.png)](http://badge.fury.io/rb/hydra-ezid) [![Build Status](https://travis-ci.org/psu-stewardship/hydra-ezid.png?branch=master)](https://travis-ci.org/psu-stewardship/hydra-ezid) [![Dependency Status](https://gemnasium.com/psu-stewardship/hydra-ezid.png)](https://gemnasium.com/psu-stewardship/hydra-ezid) -A Rails engine providing EZID services for Hydra applications +A Ruby gem providing EZID services for Hydra applications ## Installation Add this line to your application's Gemfile: @@ -16,38 +16,57 @@ $ gem install hydra-ezid ## Usage -### Mount the engine to get the routes in config/routes.rb +### Make your Models Identifiable by EZID - mount Hydra::Ezid::Engine => '/' +First, add a config file to your app in `config/ezid.yml` that looks like the following: -### Call button_to_mint_ezid view helper in your search result page template. +```yaml +doi: + user: "foo" + pass: "bar" + scheme: "doi" + shoulder: "sldr1" + naa: "10.1000" -First add `helper :ezid` to your `catalog_controller.rb` - -Next, we recommend putting the view helper in catalog/[_sort_and_per_page.html.erb](https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_sort_and_per_page.html.erb) which you will manually override in your app: -```erb -<%= button_to_mint_ezid %> +ark: + user: "foo" + pass: "quux" + scheme: "ark" + shoulder: "sldr2" + naa: "98765" ``` -### Any time you want to refer to the routes from hydra-ezid use ezid. +Add `include Hydra::Ezid::Identifiable` to the models you want EZIDs for. -ezid.new_ezid_path - -### Make your Models Ezid-able - -Add `include Hydra::Ezid::ModelMethods` to the models for anything that you want to be able to mint EZIDs for. - Example: ```ruby class GenericFile < ActiveFedora::Base - include Hydra::Ezid::ModelMethods - ... + 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 ``` -### Setup instructions for Contributors +And then you can mint EZIDs on your model instances: + +```ruby +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