iiif_manifest 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f04edfce006264b8b8cb8d2a8682c091dbd5d5d09677548fd19c3e905eae08bc
4
- data.tar.gz: 8a50d0a1316e868cda2cea0b3533d768e77044293a8b1a6f3f9f5fcb3436c1d4
3
+ metadata.gz: a7ea1cecc789123d7b703170f21175f9c1ba0bffb42b304b6f2a6aa60915fa87
4
+ data.tar.gz: ebfd7b8387200042de0803680797421573e00b6fba6d48c8d30e57ad34b43ca7
5
5
  SHA512:
6
- metadata.gz: 6164c0ecc842baf3b324e42d160be61bfd8705636fddc0743c9a819c70290d607d379eec12ad22523ebe5dbc0639fcd471d9ef3b3c9143acd699acea0e60f282
7
- data.tar.gz: 9d174422877c7806646013f6df2e37e5395d8c56ce461785e971df6a7905354b870c31533498d5039f1b3ed711154f8f5e3c079ca7900b1d5f6396158d9aa492
6
+ metadata.gz: 3fc57f1933acddeed084c7b70931e425c815f0268fb83b23a38a921b248ca38e6a2f614c02251a9207da1a7ecbbaa8f50febe66c8994718798ad227ced072ba0
7
+ data.tar.gz: c7068077352a0ee38a3b43aef1d3317e118cb57796c01953e143d1f8395d890847cf830804f292ff7daef1aa5ffcdb969d0c318f4d6dc5e4628a6f8c4fd04642
data/README.md CHANGED
@@ -126,6 +126,7 @@ In Presentation 3.0, additionally it **_may_** implement;
126
126
  - `#part_of` to contain an array of hashes for parent resources to be offered at each leaf node. Items must contain "id" and "type" properties. Items should contain "label".
127
127
  - `#homepage` to contain an array of hashes for homepage resources to be offered at each leaf node. Items must contain "id", "type", and "label" properties. Items should contain a "format" property and may contain a "language" property.
128
128
  - `#placeholder_content` to contain an instance of `IIIFManifest::V3::DisplayContent` for [`placeholderCanvas`](https://iiif.io/api/presentation/3.0/#placeholdercanvas) at each leaf node
129
+ - `#service` to contain an array of hashes for services. Each must contain "id" and "type" and may contain any other arbitrary properties.
129
130
 
130
131
  ```ruby
131
132
  class Page
@@ -146,7 +147,7 @@ In Presentation 3.0, additionally it **_may_** implement;
146
147
  )
147
148
  end
148
149
 
149
- # --------------------------------------- Presentation 3.0 (Alpha) ---------------------------------------
150
+ # --------------------------------------- Presentation 3.0 ---------------------------------------
150
151
  def sequence_rendering
151
152
  [{"@id" => "http://test.host/display_image/id/download", "format" => "application/pdf", "label" => "Download"}]
152
153
  end
@@ -170,7 +171,17 @@ In Presentation 3.0, additionally it **_may_** implement;
170
171
  type: "Image",
171
172
  format: "image/jpeg")
172
173
  end
173
- # --------------------------------------- Presentation 3.0 (Alpha) ---------------------------------------
174
+
175
+ def service
176
+ [
177
+ {
178
+ "@context" => "http://iiif.io/api/annext/services/example/context.json",
179
+ "@id" => "https://example.org/service",
180
+ "profile" => "https://example.org/docs/service"
181
+ }
182
+ ]
183
+ end
184
+ # --------------------------------------- Presentation 3.0 ---------------------------------------
174
185
 
175
186
  private
176
187
 
@@ -33,7 +33,7 @@ module IIIFManifest
33
33
  end
34
34
 
35
35
  def body_id
36
- return if content.try(:body_id).blank? && content.try(:url).blank?
36
+ return '' if content.try(:body_id).blank? && content.try(:url).blank?
37
37
  if content.try(:body_id).present?
38
38
  content.body_id
39
39
  else
@@ -80,9 +80,16 @@ module IIIFManifest
80
80
  apply_canvas_attributes(canvas)
81
81
  apply_annotation_content_to(canvas)
82
82
  apply_thumbnail_to(canvas)
83
+ apply_dimensions(canvas)
83
84
  end
84
85
  # rubocop:enable Metrics/AbcSize
85
86
 
87
+ def apply_dimensions(canvas)
88
+ return unless !display_content && placeholder_content
89
+ canvas['width'] = placeholder_content.width if placeholder_content.width.present?
90
+ canvas['height'] = placeholder_content.height if placeholder_content.height.present?
91
+ end
92
+
86
93
  def apply_annotation_content_to(canvas)
87
94
  return if annotation_content.blank?
88
95
 
@@ -108,6 +115,7 @@ module IIIFManifest
108
115
  canvas.summary = ManifestBuilder.language_map(record.description) if record.respond_to?(:description) &&
109
116
  record.description.present?
110
117
  canvas.homepage = populate(:homepage) if populate(:homepage).present?
118
+ canvas.service = populate(:service) if populate(:service).present?
111
119
  end
112
120
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
113
121
 
@@ -182,6 +182,14 @@ module IIIFManifest
182
182
  def homepage=(homepage)
183
183
  inner_hash['homepage'] = homepage
184
184
  end
185
+
186
+ def service
187
+ inner_hash['service'] || []
188
+ end
189
+
190
+ def service=(service)
191
+ inner_hash['service'] = service
192
+ end
185
193
  end
186
194
 
187
195
  class Range < IIIFService
@@ -235,7 +243,8 @@ module IIIFManifest
235
243
 
236
244
  def initial_attributes
237
245
  {
238
- 'type' => 'AnnotationPage'
246
+ 'type' => 'AnnotationPage',
247
+ 'items' => []
239
248
  }
240
249
  end
241
250
  end
@@ -1,3 +1,3 @@
1
1
  module IIIFManifest
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif_manifest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-04-01 00:00:00.000000000 Z
12
+ date: 2024-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport