atlas_rb 1.6.3 → 1.6.4

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: 63326317e9bb9abcd730807bdfe9870d24685da7fec108474f676198ed1de200
4
- data.tar.gz: 16a31a4c9708699c92f4651714594a3ead821a882cc4e958b0ae81a86b0c5146
3
+ metadata.gz: 5c1b8b2ec2ef5cadfe63ee85f618f8ef0ce394e9d7cc49637750250594ecd414
4
+ data.tar.gz: d59e9ac145408d33e00ddcc89f92cee6126b32e5c1959467a042080f14f49bb6
5
5
  SHA512:
6
- metadata.gz: 6236b86dd4a2b0c2c8740fb9479a9584a59fe1303464b7731ae955e0ceb5489e920d7a119d1bac6afb1535933310b7ccecee74d3da6a865a6bdb755a38a9c095
7
- data.tar.gz: 0c80e8c9f82b3a05ba5560e703db3da1c1c10ceae61dd95a06c3e8368fa07a503e8a12bcb66d2ae5d0ed398af7386d54943cad754f319ef31dd9669149e8c490
6
+ metadata.gz: 42992114ad5685f700294dd0f52d5c55507182d4ae0f907a2077c35a534cb7e8052a5d4a7a266f435ae1964341ca15d28c85688e8ff559ff60eb067c48994a7d
7
+ data.tar.gz: dc7a7df1a1fba8e4766a47c648c37f85a99244d105ebe6f564f09953fcda29837b111f41e730e871ca20afd032ed9db46dfe7dcd64e41badc550816d8c66f56e
data/.version CHANGED
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.6.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.6.3)
4
+ atlas_rb (1.6.4)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -44,6 +44,9 @@ module AtlasRb
44
44
  # @param xml_path [String, nil] optional path to a MODS XML file used to
45
45
  # seed metadata. When given, the Collection is created and immediately
46
46
  # patched with the metadata in the file.
47
+ # @param featured [Boolean] mark the Collection as a genre-showcase
48
+ # ("Featured") Collection. Defaults to false. Use when provisioning a
49
+ # Community's showcase set (loop create + featured: true).
47
50
  # @param nuid [String, nil] optional acting user's NUID. On the relay-signing
48
51
  # path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
49
52
  # path it is ignored (identity lives in the token).
@@ -53,11 +56,11 @@ module AtlasRb
53
56
  # @return [Hash] the created Collection payload (post-update if
54
57
  # `xml_path` was supplied).
55
58
  #
56
- # @example
57
- # AtlasRb::Collection.create("c-123", "/tmp/collection-mods.xml")
58
- def self.create(id, xml_path = nil, nuid: nil, on_behalf_of: nil)
59
+ # @example A featured showcase collection
60
+ # AtlasRb::Collection.create("c-123", featured: true)
61
+ def self.create(id, xml_path = nil, featured: false, nuid: nil, on_behalf_of: nil)
59
62
  result = AtlasRb::Mash.new(JSON.parse(
60
- connection({ parent_id: id }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
63
+ connection({ parent_id: id, featured: featured }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
61
64
  ))["collection"]
62
65
  return result unless xml_path.present?
63
66
 
@@ -65,6 +68,27 @@ module AtlasRb
65
68
  find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
66
69
  end
67
70
 
71
+ # Toggle the showcase "Featured" flag on an existing Collection.
72
+ #
73
+ # A resource-attribute write (not a MODS update), so it does not touch
74
+ # descriptive metadata. Cerberus reads the projected `featured_bsi` to
75
+ # badge the Collection in a community's browse.
76
+ #
77
+ # @param id [String] the Collection ID.
78
+ # @param featured [Boolean] the new flag value.
79
+ # @param nuid [String, nil] optional acting user's NUID.
80
+ # @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
81
+ # header. Falls through to {AtlasRb.config}.default_on_behalf_of when omitted.
82
+ # @return [AtlasRb::Mash] the updated `"collection"` object, already unwrapped.
83
+ #
84
+ # @example
85
+ # AtlasRb::Collection.set_featured("col-456", true)
86
+ def self.set_featured(id, featured, nuid: nil, on_behalf_of: nil)
87
+ AtlasRb::Mash.new(JSON.parse(
88
+ connection({ featured: featured }, nuid, on_behalf_of: on_behalf_of).patch(ROUTE + id)&.body
89
+ ))["collection"]
90
+ end
91
+
68
92
  # Move a Collection to a different parent Community.
69
93
  #
70
94
  # Wraps `PATCH /collections/<id>/parent` with a `parent_id` of the new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff