atlas_rb 1.22.0 → 1.24.0

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: 547ea9704ea6c2845a7573bd9518cca8d96b3a65eb3792642e3944f99ae1853a
4
- data.tar.gz: 6c3754d4d4a6c509599e66c9062268b3c30c1b967a536b0231249a0010567c19
3
+ metadata.gz: 6c096f45a9cfbbd11efce0d0d79f193341ff5d77081f920580ca20e1621423f1
4
+ data.tar.gz: 885250be775307675bb65533467f33edd8630e70a4dc8c249b1bd06d7ba26e2f
5
5
  SHA512:
6
- metadata.gz: b259694bf763b09743fc3c64fcd7f612202dec0249f35a8f3c1e211007235425de0c8d1f4c6235a5c9d3256022adb87cfffa9a43275eb25e29f2051579cc128e
7
- data.tar.gz: 8e09316edfca23f4d966ca9c4e49d7d410711241e420fa0c4f01dfa1541c66d07907e6263640b1749b2b19203709441d3282f494b5526218c583116cc19b24e5
6
+ metadata.gz: 2d20b72fafff966ece826ff60782ebb33dad8826390ce682e663409affa982350fbfad3a1e1206c850a96f850b619a7964116c4bc8ef2377d2b4fc471726eb07
7
+ data.tar.gz: e8e92d11281fadf833efb1eaff9b3d41e65662202981bc4837c68adf00761c789d9aa42d82a8081caa3f010bbc455a57a4cf051458c5ebea0fa382f80f5b51bb
data/.version CHANGED
@@ -1 +1 @@
1
- 1.22.0
1
+ 1.24.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.24.0
4
+
5
+ These bindings need Atlas 0.6.213 or later.
6
+
7
+ ### Added — `reason:` on `Resource.tombstone`
8
+
9
+ ```ruby
10
+ AtlasRb::Resource.tombstone(work_id, reason: "Removed from view by legal order", nuid: admin_nuid)
11
+ ```
12
+
13
+ The library's withdrawal policy requires a note saying why an object was
14
+ removed, and fixes its wording. `reason:` must be one of the policy's five
15
+ notes, word for word. Atlas answers `422` with `invalid_reason` for any other
16
+ value, and the call returns that raw response as before. The note carries no
17
+ date: read `tombstoned_at` for that.
18
+
19
+ Community, Collection, Work and FileSet reads return the note as
20
+ `tombstone_reason`, including the `410` body of a tombstoned read. A restore
21
+ clears it. Omit the keyword to tombstone with no note, as before.
22
+
23
+ ## 1.23.0
24
+
25
+ These bindings need Atlas 0.6.212 or later.
26
+
27
+ ### Added — `Work.withdrawn_assets`, the listing a Restore needs
28
+
29
+ ```ruby
30
+ AtlasRb::Work.withdrawn_assets(work_id, nuid: admin_nuid).each do |asset|
31
+ AtlasRb::Admin::Resource.restore(asset.file_set, nuid: admin_nuid)
32
+ end
33
+ ```
34
+
35
+ A FileSet withdrawn with `Resource.tombstone` drops out of `Work.assets` and
36
+ `Work.file_sets`, so nothing listed it. This read lists the assets of a Work's
37
+ withdrawn FileSets, in the `Work.assets` shape plus the FileSet's
38
+ `tombstoned_at` and `tombstoned_by`. Atlas allows it for the admin and
39
+ devolved-admin tiers; anyone else gets a `403`, which raises `ResourceError`. A
40
+ missing Work returns `nil`.
41
+
42
+ ### Documented — `file_set` on every `Work.assets` and `Work.file_sets` entry
43
+
44
+ Each asset entry carries the NOID of the FileSet it is listed under. That is
45
+ the id `Resource.tombstone` and `Admin::Resource.restore` take, so a caller no
46
+ longer needs `Blob.ancestry` to find it. No reader change.
47
+
3
48
  ## 1.22.0
4
49
 
5
50
  These bindings need Atlas 0.6.211 or later.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.22.0)
4
+ atlas_rb (1.24.0)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
data/README.md CHANGED
@@ -543,7 +543,7 @@ write. The whole surface:
543
543
  | `Resource.set_permissions(id, acl)` | `PATCH /resources/{id}/permissions` |
544
544
  | `Resource.set_thumbnails(id, thumbnail:, thumbnail_2x:, preview:)` | `PATCH /resources/{id}/thumbnails` |
545
545
  | `Resource.reparent(id, parent_id)` | `PATCH /resources/{id}/parent` |
546
- | `Resource.tombstone(id)` | `POST /resources/{id}/tombstone` |
546
+ | `Resource.tombstone(id, reason:)` | `POST /resources/{id}/tombstone` |
547
547
  | `Admin::Resource.restore(id)` | `POST /resources/{id}/restore` |
548
548
  | `Admin::Resource.destroy(id, confirm: :i_understand)` | `DELETE /resources/{id}` |
549
549
 
@@ -144,14 +144,23 @@ module AtlasRb
144
144
  # {Work.file_sets}. Atlas refuses a FileSet from anyone outside the admin and
145
145
  # devolved-admin tiers with `403`, even a user who can edit the Work.
146
146
  #
