atlas_rb 1.27.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98ed27c0812607ce56681c0dd9b3ab4c17fc1224c7e3c36bf0aa5b4deb7527e9
4
- data.tar.gz: 401ebcc7d93621d999c2b6441f0e470ee6b68c2081e0eb104e5f059330310004
3
+ metadata.gz: c3b06407e57e241d5ddcd1a8ebef36efbe6c3e5c778e4d6fbdd09826694a8716
4
+ data.tar.gz: 3164c9a3a4a67944846a5fe81af5eda1095a757210db01bed15eafb6fb2ea369
5
5
  SHA512:
6
- metadata.gz: 604f5e4183097244b9759cbf0caf188abf45ca936a7f9a07f3a476a4cb05dee0aa23f65357114bbdd9525e85d2c6ae746f0dba330f05cc4f3b978ae077778900
7
- data.tar.gz: e9d53ba6883acc6decc743d4e480a682918c7f6db19e550e97d5455836a31250a29430ba846df03fab075cd410cff11b6c01ffe257522898c47c9f27d708b723
6
+ metadata.gz: ca3e4e74dce382bf33b72d9a294779576249ac3f949e6821647dd9a79bbb50b6cf5719c98198263ceae99c4412fb5ff0a77ec568a44bd19bca8ac6833d1f6eb2
7
+ data.tar.gz: 32ebc73d97471c1fb8419bd4c2b2e9f61b0a81780b0f0cc842edad6c7adddcdb3e100e8c66119c8198b0afaadb23c306e909d8d1a8463aedd99a9bf2a8788beb
data/.version CHANGED
@@ -1 +1 @@
1
- 1.27.4
1
+ 1.28.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
3
19
  ## 1.27.4
4
20
 
5
21
  Requires an Atlas that serves `GET /works/:id/health_check` (0.6.232 or later).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.27.4)
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,7 +16,7 @@ GEM
16
16
  base64 (0.3.0)
17
17
  connection_pool (2.5.5)
18
18
  diff-lcs (1.6.1)
19
- faraday (2.15.0)
19
+ faraday (2.15.1)
20
20
  faraday-net_http (>= 2.0, < 3.6)
21
21
  json
22
22
  logger
@@ -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
  #
@@ -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
- def self.set_thumbnails(id, thumbnail: nil, thumbnail_2x: nil, preview: nil, nuid: nil, on_behalf_of: nil)
151
- body = { thumbnail: thumbnail, thumbnail_2x: thumbnail_2x, preview: preview }.compact
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
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.4
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff