Class: AtlasRb::Delegate

Inherits:
Resource show all
Defined in:
lib/atlas_rb/delegate.rb

Overview

A server-managed derivative asset attached to a Work — thumbnails, previews, and other generated representations.

Unlike a Blob, a Delegate is not user-uploaded binary content; it is produced and addressed by Atlas itself. Each Delegate exposes a uri pointing at the underlying bytes plus enough metadata (mime_type, original_filename, label, use) for clients to render or link to it without fetching the bytes first.

Lookups accept either the resource NOID or the valkyrie_id: Atlas redirects NOIDs to /delegates/:valkyrie_id and Faraday transparently follows the redirect.

See also: Work, Blob.

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 for this resource.

"/delegates/"

Class Method Summary collapse

Methods inherited from Resource

permissions, preview

Methods included from FaradayHelper

#connection, #multipart

Class Method Details

.find(id) ⇒ AtlasRb::Mash

Fetch a single Delegate by NOID or valkyrie_id.

Examples:

AtlasRb::Delegate.find("d-555")

Parameters:

  • id (String)

    the Delegate's NOID or valkyrie_id.

Returns:

  • (AtlasRb::Mash)

    the "delegate" object, already unwrapped — includes id, valkyrie_id, use, uri, mime_type, original_filename, label, and tombstone fields.



32
33
34
# File 'lib/atlas_rb/delegate.rb', line 32

def self.find(id)
  AtlasRb::Mash.new(JSON.parse(connection({}).get(ROUTE + id)&.body))["delegate"]
end