README.md in preservation-client-0.3.0 vs README.md in preservation-client-0.4.0
- old
+ new
@@ -1,13 +1,13 @@
[![Gem Version](https://badge.fury.io/rb/preservation-client.svg)](https://badge.fury.io/rb/preservation-client)
[![Build Status](https://travis-ci.org/sul-dlss/preservation-client.svg?branch=master)](https://travis-ci.org/sul-dlss/preservation-client)
[![Maintainability](https://api.codeclimate.com/v1/badges/00d2d8957226777105b3/maintainability)](https://codeclimate.com/github/sul-dlss/preservation-client/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/00d2d8957226777105b3/test_coverage)](https://codeclimate.com/github/sul-dlss/preservation-client/test_coverage)
-# Preservation::Client
+# preservation-client
-Preservation::Client is a Ruby gem that acts as a client to the RESTful HTTP APIs provided by [preservation_catalog](https://github.com/sul-dlss/preservation_catalog).
+preservation-client is a Ruby gem that acts as a client to the RESTful HTTP APIs provided by [preservation_catalog](https://github.com/sul-dlss/preservation_catalog).
## Installation
Add this line to your application's Gemfile:
@@ -23,18 +23,15 @@
$ gem install preservation-client
## Usage
-To configure and use the client, here's an example:
-
```ruby
require 'preservation/client'
def do_the_thing
- # This API endpoint returns an integer
- current_version_as_integer = client.current_version(params: { druid: 'druid:123' })
+ current_version_as_integer = client.current_version('druid:oo000oo0000')
end
private
def client
@@ -46,19 +43,40 @@
Note that the preservation service is behind a firewall.
## API Coverage
-- Preservation::Client.objects.current_version('oo000oo0000') (can also be 'druid:oo000oo0000')
-- Preservation::Client.objects.checksums(druids: druids) - will return raw csv
-- Preservation::Client.objects.checksums(druids: druids, format: 'json') - will return json
-- Preservation::Client.objects.content(druid: 'oo000oo0000', filepath: 'my_file.pdf') - will return contents of my_file.pdf in most recent version of Moab object
-- Preservation::Client.objects.content(druid: 'oo000oo0000', filepath: 'my_file.pdf', version: '1') - will return contents of my_file.pdf in version 1 of Moab object
-- Preservation::Client.objects.manifest(druid: 'oo000oo0000', filepath: 'versionInventory.xml') - will return contents of versionInventory.xml in most recent version of Moab object
-- Preservation::Client.objects.manifest(druid: 'oo000oo0000', filepath: 'versionInventory.xml', version: '3') - will return contents of versionInventory.xml in version 3 of Moab object
-- Preservation::Client.objects.metadata(druid: 'oo000oo0000', filepath: 'identityMetadata.xml') - will return contents of identityMetadata.xml in most recent version of Moab object
-- Preservation::Client.objects.metadata(druid: 'oo000oo0000', filepath: 'identityMetadata.xml', version: '8') - will return contents of identityMetadata.xml in version 8 of Moab object
-- Preservation::Client.objects.signature_catalog(druid: 'oo000oo0000') - will return contents of latest version of signatureCatalog.xml from Moab object
+druids may be with or without the "druid:" prefix - 'oo000oo0000' or 'druid:oo000oo0000'
+
+### Get the current version of a preserved object (Moab)
+
+- `client.objects.current_version('oo000oo0000')` - returns latest version as an Integer
+
+### Retrieve file signature (checksum) information
+
+- `client.objects.checksums(druids: druids)` - returns info as raw csv
+- `client.objects.checksums(druids: druids, format: 'json')` - returns info as json
+
+### Retrieve individual files from preservation
+
+- `client.objects.content(druid: 'oo000oo0000', filepath: 'my_file.pdf')` - returns contents of my_file.pdf in most recent version of Moab object
+ - You may specify the version:
+ - `client.objects.content(druid: 'oo000oo0000', filepath: 'my_file.pdf', version: '1')` - returns contents of my_file.pdf in version 1 of Moab object
+- `client.objects.manifest(druid: 'oo000oo0000', filepath: 'versionInventory.xml')` - returns contents of versionInventory.xml in most recent version of Moab object
+ - You may specify the version:
+ - `client.objects.manifest(druid: 'oo000oo0000', filepath: 'versionInventory.xml', version: '3')` - returns contents of versionInventory.xml in version 3 of Moab object
+- `client.objects.metadata(druid: 'oo000oo0000', filepath: 'identityMetadata.xml')` - returns contents of identityMetadata.xml in most recent version of Moab object
+ - You may specify the version:
+ - `client.objects.metadata(druid: 'oo000oo0000', filepath: 'identityMetadata.xml', version: '8')` - returns contents of identityMetadata.xml in version 8 of Moab object
+- `client.objects.signature_catalog(druid: 'oo000oo0000')` - returns contents of latest version of signatureCatalog.xml from Moab object
+
+### Get difference information between passed contentMetadata.xml and files in the Moab
+
+- `client.objects.content_inventory_diff(druid: 'oo000oo0000', content_metadata: '<contentMetadata>...</contentMetadata>')` - returns Moab::FileInventoryDifference containing differences between passed content metadata and latest version for subset 'all'
+ - you may specify the subset (all|shelve|preserve|publish) and/or the version:
+ - `client.objects.content_inventory_diff(druid: 'oo000oo0000', subset: 'publish', version: '1', content_metadata: '<contentMetadata>...</contentMetadata>')`
+
+- `client.objects.shelve_content_diff(druid: 'oo000oo0000', content_metadata: '<contentMetadata>...</contentMetadata>')` - returns Moab::FileGroupDifference containing differences between passed content metadata and latest version for subset 'shelve'
## Development
After checking out the repo, run `bundle` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.