atlas_rb 1.8.7 → 1.8.9
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/CHANGELOG.md +15 -0
- data/Gemfile.lock +1 -1
- data/lib/atlas_rb/resource.rb +78 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fd50831467b065989eb0ec39af5f96b87622c5d0e161e0e6a5bdef61764505a
|
|
4
|
+
data.tar.gz: 55c36e14086a0fab3776771c797af98c9a431cca3f0b09f14ffac478ab58067c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7aea8252388df4686a31174ca154b7e76da1d97dd16a8509f773bd2b918dfb282ccb93960f5138b0581df9d32d20c45a0f8cf4a1475dda787468644e1d83cdbd
|
|
7
|
+
data.tar.gz: 25e3ecf9a7cc353645a8a1ad76700523bba185895fcf1df13b9b098549a45287fb3a9c41abb0eefa559f5e1d8b4c8c4b81b7c16e5e418f4cee39e5f0d554dc56
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.8.
|
|
1
|
+
1.8.9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.8
|
|
4
|
+
|
|
5
|
+
### Added — type-agnostic current MODS (`Resource.mods`)
|
|
6
|
+
|
|
7
|
+
New polymorphic wrapper `AtlasRb::Resource.mods(id, kind = nil, …)` for Atlas's
|
|
8
|
+
`GET /resources/:id/mods` — fetch the current descriptive MODS of any Modsable
|
|
9
|
+
resource (Work / Collection / Community) by NOID, without knowing its type.
|
|
10
|
+
Returns the raw response body, mirroring the typed `Work.mods` / `Collection.mods`
|
|
11
|
+
/ `Community.mods`; output is byte-identical to the typed routes. `kind` omitted
|
|
12
|
+
yields the JSON projection (server default); pass `"xml"` for MODS XML.
|
|
13
|
+
|
|
14
|
+
Collapses the `children → find_many (for klass) → dispatch-by-klass` two-step a
|
|
15
|
+
bulk MODS exporter needed just to pick the typed MODS URL down to one call per
|
|
16
|
+
member. `404` (unknown id / non-Modsable / no MODS) comes back as an empty body.
|
|
17
|
+
|
|
3
18
|
## 1.8.7
|
|
4
19
|
|
|
5
20
|
### Added — personal-access token lifecycle (`System::Token.mint` / `.revoke`)
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/resource.rb
CHANGED
|
@@ -88,6 +88,52 @@ module AtlasRb
|
|
|
88
88
|
).map { |node| AtlasRb::Mash.new(node) }
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
# Every Work beneath a resource, at any depth — the structural counterpart
|
|
92
|
+
# to {Compilation.contents}. Wraps `GET /resources/<id>/descendant_works`,
|
|
93
|
+
# which flattens the resource's full descendant subtree to the Works it
|
|
94
|
+
# contains, gated to what the caller may read and paginated Solr-side. Gives
|
|
95
|
+
# a Collection the flatten-to-Works capability a Set already has, so a bulk
|
|
96
|
+
# export (e.g. hyperion) pages one gated, fast call family instead of the
|
|
97
|
+
# client-side `children → find_many → recurse` walk.
|
|
98
|
+
#
|
|
99
|
+
# Returns the same digest shape as {find_many} / {Compilation.contents}
|
|
100
|
+
# (`{ "id", "noid", "klass", "title", "thumbnail" }`) under a `"works"` key,
|
|
101
|
+
# plus a `"pagination"` envelope (`total` / `page` / `per_page` / `pages`).
|
|
102
|
+
# Membership is **structural** (`a_member_of`) only; pass
|
|
103
|
+
# `include_linked: true` to also surface linked members
|
|
104
|
+
# (`a_linked_member_of`). Restricted Works never appear for a caller who may
|
|
105
|
+
# not read them; tombstoned Works are dropped.
|
|
106
|
+
#
|
|
107
|
+
# @param id [String] an Atlas resource ID (subtree root; any type).
|
|
108
|
+
# @param page [Integer, nil] 1-based page (default 1 server-side).
|
|
109
|
+
# @param per_page [Integer, nil] page size (server default 25, capped 100).
|
|
110
|
+
# @param include_linked [Boolean, nil] also include linked members when
|
|
111
|
+
# truthy; structural-only by default.
|
|
112
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
113
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
114
|
+
# path it is ignored (identity lives in the token).
|
|
115
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
116
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when omitted.
|
|
117
|
+
# @return [AtlasRb::Mash, nil] the parsed envelope, with a `"works"` digest
|
|
118
|
+
# array and a `"pagination"` block; `nil` when the id resolves to nothing
|
|
119
|
+
# (`404`).
|
|
120
|
+
#
|
|
121
|
+
# @example Page a Collection's whole subtree of Works
|
|
122
|
+
# result = AtlasRb::Resource.descendant_works("col-456", per_page: 100)
|
|
123
|
+
# result["works"].map { |w| w["noid"] }
|
|
124
|
+
# result.dig("pagination", "pages")
|
|
125
|
+
def self.descendant_works(id, page: nil, per_page: nil, include_linked: nil, nuid: nil, on_behalf_of: nil)
|
|
126
|
+
params = {}
|
|
127
|
+
params[:page] = page if page
|
|
128
|
+
params[:per_page] = per_page if per_page
|
|
129
|
+
params[:include_linked] = include_linked unless include_linked.nil?
|
|
130
|
+
resp = connection(params, nuid, on_behalf_of: on_behalf_of)
|
|
131
|
+
.get('/resources/' + id + '/descendant_works')
|
|
132
|
+
return nil if resp.status == 404
|
|
133
|
+
|
|
134
|
+
AtlasRb::Mash.new(JSON.parse(resp.body))
|
|
135
|
+
end
|
|
136
|
+
|
|
91
137
|
# Validate a MODS XML document against Atlas's schema *without* persisting it.
|
|
92
138
|
#
|
|
93
139
|
# Useful for surfacing validation errors in UIs before the user commits.
|
|
@@ -170,6 +216,38 @@ module AtlasRb
|
|
|
170
216
|
))
|
|
171
217
|
end
|
|
172
218
|
|
|
219
|
+
# Fetch the CURRENT MODS of any Modsable resource by NOID — the polymorphic
|
|
220
|
+
# sibling of {Work.mods} / {Collection.mods} / {Community.mods}. Wraps
|
|
221
|
+
# `GET /resources/<id>/mods[.kind]` and returns the **raw response body**
|
|
222
|
+
# (not parsed), mirroring the typed wrappers. Lets a caller holding only a
|
|
223
|
+
# NOID (no type) fetch descriptive MODS in one call, instead of resolving
|
|
224
|
+
# the klass first to pick the typed route — e.g. a bulk Collection/Set MODS
|
|
225
|
+
# export that has bare member NOIDs from {Collection.children}.
|
|
226
|
+
#
|
|
227
|
+
# @param id [String] an Atlas resource ID (NOID).
|
|
228
|
+
# @param kind [String, nil] response-format extension: omit for the JSON
|
|
229
|
+
# projection (the server default), or pass `"xml"` for MODS XML (`"json"`
|
|
230
|
+
# / `"html"` also accepted). Output is byte-identical to the typed route
|
|
231
|
+
# for the resolved type.
|
|
232
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
233
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
234
|
+
# path it is ignored (identity lives in the token).
|
|
235
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
236
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when omitted.
|
|
237
|
+
# @return [String, nil] the raw MODS body (XML or JSON per `kind`). The
|
|
238
|
+
# server returns `404` (empty body) for an unknown id, a non-Modsable
|
|
239
|
+
# resource, or one with no MODS.
|
|
240
|
+
#
|
|
241
|
+
# @example Bulk-export a Set's members' MODS without klass dispatch
|
|
242
|
+
# AtlasRb::Collection.children(set_id).each do |noid|
|
|
243
|
+
# xml = AtlasRb::Resource.mods(noid, "xml")
|
|
244
|
+
# end
|
|
245
|
+
def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
|
|
246
|
+
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
247
|
+
'/resources/' + id + '/mods' + (kind.present? ? ".#{kind}" : '')
|
|
248
|
+
)&.body
|
|
249
|
+
end
|
|
250
|
+
|
|
173
251
|
# List the retained MODS versions for a resource.
|
|
174
252
|
#
|
|
175
253
|
# Wraps Atlas's `GET /resources/<id>/mods/versions`, which returns the
|
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.8.
|
|
4
|
+
version: 1.8.9
|
|
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-07-
|
|
11
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|