README.md in preservation-client-0.5.0 vs README.md in preservation-client-1.0.0
- old
+ new
@@ -23,10 +23,12 @@
$ gem install preservation-client
## Usage
+Preservation::Client is a singleton object, and thus can be used as a class or an instance.
+
```ruby
require 'preservation/client'
def do_the_thing
current_version_as_integer = client.current_version('druid:oo000oo0000')
@@ -37,17 +39,32 @@
def client
@client ||= Preservation::Client.configure(url: Settings.preservation_catalog.url)
end
```
+OR
+
+```ruby
+require 'preservation/client'
+
+def initialize
+ Preservation::Client.configure(url: Settings.preservation_catalog.url)
+end
+
+def do_the_thing
+ current_version_as_integer = Preservation::Client.current_version('druid:oo000oo0000')
+end
+```
+
Note that the client may **not** be used without first having been configured, and the `url` keyword is **required**.
Note that the preservation service is behind a firewall.
## API Coverage
-druids may be with or without the "druid:" prefix - 'oo000oo0000' or 'druid:oo000oo0000'
+- druids may be with or without the "druid:" prefix - 'oo000oo0000' or 'druid:oo000oo0000'
+- methods can be called as `client_instance.objects.method` or `Preservation::Client.objects.method`
### Get the current version of a preserved object (Moab)
- `client.objects.current_version('oo000oo0000')` - returns latest version as an Integer
@@ -65,11 +82,10 @@
- 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('oo000oo0000')` - returns latest Moab::SignatureCatalog from Moab, or new Moab::SignatureCatalog for Moab if none yet exists
-
+- `client.objects.signature_catalog('oo000oo0000')` - returns latest Moab::SignatureCatalog from Moab
### 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: