atlas_rb 0.0.100 → 0.0.101
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 +10 -4
- data/lib/atlas_rb/community.rb +10 -4
- data/lib/atlas_rb/delegate.rb +5 -2
- data/lib/atlas_rb/file_set.rb +20 -8
- data/lib/atlas_rb/work.rb +10 -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: 94b1cf416b2dbd60cd0e87960302dc5bb4be7207576608ecbe521cdb28d20255
|
|
4
|
+
data.tar.gz: d3d716929b9d246d761385142858e95e628f4e50510a3c583dd90ae8e70613c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c232e3e98c972d7c551106e5befb4b52f0b5befcba7ae15eeaf32ac1f2471062a90f4034a04e63caa3991625b6a5f4ca95de15cc395b0abaca8e62ad92ee5d3
|
|
7
|
+
data.tar.gz: 660c2326caa5f323fb83236144f6f41318e3b375d8e1d7a39ab48742c2acc86567686fef8cd2bf01136e91a8a300a53762c1ad9f2d3f449195a592a6dfa43178
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.101
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/collection.rb
CHANGED
|
@@ -58,12 +58,15 @@ module AtlasRb
|
|
|
58
58
|
# Delete a Collection.
|
|
59
59
|
#
|
|
60
60
|
# @param id [String] the Collection ID.
|
|
61
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
62
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
63
|
+
# tokens still resolve without it.
|
|
61
64
|
# @return [Faraday::Response] the raw delete response.
|
|
62
65
|
#
|
|
63
66
|
# @example
|
|
64
67
|
# AtlasRb::Collection.destroy("col-456")
|
|
65
|
-
def self.destroy(id)
|
|
66
|
-
connection({}).delete(ROUTE + id)
|
|
68
|
+
def self.destroy(id, nuid: nil)
|
|
69
|
+
connection({}, nuid).delete(ROUTE + id)
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
# Tombstone (withdraw) a Collection.
|
|
@@ -107,13 +110,16 @@ module AtlasRb
|
|
|
107
110
|
# {Resource.find} (or {Work.find}) when a full payload is needed.
|
|
108
111
|
#
|
|
109
112
|
# @param id [String] the Collection ID.
|
|
113
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
114
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
115
|
+
# tokens still resolve without it.
|
|
110
116
|
# @return [Array<String>] child noids from `GET /collections/<id>/children`.
|
|
111
117
|
#
|
|
112
118
|
# @example
|
|
113
119
|
# AtlasRb::Collection.children("col-456")
|
|
114
120
|
# # => ["w-789", "w-790"]
|
|
115
|
-
def self.children(id)
|
|
116
|
-
JSON.parse(connection({}).get(ROUTE + id + '/children')&.body)
|
|
121
|
+
def self.children(id, nuid: nil)
|
|
122
|
+
JSON.parse(connection({}, nuid).get(ROUTE + id + '/children')&.body)
|
|
117
123
|
end
|
|
118
124
|
|
|
119
125
|
# Replace a Collection's metadata by uploading a MODS XML document.
|
data/lib/atlas_rb/community.rb
CHANGED
|
@@ -62,12 +62,15 @@ module AtlasRb
|
|
|
62
62
|
# Delete a Community.
|
|
63
63
|
#
|
|
64
64
|
# @param id [String] the Community ID.
|
|
65
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
66
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
67
|
+
# tokens still resolve without it.
|
|
65
68
|
# @return [Faraday::Response] the raw delete response.
|
|
66
69
|
#
|
|
67
70
|
# @example
|
|
68
71
|
# AtlasRb::Community.destroy("c-123")
|
|
69
|
-
def self.destroy(id)
|
|
70
|
-
connection({}).delete(ROUTE + id)
|
|
72
|
+
def self.destroy(id, nuid: nil)
|
|
73
|
+
connection({}, nuid).delete(ROUTE + id)
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
# Tombstone (withdraw) a Community.
|
|
@@ -112,13 +115,16 @@ module AtlasRb
|
|
|
112
115
|
# needed.
|
|
113
116
|
#
|
|
114
117
|
# @param id [String] the parent Community ID.
|
|
118
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
119
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
120
|
+
# tokens still resolve without it.
|
|
115
121
|
# @return [Array<String>] child noids from `GET /communities/<id>/children`.
|
|
116
122
|
#
|
|
117
123
|
# @example
|
|
118
124
|
# AtlasRb::Community.children("c-123")
|
|
119
125
|
# # => ["fn106x926", "kw52j804p"]
|
|
120
|
-
def self.children(id)
|
|
121
|
-
JSON.parse(connection({}).get(ROUTE + id + '/children')&.body)
|
|
126
|
+
def self.children(id, nuid: nil)
|
|
127
|
+
JSON.parse(connection({}, nuid).get(ROUTE + id + '/children')&.body)
|
|
122
128
|
end
|
|
123
129
|
|
|
124
130
|
# Replace a Community's metadata by uploading a MODS XML document.
|
data/lib/atlas_rb/delegate.rb
CHANGED
|
@@ -23,14 +23,17 @@ module AtlasRb
|
|
|
23
23
|
# Fetch a single Delegate by NOID or `valkyrie_id`.
|
|
24
24
|
#
|
|
25
25
|
# @param id [String] the Delegate's NOID or `valkyrie_id`.
|
|
26
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
27
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
28
|
+
# tokens still resolve without it.
|
|
26
29
|
# @return [AtlasRb::Mash] the `"delegate"` object, already unwrapped —
|
|
27
30
|
# includes `id`, `valkyrie_id`, `use`, `uri`, `mime_type`,
|
|
28
31
|
# `original_filename`, `label`, and tombstone fields.
|
|
29
32
|
#
|
|
30
33
|
# @example
|
|
31
34
|
# AtlasRb::Delegate.find("d-555")
|
|
32
|
-
def self.find(id)
|
|
33
|
-
AtlasRb::Mash.new(JSON.parse(connection({}).get(ROUTE + id)&.body))["delegate"]
|
|
35
|
+
def self.find(id, nuid: nil)
|
|
36
|
+
AtlasRb::Mash.new(JSON.parse(connection({}, nuid).get(ROUTE + id)&.body))["delegate"]
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
end
|
data/lib/atlas_rb/file_set.rb
CHANGED
|
@@ -17,12 +17,15 @@ module AtlasRb
|
|
|
17
17
|
# Fetch a single FileSet by ID.
|
|
18
18
|
#
|
|
19
19
|
# @param id [String] the FileSet ID.
|
|
20
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
21
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
22
|
+
# tokens still resolve without it.
|
|
20
23
|
# @return [Hash] the `"file_set"` object, already unwrapped.
|
|
21
24
|
#
|
|
22
25
|
# @example
|
|
23
26
|
# AtlasRb::FileSet.find("fs-001")
|
|
24
|
-
def self.find(id)
|
|
25
|
-
AtlasRb::Mash.new(JSON.parse(connection({}).get(ROUTE + id)&.body))["file_set"]
|
|
27
|
+
def self.find(id, nuid: nil)
|
|
28
|
+
AtlasRb::Mash.new(JSON.parse(connection({}, nuid).get(ROUTE + id)&.body))["file_set"]
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
# Create a new FileSet under a Work.
|
|
@@ -34,6 +37,9 @@ module AtlasRb
|
|
|
34
37
|
# @param idempotency_key [String, nil] optional UUID. A repeat call with
|
|
35
38
|
# the same key returns the originally-created FileSet instead of
|
|
36
39
|
# creating a new one. See {AtlasRb::Work.create} for full semantics.
|
|
40
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
41
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
42
|
+
# tokens still resolve without it.
|
|
37
43
|
# @return [Hash] the created `"file_set"` payload, including its `"id"`
|
|
38
44
|
# which can then be passed to {.update} to attach a binary.
|
|
39
45
|
#
|
|
@@ -44,9 +50,9 @@ module AtlasRb
|
|
|
44
50
|
# @example Retry-safe bulk-deposit create
|
|
45
51
|
# key = SecureRandom.uuid
|
|
46
52
|
# AtlasRb::FileSet.create("w-789", "primary", idempotency_key: key)
|
|
47
|
-
def self.create(id, classification, idempotency_key: nil)
|
|
53
|
+
def self.create(id, classification, idempotency_key: nil, nuid: nil)
|
|
48
54
|
AtlasRb::Mash.new(JSON.parse(
|
|
49
|
-
connection({ work_id: id, classification: classification },
|
|
55
|
+
connection({ work_id: id, classification: classification }, nuid,
|
|
50
56
|
idempotency_key: idempotency_key).post(ROUTE)&.body
|
|
51
57
|
))["file_set"]
|
|
52
58
|
end
|
|
@@ -54,12 +60,15 @@ module AtlasRb
|
|
|
54
60
|
# Delete a FileSet.
|
|
55
61
|
#
|
|
56
62
|
# @param id [String] the FileSet ID.
|
|
63
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
64
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
65
|
+
# tokens still resolve without it.
|
|
57
66
|
# @return [Faraday::Response] the raw delete response.
|
|
58
67
|
#
|
|
59
68
|
# @example
|
|
60
69
|
# AtlasRb::FileSet.destroy("fs-001")
|
|
61
|
-
def self.destroy(id)
|
|
62
|
-
connection({}).delete(ROUTE + id)
|
|
70
|
+
def self.destroy(id, nuid: nil)
|
|
71
|
+
connection({}, nuid).delete(ROUTE + id)
|
|
63
72
|
end
|
|
64
73
|
|
|
65
74
|
# Attach (or replace) the binary content backing this FileSet.
|
|
@@ -71,16 +80,19 @@ module AtlasRb
|
|
|
71
80
|
#
|
|
72
81
|
# @param id [String] the FileSet ID.
|
|
73
82
|
# @param blob_path [String] path to the binary file on disk.
|
|
83
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
84
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
85
|
+
# tokens still resolve without it.
|
|
74
86
|
# @return [Hash] the parsed JSON response from the patch.
|
|
75
87
|
#
|
|
76
88
|
# @example
|
|
77
89
|
# AtlasRb::FileSet.update("fs-001", "/tmp/article.pdf")
|
|
78
|
-
def self.update(id, blob_path)
|
|
90
|
+
def self.update(id, blob_path, nuid: nil)
|
|
79
91
|
# Need to figure out blob vs XML
|
|
80
92
|
payload = { binary: Faraday::Multipart::FilePart.new(File.open(blob_path),
|
|
81
93
|
"application/octet-stream",
|
|
82
94
|
File.basename(blob_path)) }
|
|
83
|
-
AtlasRb::Mash.new(JSON.parse(multipart(
|
|
95
|
+
AtlasRb::Mash.new(JSON.parse(multipart(nuid).patch(ROUTE + id, payload)&.body))
|
|
84
96
|
end
|
|
85
97
|
end
|
|
86
98
|
end
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -39,6 +39,9 @@ module AtlasRb
|
|
|
39
39
|
# `in_progress` flag matches. Omit (or pass `nil`) for "all works".
|
|
40
40
|
# @param page [Integer, nil] 1-indexed page number.
|
|
41
41
|
# @param per_page [Integer, nil] page size override.
|
|
42
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
43
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
44
|
+
# tokens still resolve without it.
|
|
42
45
|
# @return [AtlasRb::Mash] `{ "works" => [...], "pagination" => {...} }`.
|
|
43
46
|
# Each entry in `"works"` is a Work summary (`id`, `title`,
|
|
44
47
|
# `description`, `in_progress`).
|
|
@@ -48,12 +51,12 @@ module AtlasRb
|
|
|
48
51
|
#
|
|
49
52
|
# @example Page through all works
|
|
50
53
|
# AtlasRb::Work.list(page: 2, per_page: 50)
|
|
51
|
-
def self.list(in_progress: nil, page: nil, per_page: nil)
|
|
54
|
+
def self.list(in_progress: nil, page: nil, per_page: nil, nuid: nil)
|
|
52
55
|
params = {}
|
|
53
56
|
params[:in_progress] = in_progress unless in_progress.nil?
|
|
54
57
|
params[:page] = page if page
|
|
55
58
|
params[:per_page] = per_page if per_page
|
|
56
|
-
AtlasRb::Mash.new(JSON.parse(connection(params).get(ROUTE)&.body))
|
|
59
|
+
AtlasRb::Mash.new(JSON.parse(connection(params, nuid).get(ROUTE)&.body))
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
# Create a new Work in an existing Collection.
|
|
@@ -102,12 +105,15 @@ module AtlasRb
|
|
|
102
105
|
# Delete a Work.
|
|
103
106
|
#
|
|
104
107
|
# @param id [String] the Work ID.
|
|
108
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
109
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
110
|
+
# tokens still resolve without it.
|
|
105
111
|
# @return [Faraday::Response] the raw delete response.
|
|
106
112
|
#
|
|
107
113
|
# @example
|
|
108
114
|
# AtlasRb::Work.destroy("w-789")
|
|
109
|
-
def self.destroy(id)
|
|
110
|
-
connection({}).delete(ROUTE + id)
|
|
115
|
+
def self.destroy(id, nuid: nil)
|
|
116
|
+
connection({}, nuid).delete(ROUTE + id)
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
# Tombstone (withdraw) a Work.
|