atlas_rb 0.0.92 → 0.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ecdf5a4da61e030d7220fc9094a43bd91a850eaa1c599179d75c3d5381b300a
4
- data.tar.gz: eea705d4f0601b112b2182848241c5439ef4beb10b87e87939e73ea70eb30907
3
+ metadata.gz: ed41f31beac084721efa710b8ed828897ee1634ce3dd399171180e7ed9cb7111
4
+ data.tar.gz: 66066b767f77db9265294fdf019c2e35dd6b795de3f9c0b5509affeb9f11e39f
5
5
  SHA512:
6
- metadata.gz: 4aa3b1a2367bde1309f589eebf0bf9bf8ff9f744dc1cdf5648c820cd4d38b4e2afa496a9b50308947f00cb9ceab4d10df4e92018d7715ad7928aa415fb556e0c
7
- data.tar.gz: b006492ee9c5adde683c863d06cf7cbd233848709e6aa6176e0e6b2fbd663f81f70166b0e7da4889a9005e47c7ecd3cc39e7aa58bde32461b15b4448b18d786d
6
+ metadata.gz: 9bffda9eb2af9d591e28c245ee041375d4e0dc0d884c26a86caf6fc1433c4dad1534a5e804f18a7b4b9a69cb03f1d679d96df7358d66c59357ad3830d5c5c04e
7
+ data.tar.gz: 53fd40e34d0ea636d3b987f9739f364bb9528453f3514b2bb107dcc8db29ddaa28fbbe2380c330a77478c2c574ecb39e76ca6259998217fe896fe11f32255df8
data/.version CHANGED
@@ -1 +1 @@
1
- 0.0.92
1
+ 0.0.94
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (0.0.92)
4
+ atlas_rb (0.0.94)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -11,7 +11,7 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  diff-lcs (1.6.1)
14
- faraday (2.14.1)
14
+ faraday (2.14.2)
15
15
  faraday-net_http (>= 2.0, < 3.5)
16
16
  json
17
17
  logger
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AtlasRb
4
+ # A server-managed derivative asset attached to a {Work} — thumbnails,
5
+ # previews, and other generated representations.
6
+ #
7
+ # Unlike a {Blob}, a Delegate is not user-uploaded binary content; it is
8
+ # produced and addressed by Atlas itself. Each Delegate exposes a `uri`
9
+ # pointing at the underlying bytes plus enough metadata
10
+ # (`mime_type`, `original_filename`, `label`, `use`) for clients to
11
+ # render or link to it without fetching the bytes first.
12
+ #
13
+ # Lookups accept either the resource NOID or the `valkyrie_id`: Atlas
14
+ # redirects NOIDs to `/delegates/:valkyrie_id` and Faraday transparently
15
+ # follows the redirect.
16
+ #
17
+ # See also: {Work}, {Blob}.
18
+ class Delegate < Resource
19
+ # Atlas REST endpoint prefix for this resource.
20
+ # @api private
21
+ ROUTE = "/delegates/"
22
+
23
+ # Fetch a single Delegate by NOID or `valkyrie_id`.
24
+ #
25
+ # @param id [String] the Delegate's NOID or `valkyrie_id`.
26
+ # @return [AtlasRb::Mash] the `"delegate"` object, already unwrapped —
27
+ # includes `id`, `valkyrie_id`, `use`, `uri`, `mime_type`,
28
+ # `original_filename`, `label`, and tombstone fields.
29
+ #
30
+ # @example
31
+ # AtlasRb::Delegate.find("d-555")
32
+ def self.find(id)
33
+ AtlasRb::Mash.new(JSON.parse(connection({}).get(ROUTE + id)&.body))["delegate"]
34
+ end
35
+ end
36
+ end
data/lib/atlas_rb/work.rb CHANGED
@@ -189,19 +189,28 @@ module AtlasRb
189
189
  AtlasRb::Mash.new(JSON.parse(connection({ metadata: values }).patch(ROUTE + id)&.body))
190
190
  end
191
191
 
192
- # List the {FileSet}s and {Blob}s attached to a Work.
192
+ # List the assets attached to a Work — {Blob}s and {Delegate}s alike.
193
193
  #
194
194
  # Useful for building download UIs — the response includes enough to
195
- # render each file's display name, size, and download URL.
195
+ # render each entry's display name, size or `uri`, and download URL.
196
+ # The shape is polymorphic: Blob-backed entries carry fields like
197
+ # `size`, while Delegate-backed entries carry `uri`. Callers should
198
+ # duck-type on the field they need rather than expecting a single
199
+ # schema.
196
200
  #
197
201
  # @param id [String] the Work ID.
198
- # @return [Array<AtlasRb::Mash>] the listing from `GET /works/<id>/files`,
199
- # one entry per attached file.
202
+ # @return [Array<AtlasRb::Mash>] the listing from `GET /works/<id>/assets`,
203
+ # one entry per attached asset.
200
204
  #
201
205
  # @example
202
- # AtlasRb::Work.files("w-789").each { |f| puts f.label }
206
+ # AtlasRb::Work.assets("w-789").each { |a| puts a.label }
207
+ def self.assets(id)
208
+ JSON.parse(connection({}).get(ROUTE + id + '/assets')&.body).map { |entry| AtlasRb::Mash.new(entry) }
209
+ end
210
+
211
+ # @deprecated Use {.assets} instead. Will be removed in the next release.
203
212
  def self.files(id)
204
- JSON.parse(connection({}).get(ROUTE + id + '/files')&.body).map { |entry| AtlasRb::Mash.new(entry) }
213
+ assets(id)
205
214
  end
206
215
 
207
216
  # Fetch the Work's MODS representation in the requested format.
data/lib/atlas_rb.rb CHANGED
@@ -13,6 +13,7 @@ require_relative "atlas_rb/collection"
13
13
  require_relative "atlas_rb/work"
14
14
  require_relative "atlas_rb/file_set"
15
15
  require_relative "atlas_rb/blob"
16
+ require_relative "atlas_rb/delegate"
16
17
  require_relative "atlas_rb/user"
17
18
 
18
19
  # Ruby client for the Atlas API — Northeastern University's institutional
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.92
4
+ version: 0.0.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
11
+ date: 2026-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -118,6 +118,7 @@ files:
118
118
  - lib/atlas_rb/blob.rb
119
119
  - lib/atlas_rb/collection.rb
120
120
  - lib/atlas_rb/community.rb
121
+ - lib/atlas_rb/delegate.rb
121
122
  - lib/atlas_rb/faraday_helper.rb
122
123
  - lib/atlas_rb/file_set.rb
123
124
  - lib/atlas_rb/mash.rb