atlas_rb 1.20.0 → 1.21.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: 1ec8ebfc7fd51516a1d73d28bc426153f99a1d7d91c6b1b1bf80ffc965396b8f
4
- data.tar.gz: 284df1abb1bef59118f44483e3ba2b3680daacd03717795417395ee095950f55
3
+ metadata.gz: 0650d39388fca9d7fbdc0134ee4e76e4a82ed3c659f8c44ea96aac62a397d0c1
4
+ data.tar.gz: ab674da7f6274991b11921b60c43a93ea6e3e9f3a5ef121109fd3bc99c970cdc
5
5
  SHA512:
6
- metadata.gz: e3fc55be0dde3a6d5ff4603284de7e7b2ed4e29c628afbab32d2026befbfc2cc93d4304e4a294043319c60d79a5f51f2e06cf0957a4ffd9e28af8ffc56f64e36
7
- data.tar.gz: a8dced08d932a266c77d70cfaa90cf7d81c957efce818ce42c5a000508b48d6501ca449a1863f3a73017b2131692c6930bdcd53e282823f7957a43e5e30e38a9
6
+ metadata.gz: 2c23136adc3f95ccf1b9e0e739f95a2a86b3ee33a1cf5a52f72af625fe5c2ab77cf63c9c78990d2b36ff0d285445f56bae620da21d86af0994d590f867defe51
7
+ data.tar.gz: edac22a77b8d592ae2e3a0d77117b9ac60d7516d3a13469747ff5cb7f90a782e774d5514218bb5d368818defc538d58158ed608abd400d2cca4aaa606bff9939
data/.version CHANGED
@@ -1 +1 @@
1
- 1.20.0
1
+ 1.21.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.21.0
4
+
5
+ ### Added — `System::Work.remove_linked_member`, unlinking a showcase Work
6
+
7
+ ```ruby
8
+ AtlasRb::System::Work.remove_linked_member(work_id, old_showcase_id, on_behalf_of: depositor_nuid)
9
+ # => ["def456"]
10
+ ```
11
+
12
+ The mirror of `System::Work.add_linked_member`, over the same system connection.
13
+ It binds `DELETE /works/:id/linked_members/:collection_id`, which Atlas already
14
+ serves. Atlas runs the same two checks as the add: the Collection must be
15
+ featured, and `on_behalf_of` must own the Work. Otherwise it raises
16
+ `ForbiddenError`.
17
+
18
+ A depositor holds no `:link_member` grant, so `Work.remove_linked_member` works
19
+ only for an admin. This binding lets Cerberus change a depositor's showcase
20
+ category: remove the link to the old showcase, then add the link to the new one.
21
+
3
22
  ## 1.20.0
4
23
 
5
24
  ### Added — `System.release_embargoes`, recording lapsed embargoes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.20.0)
4
+ atlas_rb (1.21.0)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -2,15 +2,15 @@
2
2
 
3
3
  module AtlasRb
4
4
  module System
5
- # Showcase publishing: link a freshly-created Work into a depositor's
5
+ # Showcase publishing: link a depositor's Work into (or out of) a
6
6
  # featured showcase Collection on their behalf, without granting the
7
7
  # depositor themselves standing edit rights on that shared Collection.
8
8
  #
9
9
  # Atlas scopes this narrowly on both sides (see Atlas's `Ability`): the
10
10
  # target Collection must be `featured`, and the Work must belong to the
11
11
  # `on_behalf_of` NUID — never an arbitrary or private Work. Cerberus's
12
- # `WorkDeposit#create_published` ("Publish to my community") is the one
13
- # caller today.
12
+ # `WorkDeposit#create_published` ("Publish to my community") adds the link;
13
+ # changing a Work's showcase category swaps it with a remove and an add.
14
14
  #
15
15
  # Always authenticates via {FaradayHelper#system_connection}, so there is
16
16
  # no way to issue this as a regular user.
@@ -43,6 +43,35 @@ module AtlasRb
43
43
  .post("/works/#{work_id}/linked_members")&.body
44
44
  )
45
45
  end
46
+
47
+ # The mirror of {.add_linked_member}: unlink a depositor's Work from a
48
+ # featured showcase Collection on their behalf. Atlas applies the same
49
+ # two checks as the add, so a depositor can undo only a link they could
50
+ # have made.
51
+ #
52
+ # @param work_id [String] the Work ID to unlink.
53
+ # @param collection_id [String] the (must-be-featured) showcase
54
+ # Collection to unlink the Work from.
55
+ # @param on_behalf_of [String] the depositor NUID this write is
56
+ # attributed to; Atlas requires it to match the Work's depositor.
57
+ # @return [Array<String>] the Work's full set of linked Collection
58
+ # noids after the remove.
59
+ # @raise [AtlasRb::StaleResourceError] optimistic-lock conflict.
60
+ # @raise [AtlasRb::LinkedMemberError] structural rejection (HTTP 422) —
61
+ # e.g. the target Collection does not exist.
62
+ # @raise [AtlasRb::ForbiddenError] Atlas refused the unlink (HTTP 403) —
63
+ # e.g. the target Collection isn't featured, or on_behalf_of doesn't
64
+ # own the Work.
65
+ #
66
+ # @example Swapping a Work's showcase from Cerberus's Work Edit page
67
+ # AtlasRb::System::Work.remove_linked_member(work.id, old_showcase.id, on_behalf_of: depositor_nuid)
68
+ # AtlasRb::System::Work.add_linked_member(work.id, new_showcase.id, on_behalf_of: depositor_nuid)
69
+ def self.remove_linked_member(work_id, collection_id, on_behalf_of:)
70
+ JSON.parse(
71
+ system_connection({}, on_behalf_of: on_behalf_of)
72
+ .delete("/works/#{work_id}/linked_members/#{collection_id}")&.body
73
+ )
74
+ end
46
75
  end
47
76
  end
48
77
  end
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.20.0
4
+ version: 1.21.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-28 00:00:00.000000000 Z
11
+ date: 2026-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday