Class: Preservation::Client::Objects
- Inherits:
-
VersionedApiService
- Object
- VersionedApiService
- Preservation::Client::Objects
- Defined in:
- lib/preservation/client/objects.rb
Overview
API calls that are about Preserved Objects
Instance Method Summary collapse
-
#checksum(druid:) ⇒ Hash
The checksums and filesize for the druid.
-
#content(druid:, filepath:, version: nil, on_data: nil) ⇒ Object
retrieve a content file from a Moab object.
-
#content_inventory_diff(druid:, content_metadata:, subset: 'all', version: nil) ⇒ Moab::FileInventoryDifference
Differences of passed contentMetadata.xml with latest (or specified) version in Moab for all files (default) or a specified subset (shelve|preserve|publish).
-
#current_version(druid) ⇒ Integer
The current version of the Preserved Object.
-
#manifest(druid:, filepath:, version: nil) ⇒ Object
retrieve a manifest file from a Moab object.
-
#metadata(druid:, filepath:, version: nil) ⇒ Object
retrieve a metadata file from a Moab object.
-
#shelve_content_diff(druid:, content_metadata:) ⇒ Moab::FileGroupDifference
convenience method for retrieving the differences in content files that should be “shelved” (altered in stacks) (or nil if no such differences).
-
#signature_catalog(druid) ⇒ Moab::SignatureCatalog
convenience method for retrieving latest Moab::SignatureCatalog from a Moab object,.
-
#validate_moab(druid:) ⇒ String
calls the endpoint to queue a ValidateMoab job for a specific druid typically called by a preservationIngestWF robot.
Methods inherited from VersionedApiService
Constructor Details
This class inherits a constructor from Preservation::Client::VersionedApiService
Instance Method Details
#checksum(druid:) ⇒ Hash
Returns the checksums and filesize for the druid.
13 14 15 |
# File 'lib/preservation/client/objects.rb', line 13 def checksum(druid:) get_json("objects/#{druid}/checksum", druid) end |
#content(druid:, filepath:, version: nil, on_data: nil) ⇒ Object
retrieve a content file from a Moab object
53 54 55 |
# File 'lib/preservation/client/objects.rb', line 53 def content(druid:, filepath:, version: nil, on_data: nil) file(druid, 'content', filepath, version, on_data: on_data) end |
#content_inventory_diff(druid:, content_metadata:, subset: 'all', version: nil) ⇒ Moab::FileInventoryDifference
Returns differences of passed contentMetadata.xml with latest (or specified) version in Moab for all files (default) or a specified subset (shelve|preserve|publish).
24 25 26 27 28 |
# File 'lib/preservation/client/objects.rb', line 24 def content_inventory_diff(druid:, content_metadata:, subset: 'all', version: nil) result = post("objects/#{druid}/content_diff", content_metadata: , subset: subset, version: version) Moab::FileInventoryDifference.parse(result) end |
#current_version(druid) ⇒ Integer
Returns the current version of the Preserved Object.
43 44 45 46 |
# File 'lib/preservation/client/objects.rb', line 43 def current_version(druid) resp_body = get_json("objects/#{druid}.json", druid) resp_body[:current_version] end |
#manifest(druid:, filepath:, version: nil) ⇒ Object
retrieve a manifest file from a Moab object
61 62 63 |
# File 'lib/preservation/client/objects.rb', line 61 def manifest(druid:, filepath:, version: nil) file(druid, 'manifest', filepath, version) end |
#metadata(druid:, filepath:, version: nil) ⇒ Object
retrieve a metadata file from a Moab object
69 70 71 |
# File 'lib/preservation/client/objects.rb', line 69 def (druid:, filepath:, version: nil) file(druid, 'metadata', filepath, version) end |
#shelve_content_diff(druid:, content_metadata:) ⇒ Moab::FileGroupDifference
convenience method for retrieving the differences in content files that should be “shelved” (altered in stacks)
(or nil if no such differences)
36 37 38 39 |
# File 'lib/preservation/client/objects.rb', line 36 def shelve_content_diff(druid:, content_metadata:) inventory_diff = content_inventory_diff(druid: druid, content_metadata: , subset: 'shelve') inventory_diff.group_difference('content') end |
#signature_catalog(druid) ⇒ Moab::SignatureCatalog
convenience method for retrieving latest Moab::SignatureCatalog from a Moab object,
85 86 87 |
# File 'lib/preservation/client/objects.rb', line 85 def signature_catalog(druid) Moab::SignatureCatalog.parse manifest(druid: druid, filepath: 'signatureCatalog.xml') end |
#validate_moab(druid:) ⇒ String
calls the endpoint to queue a ValidateMoab job for a specific druid typically called by a preservationIngestWF robot
78 79 80 |
# File 'lib/preservation/client/objects.rb', line 78 def validate_moab(druid:) get("objects/#{druid}/validate_moab", {}, on_data: nil) end |