atlas_rb 0.0.94 → 0.0.97

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: ed41f31beac084721efa710b8ed828897ee1634ce3dd399171180e7ed9cb7111
4
- data.tar.gz: 66066b767f77db9265294fdf019c2e35dd6b795de3f9c0b5509affeb9f11e39f
3
+ metadata.gz: 9b6ef40045a79aa04b9ca98e80e92a456ae933f5cbad55772d7de9c73786480d
4
+ data.tar.gz: 23c2f7a59045c1e1d7ec268fcaa2f47578f12e1a4ff4d7e21ab16a983e8c501b
5
5
  SHA512:
6
- metadata.gz: 9bffda9eb2af9d591e28c245ee041375d4e0dc0d884c26a86caf6fc1433c4dad1534a5e804f18a7b4b9a69cb03f1d679d96df7358d66c59357ad3830d5c5c04e
7
- data.tar.gz: 53fd40e34d0ea636d3b987f9739f364bb9528453f3514b2bb107dcc8db29ddaa28fbbe2380c330a77478c2c574ecb39e76ca6259998217fe896fe11f32255df8
6
+ metadata.gz: 743d6f4b3e107a41597faca5108f7bfaefc2fae92c0efbc3ea2668cbd043206f104f095f87b722bd90bb23a95b3d2de0f90d549ffade362d4e1ee983163b8c90
7
+ data.tar.gz: 64bbc84b852c22d6d4894b1f59e2809ada532d8fc31790eccd2615756ac7c11905608e589a981940bfb1d6beaccd75bc4f3ba801c0e4fc6c1665dc9f7ffd53ba
data/.version CHANGED
@@ -1 +1 @@
1
- 0.0.94
1
+ 0.0.97
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (0.0.94)
4
+ atlas_rb (0.0.97)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
data/README.md CHANGED
@@ -123,7 +123,7 @@ work = AtlasRb::Work.create(collection.id, "/tmp/work-mods.xml")
123
123
  blob = AtlasRb::Blob.create(work.id, "/tmp/upload.tmp", "thesis.pdf")
124
124
 
125
125
  # 3. List everything attached to the work.
126
- AtlasRb::Work.files(work.id)
126
+ AtlasRb::Work.assets(work.id)
127
127
 
128
128
  # 4. Stream the binary back without buffering it in memory.
129
129
  File.open("out.pdf", "wb") do |f|
@@ -125,7 +125,12 @@ module AtlasRb
125
125
  AtlasRb::Mash.new(JSON.parse(multipart({}).patch(ROUTE + id, payload)&.body))
126
126
  end
127
127
 
128
- # Patch individual metadata fields without uploading a full MODS document.
128
+ # Patch individual descriptive-metadata fields without uploading a
129
+ # full MODS document.
130
+ #
131
+ # Scoped to user-authored descriptive metadata only. Programmatic
132
+ # writes of machine-set Delegate URIs (thumbnails) have their own
133
+ # purpose-specific endpoint — see {.set_thumbnails}.
129
134
  #
130
135
  # @param id [String] the Collection ID.
131
136
  # @param values [Hash] field-level metadata updates.
@@ -137,6 +142,33 @@ module AtlasRb
137
142
  AtlasRb::Mash.new(JSON.parse(connection({ metadata: values }).patch(ROUTE + id)&.body))
138
143
  end
139
144
 
145
+ # Attach the three thumbnail/preview Delegate URIs to a Collection.
146
+ #
147
+ # Collection-level mirror of {Work.set_thumbnails}. Atlas dispatches
148
+ # each non-blank URI to its matching Delegate role
149
+ # (`thumbnail_image` / `thumbnail_image_2x` / `preview_image`) via
150
+ # `DelegateUpdater`. Missing keys are left untouched.
151
+ #
152
+ # @param id [String] the Collection ID.
153
+ # @param thumbnail [String, nil] IIIF URI for the ~85² thumbnail.
154
+ # @param thumbnail_2x [String, nil] IIIF URI for the ~170² 2x thumbnail.
155
+ # @param preview [String, nil] IIIF URI for the ~500w preview image.
156
+ # @return [AtlasRb::Mash] the parsed JSON response.
157
+ #
158
+ # @example
159
+ # AtlasRb::Collection.set_thumbnails(
160
+ # "col-456",
161
+ # thumbnail: "https://iiif.example.edu/iiif/3/c.jp2/full/!85,85/0/default.jpg",
162
+ # thumbnail_2x: "https://iiif.example.edu/iiif/3/c.jp2/full/!170,170/0/default.jpg",
163
+ # preview: "https://iiif.example.edu/iiif/3/c.jp2/full/500,/0/default.jpg"
164
+ # )
165
+ def self.set_thumbnails(id, thumbnail: nil, thumbnail_2x: nil, preview: nil)
166
+ body = { thumbnail: thumbnail, thumbnail_2x: thumbnail_2x, preview: preview }.compact
167
+ AtlasRb::Mash.new(JSON.parse(
168
+ connection({}).patch(ROUTE + id + '/thumbnails', JSON.dump(body))&.body
169
+ ))
170
+ end
171
+
140
172
  # Fetch the Collection's MODS representation in the requested format.
