atlas_rb 1.27.3 → 1.28.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 +28 -0
- data/Gemfile.lock +6 -6
- data/lib/atlas_rb/collection.rb +3 -0
- data/lib/atlas_rb/community.rb +3 -0
- data/lib/atlas_rb/resource_writes.rb +23 -3
- data/lib/atlas_rb/work.rb +45 -0
- metadata +3 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3b06407e57e241d5ddcd1a8ebef36efbe6c3e5c778e4d6fbdd09826694a8716
|
|
4
|
+
data.tar.gz: 3164c9a3a4a67944846a5fe81af5eda1095a757210db01bed15eafb6fb2ea369
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca3e4e74dce382bf33b72d9a294779576249ac3f949e6821647dd9a79bbb50b6cf5719c98198263ceae99c4412fb5ff0a77ec568a44bd19bca8ac6833d1f6eb2
|
|
7
|
+
data.tar.gz: 32ebc73d97471c1fb8419bd4c2b2e9f61b0a81780b0f0cc842edad6c7adddcdb3e100e8c66119c8198b0afaadb23c306e909d8d1a8463aedd99a9bf2a8788beb
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.28.0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.28.0
|
|
4
|
+
|
|
5
|
+
Requires an Atlas that stores the preview image's size and placeholder (0.6.234
|
|
6
|
+
or later). An older Atlas ignores the new keys.
|
|
7
|
+
|
|
8
|
+
### Added — the preview's size and placeholder on `Resource.set_thumbnails`
|
|
9
|
+
|
|
10
|
+
`preview_width:`, `preview_height:` and `preview_placeholder:` ride the PATCH
|
|
11
|
+
body beside `preview:`. Each is optional, and a `nil` is not sent. Atlas writes
|
|
12
|
+
them only with a `preview` URI and clears them when a `preview` arrives without
|
|
13
|
+
them, so pass them on every preview write. A malformed value, or one sent
|
|
14
|
+
without `preview`, raises `ResourceError` with status 422 and an `error` code.
|
|
15
|
+
|
|
16
|
+
`Work.find`, `Collection.find` and `Community.find` return the three keys
|
|
17
|
+
beside `"preview"`, each `nil` when Atlas holds none.
|
|
18
|
+
|
|
19
|
+
## 1.27.4
|
|
20
|
+
|
|
21
|
+
Requires an Atlas that serves `GET /works/:id/health_check` (0.6.232 or later).
|
|
22
|
+
|
|
23
|
+
### Added — `AtlasRb::Work.health_check`
|
|
24
|
+
|
|
25
|
+
Reads a Work's green/yellow/red health grade and the findings behind it, each
|
|
26
|
+
with a severity, a machine-readable code, the NOID it is about and a message.
|
|
27
|
+
Atlas never re-hashes the bytes for this call, so `fixity_checked` is always
|
|
28
|
+
false. Admin and devolved-admin tiers only; anyone else gets a
|
|
29
|
+
`ResourceError` with status 403. `nil` on a 404.
|
|
30
|
+
|
|
3
31
|
## 1.27.3
|
|
4
32
|
|
|
5
33
|
### Changed — `Metrics.latency` documentation
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
atlas_rb (1.
|
|
4
|
+
atlas_rb (1.28.0)
|
|
5
5
|
faraday (~> 2.7)
|
|
6
6
|
faraday-follow_redirects (~> 0.3.0)
|
|
7
7
|
faraday-multipart (~> 1)
|
|
@@ -16,24 +16,24 @@ GEM
|
|
|
16
16
|
base64 (0.3.0)
|
|
17
17
|
connection_pool (2.5.5)
|
|
18
18
|
diff-lcs (1.6.1)
|
|
19
|
-
faraday (2.
|
|
20
|
-
faraday-net_http (>= 2.0, < 3.
|
|
19
|
+
faraday (2.15.1)
|
|
20
|
+
faraday-net_http (>= 2.0, < 3.6)
|
|
21
21
|
json
|
|
22
22
|
logger
|
|
23
23
|
faraday-follow_redirects (0.3.0)
|
|
24
24
|
faraday (>= 1, < 3)
|
|
25
25
|
faraday-multipart (1.2.0)
|
|
26
26
|
multipart-post (~> 2.0)
|
|
27
|
-
faraday-net_http (3.
|
|
27
|
+
faraday-net_http (3.5.0)
|
|
28
28
|
net-http (~> 0.5)
|
|
29
29
|
faraday-net_http_persistent (2.3.1)
|
|
30
30
|
faraday (~> 2.5)
|
|
31
31
|
net-http-persistent (>= 4.0.4, < 5)
|
|
32
32
|
faraday-retry (2.4.0)
|
|
33
33
|
faraday (~> 2.0)
|
|
34
|
-
hashie (5.
|
|
34
|
+
hashie (5.2.0)
|
|
35
35
|
logger
|
|
36
|
-
json (3.0
|
|
36
|
+
json (3.1.0)
|
|
37
37
|
jwt (2.10.3)
|
|
38
38
|
base64
|
|
39
39
|
logger (1.7.0)
|
data/lib/atlas_rb/collection.rb
CHANGED
|
@@ -32,6 +32,9 @@ module AtlasRb
|
|
|
32
32
|
# omitted.
|
|
33
33
|
# @return [Hash, nil] the `"collection"` object, already unwrapped from the
|
|
34
34
|
# JSON response, or `nil` when the Collection does not exist (`404`).
|
|
35
|
+
# The preview image rides beside it: `"preview"` is its URI, and
|
|
36
|
+
# `"preview_width"`, `"preview_height"` and `"preview_placeholder"` (base64
|
|
37
|
+
# of a ~16px-wide JPEG) describe it. Each is `nil` when Atlas holds none.
|
|
35
38
|
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410` (e.g. an
|
|
36
39
|
# auth/validation error envelope), carrying Atlas's status + body.
|
|
37
40
|
#
|
data/lib/atlas_rb/community.rb
CHANGED
|
@@ -30,6 +30,9 @@ module AtlasRb
|
|
|
30
30
|
# omitted.
|
|
31
31
|
# @return [Hash, nil] the `"community"` object from the JSON response,
|
|
32
32
|
# already unwrapped, or `nil` when the Community does not exist (`404`).
|
|
33
|
+
# The preview image rides beside it: `"preview"` is its URI, and
|
|
34
|
+
# `"preview_width"`, `"preview_height"` and `"preview_placeholder"` (base64
|
|
35
|
+
# of a ~16px-wide JPEG) describe it. Each is `nil` when Atlas holds none.
|
|
33
36
|
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410` (e.g. an
|
|
34
37
|
# auth/validation error envelope), carrying Atlas's status + body.
|
|
35
38
|
#
|
|
@@ -136,19 +136,39 @@ module AtlasRb
|
|
|
136
136
|
#
|
|
137
137
|
# Only the URIs you pass are upserted; an omitted key is left untouched.
|
|
138
138
|
#
|
|
139
|
+
# The preview's size and placeholder are written only with `preview`, and
|
|
140
|
+
# Atlas answers `422` for one sent without it. A `preview` sent without them
|
|
141
|
+
# clears the stored ones, so pass them on every preview write.
|
|
142
|
+
#
|
|
139
143
|
# @param id [String] the resource's NOID.
|
|
140
144
|
# @param thumbnail [String, nil] IIIF URI for the ~85² thumbnail.
|
|
141
145
|
# @param thumbnail_2x [String, nil] IIIF URI for the ~170² 2x thumbnail.
|
|
142
146
|
# @param preview [String, nil] IIIF URI for the ~500w preview image.
|
|
147
|
+
# @param preview_width [Integer, nil] pixel width of the image `preview`
|
|
148
|
+
# serves. Send it with `preview_height`.
|
|
149
|
+
# @param preview_height [Integer, nil] pixel height of the image `preview`
|
|
150
|
+
# serves. Send it with `preview_width`.
|
|
151
|
+
# @param preview_placeholder [String, nil] base64 of a ~16px-wide JPEG of
|
|
152
|
+
# that image, at most 2048 characters. The bytes only, not a data URI.
|
|
143
153
|
# @param nuid [String, nil] optional acting user's NUID.
|
|
144
154
|
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
145
155
|
# header.
|
|
146
156
|
# @return [AtlasRb::Mash] the resource, unwrapped from its type key.
|
|
147
157
|
# @raise [AtlasRb::NotFoundError] on `404` — the write did not happen.
|
|
148
158
|
# @raise [AtlasRb::StaleResourceError] on an optimistic-lock conflict.
|
|
149
|
-
# @raise [AtlasRb::ResourceError] on any other non-2xx
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
# @raise [AtlasRb::ResourceError] on any other non-2xx, including the `422`
|
|
160
|
+
# whose `error` names a malformed size or placeholder.
|
|
161
|
+
#
|
|
162
|
+
# @example A preview with its size and placeholder
|
|
163
|
+
# AtlasRb::Resource.set_thumbnails("w-789", preview: uri,
|
|
164
|
+
# preview_width: 500, preview_height: 375,
|
|
165
|
+
# preview_placeholder: Base64.strict_encode64(tiny_jpeg))
|
|
166
|
+
def self.set_thumbnails(id, thumbnail: nil, thumbnail_2x: nil, preview: nil,
|
|
167
|
+
preview_width: nil, preview_height: nil, preview_placeholder: nil,
|
|
168
|
+
nuid: nil, on_behalf_of: nil)
|
|
169
|
+
body = { thumbnail: thumbnail, thumbnail_2x: thumbnail_2x, preview: preview,
|
|
170
|
+
preview_width: preview_width, preview_height: preview_height,
|
|
171
|
+
preview_placeholder: preview_placeholder }.compact
|
|
152
172
|
unwrap(write_resource(
|
|
153
173
|
connection({}, nuid, on_behalf_of: on_behalf_of)
|
|
154
174
|
.patch('/resources/' + id + '/thumbnails', JSON.dump(body))
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -29,6 +29,9 @@ module AtlasRb
|
|
|
29
29
|
# {AtlasRb.config}.default_on_behalf_of when omitted.
|
|
30
30
|
# @return [Hash, nil] the `"work"` object, already unwrapped from the JSON
|
|
31
31
|
# response, or `nil` when the Work does not exist (`404`).
|
|
32
|
+
# The preview image rides beside it: `"preview"` is its URI, and
|
|
33
|
+
# `"preview_width"`, `"preview_height"` and `"preview_placeholder"` (base64
|
|
34
|
+
# of a ~16px-wide JPEG) describe it. Each is `nil` when Atlas holds none.
|
|
32
35
|
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410` (e.g. an
|
|
33
36
|
# auth/validation error envelope), carrying Atlas's status + body.
|
|
34
37
|
#
|
|
@@ -512,6 +515,48 @@ module AtlasRb
|
|
|
512
515
|
end
|
|
513
516
|
end
|
|
514
517
|
|
|
518
|
+
# Grade a Work's health green, yellow or red.
|
|
519
|
+
#
|
|
520
|
+
# Wraps `GET /works/<id>/health_check` (Atlas 0.6.232 or later). `grade` is
|
|
521
|
+
# `"green"` (viable), `"yellow"` (broken or degraded, nothing lost, so
|
|
522
|
+
# repairable in place) or `"red"` (bytes missing or corrupt, so it needs a
|
|
523
|
+
# restore or a re-deposit). Each of `findings` carries `severity`
|
|
524
|
+
# (`"advisory"`, `"repairable"` or `"fatal"`), a machine-readable `code`,
|
|
525
|
+
# the `subject` NOID it is about and a `message`. The codes are an open
|
|
526
|
+
# vocabulary: show one you do not recognise rather than failing on it.
|
|
527
|
+
#
|
|
528
|
+
# Atlas never re-hashes the bytes for this call, so `fixity_checked` is
|
|
529
|
+
# always `false`: a green means nothing is missing, not that the bytes
|
|
530
|
+
# were verified. Atlas allows it for the admin and devolved-admin tiers
|
|
531
|
+
# only; edit rights on the Work do not reach it.
|
|
532
|
+
#
|
|
533
|
+
# @param id [String] the Work ID.
|
|
534
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
535
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
536
|
+
# path it is ignored (identity lives in the token).
|
|
537
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
538
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
539
|
+
# omitted.
|
|
540
|
+
# @return [AtlasRb::Mash, nil] the report: `noid`, `grade`,
|
|
541
|
+
# `fixity_checked` and `findings`.
|
|
542
|
+
#
|
|
543
|
+
# `nil` when Atlas answers `404` — no such Work, or, with a misconfigured
|
|
544
|
+
# `ATLAS_URL`, the route is not Atlas's at all.
|
|
545
|
+
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
|
|
546
|
+
# (a `403` for a caller below the delegate tier, a `5xx`, a proxy's
|
|
547
|
+
# `503`), carrying Atlas's status and body so the failure is attributable
|
|
548
|
+
# at the boundary.
|
|
549
|
+
# @example Show what needs repair
|
|
550
|
+
# report = AtlasRb::Work.health_check("w-789", nuid: admin_nuid)
|
|
551
|
+
# report.findings.reject { |f| f.severity == "advisory" }.each do |f|
|
|
552
|
+
# puts "#{f.severity} #{f.code}: #{f.message}"
|
|
553
|
+
# end
|
|
554
|
+
def self.health_check(id, nuid: nil, on_behalf_of: nil)
|
|
555
|
+
read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get("#{ROUTE}#{id}/health_check")) do |body|
|
|
556
|
+
AtlasRb::Mash.new(body)
|
|
557
|
+
end
|
|
558
|
+
end
|
|
559
|
+
|
|
515
560
|
# List a Work's page FileSets in order, each with its assets.
|
|
516
561
|
#
|
|
517
562
|
# Wraps `GET /works/<id>/file_sets` — the ordered, grouped sibling of
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atlas_rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.28.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cliff
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faraday
|
|
@@ -136,7 +135,6 @@ dependencies:
|
|
|
136
135
|
- - "~>"
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
137
|
version: '0.9'
|
|
139
|
-
description:
|
|
140
138
|
email:
|
|
141
139
|
- david.g.cliff@gmail.com
|
|
142
140
|
executables: []
|
|
@@ -191,12 +189,10 @@ files:
|
|
|
191
189
|
- lib/atlas_rb/version.rb
|
|
192
190
|
- lib/atlas_rb/work.rb
|
|
193
191
|
- sig/atlas_rb.rbs
|
|
194
|
-
homepage:
|
|
195
192
|
licenses:
|
|
196
193
|
- MIT
|
|
197
194
|
metadata:
|
|
198
195
|
rubygems_mfa_required: 'false'
|
|
199
|
-
post_install_message:
|
|
200
196
|
rdoc_options: []
|
|
201
197
|
require_paths:
|
|
202
198
|
- lib
|
|
@@ -211,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
211
207
|
- !ruby/object:Gem::Version
|
|
212
208
|
version: '0'
|
|
213
209
|
requirements: []
|
|
214
|
-
rubygems_version: 3.
|
|
215
|
-
signing_key:
|
|
210
|
+
rubygems_version: 3.6.9
|
|
216
211
|
specification_version: 4
|
|
217
212
|
summary: Ruby gem for Atlas API.
|
|
218
213
|
test_files: []
|