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 +4 -4
- data/.version +1 -1
- data/Gemfile.lock +1 -1
- data/lib/atlas_rb/collection.rb +28 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c1b8b2ec2ef5cadfe63ee85f618f8ef0ce394e9d7cc49637750250594ecd414
|
|
4
|
+
data.tar.gz: d59e9ac145408d33e00ddcc89f92cee6126b32e5c1959467a042080f14f49bb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42992114ad5685f700294dd0f52d5c55507182d4ae0f907a2077c35a534cb7e8052a5d4a7a266f435ae1964341ca15d28c85688e8ff559ff60eb067c48994a7d
|
|
7
|
+
data.tar.gz: dc7a7df1a1fba8e4766a47c648c37f85a99244d105ebe6f564f09953fcda29837b111f41e730e871ca20afd032ed9db46dfe7dcd64e41badc550816d8c66f56e
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.4
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/collection.rb
CHANGED
|
@@ -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",
|
|
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
|