141
173
  #
142
174
  # @param id [String] the Collection ID.
@@ -130,7 +130,12 @@ module AtlasRb
130
130
  AtlasRb::Mash.new(JSON.parse(multipart({}).patch(ROUTE + id, payload)&.body))
131
131
  end
132
132
 
133
- # Patch individual metadata fields without uploading a full MODS document.
133
+ # Patch individual descriptive-metadata fields without uploading a
134
+ # full MODS document.
135
+ #
136
+ # Scoped to user-authored descriptive metadata only. Programmatic
137
+ # writes of machine-set Delegate URIs (thumbnails) have their own
138
+ # purpose-specific endpoint — see {.set_thumbnails}.
134
139
  #
135
140
  # @param id [String] the Community ID.
136
141
  # @param values [Hash] field-level metadata updates (shape determined by
@@ -143,6 +148,33 @@ module AtlasRb
143
148
  AtlasRb::Mash.new(JSON.parse(connection({ metadata: values }).patch(ROUTE + id)&.body))
144
149
  end
145
150
 
151
+ # Attach the three thumbnail/preview Delegate URIs to a Community.
152
+ #
153
+ # Community-level mirror of {Work.set_thumbnails}. Atlas dispatches
154
+ # each non-blank URI to its matching Delegate role
155
+ # (`thumbnail_image` / `thumbnail_image_2x` / `preview_image`) via
156
+ # `DelegateUpdater`. Missing keys are left untouched.
157
+ #
158
+ # @param id [String] the Community ID.
159
+ # @param thumbnail [String, nil] IIIF URI for the ~85² thumbnail.
160
+ # @param thumbnail_2x [String, nil] IIIF URI for the ~170² 2x thumbnail.
161
+ # @param preview [String, nil] IIIF URI for the ~500w preview image.
162
+ # @return [AtlasRb::Mash] the parsed JSON response.
163
+ #
164
+ # @example
165
+ # AtlasRb::Community.set_thumbnails(
166
+ # "c-123",
167
+ # thumbnail: "https://iiif.example.edu/iiif/3/m.jp2/full/!85,85/0/default.jpg",
168
+ # thumbnail_2x: "https://iiif.example.edu/iiif/3/m.jp2/full/!170,170/0/default.jpg",
169
+ # preview: "https://iiif.example.edu/iiif/3/m.jp2/full/500,/0/default.jpg"
170
+ # )
171
+ def self.set_thumbnails(id, thumbnail: nil, thumbnail_2x: nil, preview: nil)
172
+ body = { thumbnail: thumbnail, thumbnail_2x: thumbnail_2x, preview: preview }.compact
173
+ AtlasRb::Mash.new(JSON.parse(
174
+ connection({}).patch(ROUTE + id + '/thumbnails', JSON.dump(body))&.body
175
+ ))
176
+ end
177
+
146
178
  # Fetch the Community's MODS representation in the requested format.
147
179
  #
148
180
  # @param id [String] the Community ID.
data/lib/atlas_rb/work.rb CHANGED
@@ -177,7 +177,13 @@ module AtlasRb
177
177
  AtlasRb::Mash.new(JSON.parse(multipart({}).patch(ROUTE + id, payload)&.body))
178
178
  end
179
179
 
180
- # Patch individual metadata fields without uploading a full MODS document.
180
+ # Patch individual descriptive-metadata fields without uploading a
181
+ # full MODS document.
182
+ #
183
+ # Scoped to user-authored descriptive metadata only. Programmatic
184
+ # writes of machine-set Delegate URIs (thumbnails, image
185
+ # derivatives) have their own purpose-specific endpoints — see
186
+ # {.set_thumbnails} and {.set_image_derivatives}.
181
187
  #
182
188
  # @param id [String] the Work ID.
183
189
  # @param values [Hash] field-level metadata updates.
@@ -189,6 +195,64 @@ module AtlasRb
189
195
  AtlasRb::Mash.new(JSON.parse(connection({ metadata: values }).patch(ROUTE + id)&.body))
