README.md in ezid-client-0.12.0 vs README.md in ezid-client-0.13.0

- old
+ new

@@ -27,12 +27,12 @@ [Mint an identifier on a shoulder](http://ezid.cdlib.org/doc/apidoc.html#operation-mint-identifier) ``` >> identifier = Ezid::Identifier.create(shoulder: "ark:/99999/fk4") -I, [2014-12-04T15:06:02.428445 #86655] INFO -- : EZID MINT ark:/99999/fk4 -- success: ark:/99999/fk4rx9d523 -I, [2014-12-04T15:06:03.249793 #86655] INFO -- : EZID GET ark:/99999/fk4rx9d523 -- success: ark:/99999/fk4rx9d523 +I, [2014-12-04T15:06:02.428445 #86655] INFO -- : EZID MintIdentifier -- success: ark:/99999/fk4rx9d523 +I, [2014-12-04T15:06:03.249793 #86655] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk4rx9d523 => #<Ezid::Identifier id="ark:/99999/fk4rx9d523" status="public" target="http://ezid.cdlib.org/id/ark:/99999/fk4rx9d523" created="2014-12-04 20:06:02 UTC"> >> identifier.id => "ark:/99999/fk4rx9d523" >> identifier.status => "public" @@ -58,29 +58,29 @@ New identifiers will then be minted on the default shoulder when a shoulder is not specified: ``` >> identifier = Ezid::Identifier.create -I, [2014-12-09T11:22:34.499860 #32279] INFO -- : EZID MINT ark:/99999/fk4 -- success: ark:/99999/fk43f4wd4v -I, [2014-12-09T11:22:35.317181 #32279] INFO -- : EZID GET ark:/99999/fk43f4wd4v -- success: ark:/99999/fk43f4wd4v +I, [2014-12-09T11:22:34.499860 #32279] INFO -- : EZID MintIdentifier -- success: ark:/99999/fk43f4wd4v +I, [2014-12-09T11:22:35.317181 #32279] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk43f4wd4v => #<Ezid::Identifier id="ark:/99999/fk43f4wd4v" status="public" target="http://ezid.cdlib.org/id/ark:/99999/fk43f4wd4v" created="2014-12-09 16:22:35 UTC"> ``` [Create a specific identifier](http://ezid.cdlib.org/doc/apidoc.html#operation-create-identifier) ``` >> identifier = Ezid::Identifier.create(id: "ark:/99999/fk4rx9d523/12345") -I, [2014-12-09T11:21:42.077297 #32279] INFO -- : EZID CREATE ark:/99999/fk4rx9d523/12345 -- success: ark:/99999/fk4rx9d523/12345 -I, [2014-12-09T11:21:42.808534 #32279] INFO -- : EZID GET ark:/99999/fk4rx9d523/12345 -- success: ark:/99999/fk4rx9d523/12345 +I, [2014-12-09T11:21:42.077297 #32279] INFO -- : EZID CreateIdentifier -- success: ark:/99999/fk4rx9d523/12345 +I, [2014-12-09T11:21:42.808534 #32279] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk4rx9d523/12345 => #<Ezid::Identifier id="ark:/99999/fk4rx9d523/12345" status="public" target="http://ezid.cdlib.org/id/ark:/99999/fk4rx9d523/12345" created="2014-12-09 16:21:42 UTC"> ``` **Retrieve** (Get Metadata) ``` >> identifier = Ezid::Identifier.find("ark:/99999/fk4rx9d523") -I, [2014-12-04T15:07:00.648676 #86655] INFO -- : EZID GET ark:/99999/fk4rx9d523 -- success: ark:/99999/fk4rx9d523 +I, [2014-12-04T15:07:00.648676 #86655] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk4rx9d523 => #<Ezid::Identifier id="ark:/99999/fk4rx9d523" status="public" target="http://ezid.cdlib.org/id/ark:/99999/fk4rx9d523" created="2014-12-04 20:06:02 UTC"> ``` **Update** (Modify) @@ -88,12 +88,12 @@ >> identifier.target => "http://ezid.cdlib.org/id/ark:/99999/fk43f4wd4v" >> identifier.target = "http://example.com" => "http://example.com" >> identifier.save -I, [2014-12-09T11:24:26.321801 #32279] INFO -- : EZID MODIFY ark:/99999/fk43f4wd4v -- success: ark:/99999/fk43f4wd4v -I, [2014-12-09T11:24:27.039288 #32279] INFO -- : EZID GET ark:/99999/fk43f4wd4v -- success: ark:/99999/fk43f4wd4v +I, [2014-12-09T11:24:26.321801 #32279] INFO -- : EZID ModifyIdentifier -- success: ark:/99999/fk43f4wd4v +I, [2014-12-09T11:24:27.039288 #32279] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk43f4wd4v => #<Ezid::Identifier id="ark:/99999/fk43f4wd4v" status="public" target="http://example.com" created="2014-12-09 16:22:35 UTC"> >> identifier.target => "http://example.com" ``` @@ -101,18 +101,36 @@ *Identifier status must be "reserved" to delete.* http://ezid.cdlib.org/doc/apidoc.html#operation-delete-identifier ``` >> identifier = Ezid::Identifier.create(shoulder: "ark:/99999/fk4", status: "reserved") -I, [2014-12-04T15:12:39.976930 #86734] INFO -- : EZID MINT ark:/99999/fk4 -- success: ark:/99999/fk4n58pc0r -I, [2014-12-04T15:12:40.693256 #86734] INFO -- : EZID GET ark:/99999/fk4n58pc0r -- success: ark:/99999/fk4n58pc0r +I, [2014-12-04T15:12:39.976930 #86734] INFO -- : EZID MintIdentifier -- success: ark:/99999/fk4n58pc0r +I, [2014-12-04T15:12:40.693256 #86734] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk4n58pc0r => #<Ezid::Identifier id="ark:/99999/fk4n58pc0r" status="reserved" target="http://ezid.cdlib.org/id/ark:/99999/fk4n58pc0r" created="2014-12-04 20:12:39 UTC"> >> identifier.delete -I, [2014-12-04T15:12:48.853964 #86734] INFO -- : EZID DELETE ark:/99999/fk4n58pc0r -- success: ark:/99999/fk4n58pc0r +I, [2014-12-04T15:12:48.853964 #86734] INFO -- : EZID DeleteIdentifier -- success: ark:/99999/fk4n58pc0r => #<Ezid::Identifier id="ark:/99999/fk4n58pc0r" DELETED> ``` +## Batch Download + +Instantiate an `Ezid::Client` and call `batch_download` with hash options -- see http://ezid.cdlib.org/doc/apidoc.html#parameters. Repeated values should be given as an array value for the parameter key. + +Note that, due to the asynchronous nature of this request, the response only returns the URL at which the batch will be available to download (as described in the EZID documentation). Use the `notify` option to specify one or more email addresses to receive notification when the download file is actually available. + +**Example** + +``` +>> c = Ezid::Client.new +=> #<Ezid::Client connection=#<Net::HTTP ezid.cdlib.org:443 open=false> user="eziduser" session=CLOSED> +>> response = c.batch_download(format: "csv", notify: "eziduser@example.com", column: ["_id", "_target", "_status", "_profile", "_export", "_created", "_updated"], convertTimestamps: "yes", permanence: "real", owner: "eziduser") +I, [2015-02-20T15:16:53.462660 #55850] INFO -- : EZID BatchDownload -- success: http://ezid.cdlib.org/download/473deecb96.csv.gz +=> #<Net::HTTPOK 200 OK readbody=true> +>> response.download_url +=> "http://ezid.cdlib.org/download/da543b91a0.csv.gz" +``` + ## Metadata handling Accessors are provided to ease the use of EZID [reserved metadata elements](http://ezid.cdlib.org/doc/apidoc.html#internal-metadata) and [metadata profiles](http://ezid.cdlib.org/doc/apidoc.html#metadata-profiles): **Reserved elements** can be read and written using the name of the element without the leading underscore: @@ -167,12 +185,12 @@ Then new identifiers will receive the defaults: ``` >> identifier = Ezid::Identifier.create(shoulder: "ark:/99999/fk4") -I, [2014-12-09T11:38:37.335136 #32279] INFO -- : EZID MINT ark:/99999/fk4 -- success: ark:/99999/fk4zs2w500 -I, [2014-12-09T11:38:38.153546 #32279] INFO -- : EZID GET ark:/99999/fk4zs2w500 -- success: ark:/99999/fk4zs2w500 +I, [2014-12-09T11:38:37.335136 #32279] INFO -- : EZID MintIdentifier -- success: ark:/99999/fk4zs2w500 +I, [2014-12-09T11:38:38.153546 #32279] INFO -- : EZID GetIdentifierMetadata -- success: ark:/99999/fk4zs2w500 => #<Ezid::Identifier id="ark:/99999/fk4zs2w500" status="reserved" target="http://ezid.cdlib.org/id/ark:/99999/fk4zs2w500" created="2014-12-09 16:38:38 UTC"> >> identifier.profile => "dc" >> identifier.status => "reserved" @@ -228,9 +246,33 @@ - At client initialization (only if explicitly instantiating `Ezid::Client`): ```ruby client = Ezid::Client.new(host: "localhost", port: 80) +``` + +## HTTP Timeout + +The default HTTP timeout is set to 300 seconds (5 minutes). The setting can be customized: + +- By environment variable: + +```sh +export EZID_TIMEOUT=600 +``` + +- Client configuration: + +```ruby +Ezid::Client.configure do |config| + config.timeout = 600 +end +``` + +- At client initialization + +```ruby +client = Ezid::Client.new(timeout: 600) ``` ## Test Helper If you have tests that (directly or indirectly) use `ezid-client` you may want to require the test helper module: