atlas_rb 1.0.0 → 1.1.0
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/README.md +19 -1
- data/lib/atlas_rb/resource.rb +40 -3
- 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: b3406190d2c893eccbd1b8d47f20efe85ecb01d404145294352e1db61133406b
|
|
4
|
+
data.tar.gz: 0a178b48eee743a8e3275dcdf999451b3f811e3af214e163ba675eb4487e5d22
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bde03915384d45748a5c74c7235890e4f64116470f1146775e7480077aac9cf7778d867f526f24dc1470f481837b5b0933794234df3da0254f7eb8aff3ae1539
|
|
7
|
+
data.tar.gz: 86bb05b0b0d9b3be8ea8a3f219e1c6137548255312e80a7bf7eabbe809a110993a48dca16a4fe2aaf55def9cd8627389c0796a6e6ed218d054bc945b4068439b
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`AtlasRb::Resource.history(id, nuid: nil, on_behalf_of: nil)`** —
|
|
8
|
+
wraps Atlas's `GET /resources/:id/history` endpoint. Returns the full
|
|
9
|
+
envelope (`resource_id` + reverse-chronological `events` array) as an
|
|
10
|
+
`AtlasRb::Mash`, matching the gem's convention for cross-resource
|
|
11
|
+
bindings. Authorization errors (`401` / `403`) surface as raw Faraday
|
|
12
|
+
responses for the caller's rescue layer. Pagination is not yet
|
|
13
|
+
supported by the server; a TODO is in place for when it lands.
|
|
14
|
+
|
|
15
|
+
Cerberus consumes this binding for the "History" tab on resource show
|
|
16
|
+
pages.
|
|
17
|
+
|
|
3
18
|
## 1.0.0 — major restructure: namespace gradient + ambient identity
|
|
4
19
|
|
|
5
20
|
This release reshapes the gem's API surface. Downstream consumers
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -112,7 +112,7 @@ Community → Collection → Work
|
|
|
112
112
|
| `AtlasRb::FileSet` | Classified slot under a Work (e.g. `"primary"`, `"supplemental"`). |
|
|
113
113
|
| `AtlasRb::Blob` | The binary bytes; supports streaming downloads. |
|
|
114
114
|
| `AtlasRb::Authentication` | NUID → user record / group lookup. |
|
|
115
|
-
| `AtlasRb::Resource` | Generic resolver and
|
|
115
|
+
| `AtlasRb::Resource` | Generic resolver, permissions lookup, and audit-event history. |
|
|
116
116
|
| `AtlasRb::Reset` | Test-only — wipes Atlas state via `GET /reset`. |
|
|
117
117
|
|
|
118
118
|
## Namespace gradient: regular / Admin / System
|
|
@@ -187,6 +187,24 @@ AtlasRb::Work.list(in_progress: false, page: 2) # completed deposits, page 2
|
|
|
187
187
|
AtlasRb::Work.complete("w-789") # mark w-789 done
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
### Audit-event history
|
|
191
|
+
|
|
192
|
+
`Resource.history` wraps Atlas's `GET /resources/<id>/history` endpoint
|
|
193
|
+
and returns the full envelope — `resource_id` plus a reverse-chronological
|
|
194
|
+
`events` array — as an `AtlasRb::Mash`. It is type-agnostic: pass any
|
|
195
|
+
Community, Collection, Work, FileSet, or Blob ID. Pagination is not yet
|
|
196
|
+
supported on the server side; the endpoint returns the full history in
|
|
197
|
+
one shot.
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
result = AtlasRb::Resource.history("w-789")
|
|
201
|
+
result["resource_id"] # => "w-789"
|
|
202
|
+
result["events"].first["action"] # => "update"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Authorization errors (`401` / `403`) are not caught here — they surface as
|
|
206
|
+
raw Faraday responses for the calling application's rescue layer.
|
|
207
|
+
|
|
190
208
|
## End-to-end example
|
|
191
209
|
|
|
192
210
|
JSON responses come back as `AtlasRb::Mash` (a `Hashie::Mash` subclass), so
|
data/lib/atlas_rb/resource.rb
CHANGED
|
@@ -5,9 +5,9 @@ module AtlasRb
|
|
|
5
5
|
#
|
|
6
6
|
# Subclasses define a `ROUTE` constant (e.g. `"/communities/"`) and override
|
|
7
7
|
# whichever of `find / create / destroy / update / metadata / mods` apply.
|
|
8
|
-
# The {Resource} class itself ships
|
|
9
|
-
# type-specific: a generic resolver, an XML preview helper,
|
|
10
|
-
#
|
|
8
|
+
# The {Resource} class itself ships four endpoints that are not
|
|
9
|
+
# type-specific: a generic resolver, an XML preview helper, a permissions
|
|
10
|
+
# lookup, and an audit-event history fetch.
|
|
11
11
|
#
|
|
12
12
|
# The Atlas resource hierarchy is:
|
|
13
13
|
#
|
|
@@ -91,5 +91,42 @@ module AtlasRb
|
|
|
91
91
|
.get('/resources/' + id + '/permissions')&.body
|
|
92
92
|
))["resource"]
|
|
93
93
|
end
|
|
94
|
+
|
|
95
|
+
# Fetch the audit-event history for a resource.
|
|
96
|
+
#
|
|
97
|
+
# Wraps Atlas's `GET /resources/<id>/history` endpoint, which returns the
|
|
98
|
+
# full envelope (`resource_id` + reverse-chronological `events` array).
|
|
99
|
+
# The whole envelope is preserved so callers can confirm the events
|
|
100
|
+
# belong to the requested resource; access events as `result["events"]`.
|
|
101
|
+
#
|
|
102
|
+
# Authorization errors (`401` / `403`) are intentionally **not** caught
|
|
103
|
+
# here — they surface as raw Faraday responses for the calling
|
|
104
|
+
# application's rescue layer to translate.
|
|
105
|
+
#
|
|
106
|
+
# @todo Add pagination support once Atlas's history endpoint exposes
|
|
107
|
+
# page / per_page query params. Today the endpoint returns the full
|
|
108
|
+
# history in one shot.
|
|
109
|
+
#
|
|
110
|
+
# @param id [String] an Atlas resource ID.
|
|
111
|
+
# @param nuid [String, nil] optional acting user's NUID, forwarded as the
|
|
112
|
+
# `User:` header. Required for cerberus-token requests; legacy bearer
|
|
113
|
+
# tokens still resolve without it.
|
|
114
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
115
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
116
|
+
# omitted.
|
|
117
|
+
# @return [AtlasRb::Mash] the parsed envelope from
|
|
118
|
+
# `GET /resources/<id>/history`, with `"resource_id"` and an `"events"`
|
|
119
|
+
# array (reverse chronological; possibly empty).
|
|
120
|
+
#
|
|
121
|
+
# @example
|
|
122
|
+
# result = AtlasRb::Resource.history("abc12345")
|
|
123
|
+
# result["resource_id"] # => "abc12345"
|
|
124
|
+
# result["events"].first["action"] # => "create"
|
|
125
|
+
def self.history(id, nuid: nil, on_behalf_of: nil)
|
|
126
|
+
AtlasRb::Mash.new(JSON.parse(
|
|
127
|
+
connection({}, nuid, on_behalf_of: on_behalf_of)
|
|
128
|
+
.get('/resources/' + id + '/history')&.body
|
|
129
|
+
))
|
|
130
|
+
end
|
|
94
131
|
end
|
|
95
132
|
end
|
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.
|
|
4
|
+
version: 1.1.0
|
|
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-05-
|
|
11
|
+
date: 2026-05-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|