190
196
  end
191
197
 
198
+ # Attach the three thumbnail/preview Delegate URIs to a Work.
199
+ #
200
+ # Purpose-specific PATCH for the `thumbnail_image` /
201
+ # `thumbnail_image_2x` / `preview_image` Delegate roles. Atlas
202
+ # dispatches each URI to its matching role via `DelegateUpdater`.
203
+ # Distinct from {.metadata} — these are machine-set IIIF URIs, not
204
+ # user-authored descriptive content. Missing keys are left
205
+ # untouched server-side; only the URIs you pass are upserted.
206
+ #
207
+ # @param id [String] the Work ID.
208
+ # @param thumbnail [String, nil] IIIF URI for the ~85² thumbnail.
209
+ # @param thumbnail_2x [String, nil] IIIF URI for the ~170² 2x thumbnail.
210
+ # @param preview [String, nil] IIIF URI for the ~500w preview image.
211
+ # @return [AtlasRb::Mash] the parsed JSON response.
212
+ #
213
+ # @example
214
+ # AtlasRb::Work.set_thumbnails(
215
+ # "w-789",
216
+ # thumbnail: "https://iiif.example.edu/iiif/3/abc.jp2/full/!85,85/0/default.jpg",
217
+ # thumbnail_2x: "https://iiif.example.edu/iiif/3/abc.jp2/full/!170,170/0/default.jpg",
218
+ # preview: "https://iiif.example.edu/iiif/3/abc.jp2/full/500,/0/default.jpg"
219
+ # )
220
+ def self.set_thumbnails(id, thumbnail: nil, thumbnail_2x: nil, preview: nil)
221
+ body = { thumbnail: thumbnail, thumbnail_2x: thumbnail_2x, preview: preview }.compact
222
+ AtlasRb::Mash.new(JSON.parse(
223
+ connection({}).patch(ROUTE + id + '/thumbnails', JSON.dump(body))&.body
224
+ ))
225
+ end
226
+
227
+ # Attach the three image-derivative Delegate URIs to a Work.
228
+ #
229
+ # Sibling of {.set_thumbnails} for the `small_image` /
230
+ # `medium_image` / `large_image` Delegate roles. Atlas dispatches
231
+ # each URI to its matching role via `DelegateUpdater`. The
232
+ # resulting Delegates are downloadable and surface through
233
+ # {.assets} for the downloads UI. Missing keys are left untouched
234
+ # server-side; only the URIs you pass are upserted.
235
+ #
236
+ # @param id [String] the Work ID.
237
+ # @param small [String, nil] IIIF URI for the small derivative.
238
+ # @param medium [String, nil] IIIF URI for the medium derivative.
239
+ # @param large [String, nil] IIIF URI for the large derivative.
240
+ # @return [AtlasRb::Mash] the parsed JSON response.
241
+ #
242
+ # @example
243
+ # AtlasRb::Work.set_image_derivatives(
244
+ # "w-789",
245
+ # small: "https://iiif.example.edu/iiif/3/abc.jp2/full/800,/0/default.jpg",
246
+ # medium: "https://iiif.example.edu/iiif/3/abc.jp2/full/1600,/0/default.jpg",
247
+ # large: "https://iiif.example.edu/iiif/3/abc.jp2/full/full/0/default.jpg"
248
+ # )
249
+ def self.set_image_derivatives(id, small: nil, medium: nil, large: nil)
250
+ body = { small: small, medium: medium, large: large }.compact
251
+ AtlasRb::Mash.new(JSON.parse(
252
+ connection({}).patch(ROUTE + id + '/image_derivatives', JSON.dump(body))&.body
253
+ ))
254
+ end
255
+
192
256
  # List the assets attached to a Work — {Blob}s and {Delegate}s alike.
193
257
  #
194
258
  # Useful for building download UIs — the response includes enough to
@@ -208,11 +272,6 @@ module AtlasRb
208
272
  JSON.parse(connection({}).get(ROUTE + id + '/assets')&.body).map { |entry| AtlasRb::Mash.new(entry) }
209
273
  end
210
274
 
211
- # @deprecated Use {.assets} instead. Will be removed in the next release.
212
- def self.files(id)
213
- assets(id)
214
- end
215
-
216
275
  # Fetch the Work's MODS representation in the requested format.
217
276
  #
218
277
  # @param id [String] the Work ID.
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: 0.0.94
4
+ version: 0.0.97
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-15 00:00:00.000000000 Z
11
+ date: 2026-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday