atlas_rb 1.8.10 → 1.8.11
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 +17 -14
- data/lib/atlas_rb/community.rb +2 -2
- data/lib/atlas_rb/resource.rb +2 -2
- data/lib/atlas_rb/version.rb +5 -2
- data/lib/atlas_rb/work.rb +2 -2
- 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: f6edbe1b05256eaab4d296a11f358bb7c7c3f9eaf439be4d48c41e75cfea4951
|
|
4
|
+
data.tar.gz: 8e042786b3c7636f7ad3676b9086a7db4ecfa8efed7ed1e91ac8ec4153dbb320
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44832489abc704196a42b92d85304e886cc3951e711ea33980c9357cb515a4f3e674d7c75db989b7de5c7fbdc9ed36dcfc51a5eceb1d697371d3971227a7e5fa
|
|
7
|
+
data.tar.gz: 45d0ed33989b889a4a2f3ae3c9932b73f85daa3bc7f5ce9e859f7ea304bf97c71195694322e4e78cdcb537e8f50f37cd1b1d1fe6f7c76bc8458f780688e5c143
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.8.
|
|
1
|
+
1.8.11
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/collection.rb
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module AtlasRb
|
|
4
|
-
# A grouping of {Work}s
|
|
4
|
+
# A grouping of {Work}s and nested {Collection}s, parented by a {Community}
|
|
5
|
+
# or another Collection.
|
|
5
6
|
#
|
|
6
|
-
# Collections
|
|
7
|
-
#
|
|
8
|
-
#
|
|
7
|
+
# Collections nest, exactly as they did in DRS v1: a Collection holds Works
|
|
8
|
+
# and/or child Collections, and its own parent may be a Community or a
|
|
9
|
+
# Collection (Community → Community|Collection, Collection → Collection|Work,
|
|
10
|
+
# Work → leaf). A consumer that flattens a subtree must recurse into
|
|
11
|
+
# descendant Collections rather than stopping at direct children.
|
|
9
12
|
#
|
|
10
13
|
# See also: {Community}, {Work}.
|
|
11
14
|
class Collection < Resource
|
|
@@ -35,13 +38,13 @@ module AtlasRb
|
|
|
35
38
|
body && AtlasRb::Mash.new(body)["collection"]
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
# Create a new Collection under an existing Community.
|
|
41
|
+
# Create a new Collection under an existing Community or parent Collection.
|
|
39
42
|
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
+
# The `id` parameter is the parent's ID — a **Community or a Collection**,
|
|
44
|
+
# since Collections nest (a Collection may hold child Collections as well as
|
|
45
|
+
# Works).
|
|
43
46
|
#
|
|
44
|
-
# @param id [String] the parent Community ID.
|
|
47
|
+
# @param id [String] the parent Community or Collection ID.
|
|
45
48
|
# @param xml_path [String, nil] optional path to a MODS XML file used to
|
|
46
49
|
# seed metadata. When given, the Collection is created and immediately
|
|
47
50
|
# patched with the metadata in the file.
|
|
@@ -63,7 +66,7 @@ module AtlasRb
|
|
|
63
66
|
result = AtlasRb::Mash.new(JSON.parse(
|
|
64
67
|
connection({ parent_id: id, featured: featured }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
|
|
65
68
|
))["collection"]
|
|
66
|
-
return result
|
|
69
|
+
return result if xml_path.to_s.empty?
|
|
67
70
|
|
|
68
71
|
update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
|
|
69
72
|
find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
|
|
@@ -90,10 +93,10 @@ module AtlasRb
|
|
|
90
93
|
))["collection"]
|
|
91
94
|
end
|
|
92
95
|
|
|
93
|
-
# Move a Collection to a different parent Community.
|
|
96
|
+
# Move a Collection to a different parent (Community or Collection).
|
|
94
97
|
#
|
|
95
98
|
# Wraps `PATCH /collections/<id>/parent` with a `parent_id` of the new
|
|
96
|
-
#
|
|
99
|
+
# parent. Atlas re-parents the Collection and synchronously cascades
|
|
97
100
|
# the ancestry index over its Works; the structural rules (type, cycle,
|
|
98
101
|
# tombstone guards) are enforced server-side and surface as a `422`.
|
|
99
102
|
#
|
|
@@ -101,7 +104,7 @@ module AtlasRb
|
|
|
101
104
|
# the only difference is the verb and that the Collection already exists.
|
|
102
105
|
#
|
|
103
106
|
# @param id [String] the Collection ID to move.
|
|
104
|
-
# @param new_parent_id [String] the destination Community ID.
|
|
107
|
+
# @param new_parent_id [String] the destination Community or Collection ID.
|
|
105
108
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
106
109
|
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
107
110
|
# path it is ignored (identity lives in the token).
|
|
@@ -274,7 +277,7 @@ module AtlasRb
|
|
|
274
277
|
def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
|
|
275
278
|
# json default, html, xml
|
|
276
279
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
277
|
-
ROUTE + id + '/mods' + (kind.
|
|
280
|
+
ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
|
|
278
281
|
)&.body
|
|
279
282
|
end
|
|
280
283
|
end
|
data/lib/atlas_rb/community.rb
CHANGED
|
@@ -64,7 +64,7 @@ module AtlasRb
|
|
|
64
64
|
result = AtlasRb::Mash.new(JSON.parse(
|
|
65
65
|
connection({ parent_id: id }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
|
|
66
66
|
))["community"]
|
|
67
|
-
return result
|
|
67
|
+
return result if xml_path.to_s.empty?
|
|
68
68
|
|
|
69
69
|
update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
|
|
70
70
|
find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
|
|
@@ -263,7 +263,7 @@ module AtlasRb
|
|
|
263
263
|
def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
|
|
264
264
|
# json default, html, xml
|
|
265
265
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
266
|
-
ROUTE + id + '/mods' + (kind.
|
|
266
|
+
ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
|
|
267
267
|
)&.body
|
|
268
268
|
end
|
|
269
269
|
end
|
data/lib/atlas_rb/resource.rb
CHANGED
|
@@ -244,7 +244,7 @@ module AtlasRb
|
|
|
244
244
|
# end
|
|
245
245
|
def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
|
|
246
246
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
247
|
-
'/resources/' + id + '/mods' + (kind.
|
|
247
|
+
'/resources/' + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
|
|
248
248
|
)&.body
|
|
249
249
|
end
|
|
250
250
|
|
|
@@ -320,7 +320,7 @@ module AtlasRb
|
|
|
320
320
|
def self.mods_version(id, version_id, kind: nil, nuid: nil, on_behalf_of: nil)
|
|
321
321
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
322
322
|
'/resources/' + id + '/mods/versions/' + version_id +
|
|
323
|
-
(kind.
|
|
323
|
+
(kind.to_s.empty? ? '' : ".#{kind}")
|
|
324
324
|
)&.body
|
|
325
325
|
end
|
|
326
326
|
|
data/lib/atlas_rb/version.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module AtlasRb
|
|
4
|
-
# Current gem version, read from the `.version` file at the
|
|
5
|
-
|
|
4
|
+
# Current gem version, read from the `.version` file at the gem root at load
|
|
5
|
+
# time. Resolved relative to this file (not the process CWD) so a standalone
|
|
6
|
+
# consumer — a headless BYO-JWT script run from anywhere — loads the gem's own
|
|
7
|
+
# version rather than raising ENOENT (or reading some unrelated `.version`).
|
|
8
|
+
VERSION = File.read(File.expand_path("../../.version", __dir__)).strip
|
|
6
9
|
end
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -124,7 +124,7 @@ module AtlasRb
|
|
|
124
124
|
connection(params, nuid,
|
|
125
125
|
on_behalf_of: on_behalf_of, idempotency_key: idempotency_key).post(ROUTE)&.body
|
|
126
126
|
))["work"]
|
|
127
|
-
return result
|
|
127
|
+
return result if xml_path.to_s.empty?
|
|
128
128
|
|
|
129
129
|
update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
|
|
130
130
|
find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
|
|
@@ -559,7 +559,7 @@ module AtlasRb
|
|
|
559
559
|
def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
|
|
560
560
|
# json default, html, xml
|
|
561
561
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(
|
|
562
|
-
ROUTE + id + '/mods' + (kind.
|
|
562
|
+
ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
|
|
563
563
|
)&.body
|
|
564
564
|
end
|
|
565
565
|
|