Class: AtlasRb::Admin::Resource
- Inherits:
-
Object
- Object
- AtlasRb::Admin::Resource
- Extended by:
- FaradayHelper
- Defined in:
- lib/atlas_rb/admin/resource.rb
Overview
Destructive lifecycle operations that need no type, against Atlas's
generic /resources/{id} surface.
The typed Work, Collection and
Community delegate here. See AtlasRb::Admin for why
the namespace exists and what confirm: :i_understand is for — both
apply unchanged, which is why purge did not move onto
Resource beside the other generic writes.
Constant Summary collapse
- ROUTE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Atlas REST endpoint prefix.
"/resources/"
Constants included from FaradayHelper
FaradayHelper::ASSERTION_AUDIENCE, FaradayHelper::ASSERTION_ISSUER, FaradayHelper::ASSERTION_TTL, FaradayHelper::INSTRUMENTATION_EVENT
Class Method Summary collapse
-
.destroy(id, confirm:, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response
Hard-delete a resource — a purge, not a withdrawal.
-
.restore(id, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response
Restore a previously-tombstoned resource.
Methods included from FaradayHelper
connection, multipart, read_body, read_raw, system_connection, with_file_part
Class Method Details
.destroy(id, confirm:, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response
Hard-delete a resource — a purge, not a withdrawal.
Removes the resource's metadata, cascades into its members, and removes the OCFL objects holding the preserved bytes: every retained revision, not only the current one. Nothing survives but the audit row, which records the NOIDs it removed.
Unrecoverable — prefer Resource.tombstone for the user-visible withdrawal path, which keeps everything and can be reversed. Admin-only.
42 43 44 45 46 47 48 |
# File 'lib/atlas_rb/admin/resource.rb', line 42 def self.destroy(id, confirm:, nuid: nil, on_behalf_of: nil) unless confirm == :i_understand raise ArgumentError, "AtlasRb::Admin::Resource.destroy requires confirm: :i_understand" end connection({}, nuid, on_behalf_of: on_behalf_of).delete(ROUTE + id) end |
.restore(id, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response
Restore a previously-tombstoned resource.
Reverses a withdrawal: search and show pages stop returning a withdrawn
stub. No confirm: marker — restoring is itself reversible, by
tombstoning again.
64 65 66 |
# File 'lib/atlas_rb/admin/resource.rb', line 64 def self.restore(id, nuid: nil, on_behalf_of: nil) connection({}, nuid, on_behalf_of: on_behalf_of).post(ROUTE + id + '/restore') end |