atlas_rb 1.6.3 → 1.6.5
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
- data/lib/atlas_rb/person.rb +33 -12
- 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: 19c01cf68a6a94d94dceff16d5e8ea00e147b8db2c6fd51f8d6c1e9b8ec36fac
|
|
4
|
+
data.tar.gz: 457092385fc63ed58a2c2e871983bfb2a62d2d69448a74c78796d6a6f14506be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2008dd0082b8de90ca4016a8a66c378bc88a6a6cc61b44070d9fcf9c9fd13ed5d21f81787dbd1b0131194b8edbd10eaf4904366c5e496452fd689fe2eedab429
|
|
7
|
+
data.tar.gz: 801b406750972c2dc014c4e202fcb53a2d204e554197c5594015f4dd0c0b60d58839ad6aab8b7c8659399082618483be9bc918543355f06d6a7ad3d125ed7107
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.5
|
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
|
data/lib/atlas_rb/person.rb
CHANGED
|
@@ -7,30 +7,51 @@ module AtlasRb
|
|
|
7
7
|
# `users.name` is frequently wrong and is clobbered on every login), plus
|
|
8
8
|
# community affiliations.
|
|
9
9
|
#
|
|
10
|
-
# Addressed by
|
|
11
|
-
#
|
|
12
|
-
# the `nuid:` / `on_behalf_of:` keywords
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
10
|
+
# Addressed by **NOID** (like Work/Collection) — the staff-facing NUID is kept
|
|
11
|
+
# server-side and never put in a public URL. So the positional `id` argument
|
|
12
|
+
# below is the person's **NOID**, and the `nuid:` / `on_behalf_of:` keywords
|
|
13
|
+
# keep their usual gem meaning (the acting principal). NUID stays the key only
|
|
14
|
+
# for {.create} (one Person per NUID — and there `nuid:` is the *new person's*
|
|
15
|
+
# NUID, acting principal coming from the ambient `AtlasRb.config.default_nuid`)
|
|
16
|
+
# and {.resolve} (the server-side name-resolution batch). {.list} is the
|
|
17
|
+
# NOID-keyed People-index source.
|
|
16
18
|
#
|
|
17
19
|
# Create / update / affiliation writes are :system + admin on the server; a
|
|
18
20
|
# non-privileged caller gets a 403.
|
|
19
21
|
class Person < Resource
|
|
20
22
|
ROUTE = "/people/"
|
|
21
23
|
|
|
22
|
-
# Fetch a Person by
|
|
24
|
+
# Fetch a Person by NOID.
|
|
23
25
|
#
|
|
24
|
-
# @param id [String] the person's
|
|
26
|
+
# @param id [String] the person's NOID.
|
|
25
27
|
# @param nuid [String, nil] acting principal (signed into the assertion sub).
|
|
26
28
|
# @param on_behalf_of [String, nil] acting-as target.
|
|
27
|
-
# @return [AtlasRb::Mash] the unwrapped `"person"` object
|
|
29
|
+
# @return [AtlasRb::Mash] the unwrapped `"person"` object (carries the
|
|
30
|
+
# server-side `nuid` for callers that need it, e.g. depositor gating).
|
|
28
31
|
def self.find(id, nuid: nil, on_behalf_of: nil)
|
|
29
32
|
AtlasRb::Mash.new(JSON.parse(
|
|
30
33
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(ROUTE + id)&.body
|
|
31
34
|
))["person"]
|
|
32
35
|
end
|
|
33
36
|
|
|
37
|
+
# List people — the NOID-keyed People-index source. Returns the page's
|
|
38
|
+
# Persons (each with `noid`, `display_name`, and the server-side `nuid`), so
|
|
39
|
+
# a consumer builds the index and profiles entirely through atlas_rb without
|
|
40
|
+
# routing People through the catalog/Solr or exposing a NUID publicly.
|
|
41
|
+
#
|
|
42
|
+
# @param page [Integer, nil] 1-based page (server default when nil).
|
|
43
|
+
# @param per_page [Integer, nil] page size (server default when nil; capped
|
|
44
|
+
# server-side).
|
|
45
|
+
# @param nuid [String, nil] acting principal.
|
|
46
|
+
# @param on_behalf_of [String, nil] acting-as target.
|
|
47
|
+
# @return [Array<AtlasRb::Mash>] one unwrapped `"person"` per row on the page.
|
|
48
|
+
def self.list(page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
|
|
49
|
+
params = { page: page, per_page: per_page }.compact
|
|
50
|
+
JSON.parse(
|
|
51
|
+
connection(params, nuid, on_behalf_of: on_behalf_of).get(ROUTE)&.body
|
|
52
|
+
)["people"].map { |entry| AtlasRb::Mash.new(entry["person"]) }
|
|
53
|
+
end
|
|
54
|
+
|
|
34
55
|
# Batch-resolve people to their authoritative display_name in one call
|
|
35
56
|
# (supersedes the SSO users directory's resolve). Unresolved NUIDs drop.
|
|
36
57
|
#
|
|
@@ -64,7 +85,7 @@ module AtlasRb
|
|
|
64
85
|
# Edit a Person's authority fields. NUID is immutable and not patchable.
|
|
65
86
|
# Only supplied fields are changed.
|
|
66
87
|
#
|
|
67
|
-
# @param id [String] the person's
|
|
88
|
+
# @param id [String] the person's NOID.
|
|
68
89
|
# @param display_name [String, nil]
|
|
69
90
|
# @param bio [String, nil]
|
|
70
91
|
# @param orcid [String, nil]
|
|
@@ -81,7 +102,7 @@ module AtlasRb
|
|
|
81
102
|
|
|
82
103
|
# Add a community affiliation (idempotent; audited server-side).
|
|
83
104
|
#
|
|
84
|
-
# @param id [String] the person's
|
|
105
|
+
# @param id [String] the person's NOID.
|
|
85
106
|
# @param community_id [String] the community's NOID.
|
|
86
107
|
# @param nuid [String, nil] acting principal.
|
|
87
108
|
# @param on_behalf_of [String, nil] acting-as target.
|
|
@@ -96,7 +117,7 @@ module AtlasRb
|
|
|
96
117
|
|
|
97
118
|
# Remove a community affiliation (tolerant; audited server-side).
|
|
98
119
|
#
|
|
99
|
-
# @param id [String] the person's
|
|
120
|
+
# @param id [String] the person's NOID.
|
|
100
121
|
# @param community_id [String] the community's NOID.
|
|
101
122
|
# @param nuid [String, nil] acting principal.
|
|
102
123
|
# @param on_behalf_of [String, nil] acting-as target.
|