147
+ # `reason:` records why the resource was removed (Atlas 0.6.213 or later).
148
+ # It must be one of the removal notes the library's withdrawal policy
149
+ # allows, word for word; Atlas answers `422` with `invalid_reason` for any
150
+ # other value. The note carries no date: read `tombstoned_at` for that.
151
+ # The resource returns it as `tombstone_reason`, and a restore clears it.
152
+ #
147
153
  # @param id [String] the resource's NOID.
154
+ # @param reason [String, nil] one of the policy's removal notes, or `nil`
155
+ # for none.
148
156
  # @param nuid [String, nil] the acting user's NUID, stamped on the resource
149
157
  # as `tombstoned_by`.
150
158
  # @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
151
159
  # header.
152
160
  # @return [Faraday::Response] the raw response — read `status` yourself.
153
- def self.tombstone(id, nuid: nil, on_behalf_of: nil)
154
- connection({}, nuid, on_behalf_of: on_behalf_of).post('/resources/' + id + '/tombstone')
161
+ def self.tombstone(id, reason: nil, nuid: nil, on_behalf_of: nil)
162
+ connection({}, nuid, on_behalf_of: on_behalf_of)
163
+ .post('/resources/' + id + '/tombstone', { reason: reason }.compact.to_json)
155
164
  end
156
165
 
157
166
  # Atlas answers a write with the resource under its type key, matching what
data/lib/atlas_rb/work.rb CHANGED
@@ -440,7 +440,11 @@ module AtlasRb
440
440
  # A Blob entry also carries `language` and `track_label`, set by {Blob.create}
441
441
  # and {Blob.update} for a caption or other text track and `nil` otherwise
442
442
  # (Atlas 0.6.211 or later). A FileSet withdrawn with {Resource.tombstone}
443
- # drops out of this listing and {.file_sets}.
443
+ # drops out of this listing and {.file_sets}; {.withdrawn_assets} lists it.
444
+ #
445
+ # Every entry carries `file_set`, the NOID of the FileSet it is listed
446
+ # under (Atlas 0.6.212 or later). That is the id {Resource.tombstone} and
447
+ # {Admin::Resource.restore} take to withdraw or restore the file.
444
448
  #
445
449
  # @param id [String] the Work ID.
446
450
  # @param nuid [String, nil] optional acting user's NUID. On the relay-signing
@@ -465,6 +469,44 @@ module AtlasRb
465
469
  end
466
470
  end
467
471
 
472
+ # List the assets of a Work's withdrawn FileSets, so they can be restored.
473
+ #
474
+ # Wraps `GET /works/<id>/withdrawn_assets` (Atlas 0.6.212 or later). A
475
+ # FileSet withdrawn with {Resource.tombstone} drops out of {.assets} and
476
+ # {.file_sets}; this is the listing that still names it. Each entry has the
477
+ # {.assets} shape, including `file_set` (the id to pass to
478
+ # {Admin::Resource.restore}), plus the FileSet's `tombstoned_at` and
479
+ # `tombstoned_by`.
480
+ #
481
+ # Atlas allows it for the admin and devolved-admin tiers only, the same
482
+ # tiers that may tombstone and restore a FileSet.
483
+ #
484
+ # @param id [String] the Work ID.
485
+ # @param nuid [String, nil] optional acting user's NUID. On the relay-signing
486
+ # path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
487
+ # path it is ignored (identity lives in the token).
488
+ # @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
489
+ # header. Falls through to {AtlasRb.config}.default_on_behalf_of when
490
+ # omitted.
491
+ # @return [Array<AtlasRb::Mash>, nil] one entry per asset of a withdrawn
492
+ # FileSet; `[]` when nothing is withdrawn.
493
+ #
494
+ # `nil` when Atlas answers `404` — nothing is there to read, or, with a
495
+ # misconfigured `ATLAS_URL`, the route is not Atlas's at all.
496
+ # @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
497
+ # (a `403` for a caller below the delegate tier, a `5xx`, a proxy's
498
+ # `503`), carrying Atlas's status and body so the failure is attributable
499
+ # at the boundary.
500
+ # @example Offer Restore for a removed caption
501
+ # AtlasRb::Work.withdrawn_assets("w-789", nuid: admin_nuid).each do |a|
502
+ # AtlasRb::Admin::Resource.restore(a.file_set, nuid: admin_nuid)
503
+ # end
504
+ def self.withdrawn_assets(id, nuid: nil, on_behalf_of: nil)
505
+ read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get(ROUTE + id + '/withdrawn_assets')) do |body|
506
+ body.map { |entry| AtlasRb::Mash.new(entry) }
507
+ end
508
+ end
509
+
468
510
  # List a Work's page FileSets in order, each with its assets.
469
511
  #
470
512
  # Wraps `GET /works/<id>/file_sets` — the ordered, grouped sibling of
@@ -473,7 +515,7 @@ module AtlasRb
473
515
  # (`null`-position) FileSets last; metadata and derivative-container
474
516
  # FileSets are excluded as entries. Each entry nests its downloadable
475
517
  # assets — the page's content Blobs plus any per-page IIIF Delegates —
476
- # in the same polymorphic shape {.assets} returns.
518
+ # in the same polymorphic shape {.assets} returns, `file_set` included.
477
519
  #
478
520
  # This is the read a IIIF Presentation manifest assembler needs: the
479
521
  # response is **unpaginated** by design, so the whole page sequence
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: 1.22.0
4
+ version: 1.24.0
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-09-29 00:00:00.000000000 Z
11
+ date: 2026-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday