iiif-presentation 1.4.1 → 1.4.2

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: 5f68d7e5cd133fa903625a262109591f8806016df292b205b9cda95f8cb4b5d0
4
- data.tar.gz: 0fc72efe6625543c1c8462bbf0b810fe5882c5dbdee6156410654e9c29be6825
3
+ metadata.gz: 8e5872ac7de857fa05e0181916f712460413e5b08b09d0b99867cc14ae39e0e5
4
+ data.tar.gz: 213166e3e00800955380ed432a1b10fce3a497011af92db4657474ef56e4b2aa
5
5
  SHA512:
6
- metadata.gz: bd825465b2f3d72e6003b7db8e5ac8020040daf36a924d35b0d8553e4e51910ca880e5017cc9e2b86f6424ef1ca1febe6010f28b52eb657d6d66713a6b31344d
7
- data.tar.gz: dbb55a55e296777bfc1e422132604b83c53cdc16d63ba404575f1d4baee0afda7fc8cdb8f95480b4bdf83df6c23a4947d447306491ca65eb37273b717dce7e73
6
+ metadata.gz: 840576064059d424a68fc9917e30a6a2bc120fb7157691fae70edadaa705711301fd175a3942ce227298086c934ae0f0f471b8379a00314da9aea7b068643b07
7
+ data.tar.gz: 308dd4b3bcd7b4dfbfaa5147a4d0208dfaedaa69265577b43fd46e04e59be8f95f12a92667a12c935d07a534e6ef271ea2ce9d50dbc449b5a2af1a800b0a51d9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.4.2
@@ -31,11 +31,11 @@ module IIIF
31
31
  end
32
32
 
33
33
  def string_only_keys
34
- %w{ nav_date type format viewing_direction start_canvas }
34
+ %w{ nav_date type format rights viewing_direction start_canvas }
35
35
  end
36
36
 
37
37
  def array_only_keys
38
- %w{ metadata rights thumbnail rendering first last next prev items service }
38
+ %w{ metadata thumbnail rendering first last next prev items service }
39
39
  end
40
40
 
41
41
  def hash_only_keys
@@ -122,10 +122,9 @@ module IIIF
122
122
  end
123
123
  end
124
124
 
125
- self.uri_only_keys.each do |k|
125
+ uri_only_keys.each do |k|
126
126
  if self[k]
127
- vals = *self[k]
128
- vals.each { |val| validate_uri(val, k) }
127
+ Array(self[k]).each { |val| validate_uri(val, k) }
129
128
  end
130
129
  end
131
130
 
@@ -187,20 +186,12 @@ module IIIF
187
186
  raise IIIF::V3::Presentation::IllegalValueError, m
188
187
  end
189
188
  end
190
- # rights is Array; each entry is a Hash containing 'id' with a URI value
191
- if self.has_key?('rights')
192
- unless self['rights'].all? { |entry| entry.kind_of?(Hash) }
193
- m = 'rights must be an Array with Hash members'
194
- raise IIIF::V3::Presentation::IllegalValueError, m
195
- end
196
- self['rights'].each do |entry|
197
- unless entry.keys.include?('id')
198
- m = 'rights members must be a Hash including "id"'
199
- raise IIIF::V3::Presentation::IllegalValueError, m
200
- end
201
- validate_uri(entry['id'], 'id') # raises IllegalValueError
202
- end
189
+
190
+ if key?('rights') && !self['rights'].kind_of?(String)
191
+ m = 'rights must be a String'
192
+ raise IIIF::V3::Presentation::IllegalValueError, m
203
193
  end
194
+
204
195
  # rendering is Array; each entry is a Hash containing 'label' and 'format' keys
205
196
  if self.has_key?('rendering') && self['rendering']
206
197
  unless self['rendering'].all? { |entry| entry.kind_of?(Hash) }
@@ -46,6 +46,7 @@ describe IIIF::V3::AbstractResource do
46
46
  ],
47
47
  "id": "http://example.com/manifest",
48
48
  "type": "Manifest",
49
+ "rights": "http://creativecommons.org/licenses/by/4.0/",
49
50
  "label": "My Manifest",
50
51
  "service": [
51
52
  {
@@ -139,27 +139,19 @@ describe IIIF::V3::AbstractResource do
139
139
  expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
140
140
  end
141
141
  end
142
+
142
143
  describe 'rights' do
143
- it 'raises IllegalValueError for entry that is not a Hash' do
144
+ it 'raises IllegalValueError for entry that is not a string' do
144
145
  subject['rights'] = ['error']
145
- exp_err_msg = "rights must be an Array with Hash members"
146
- expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
146
+ expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError)
147
147
  end
148
- it 'does not raise error for entry with "id" that is URI' do
149
- subject['rights'] = [{ 'id' => 'http://example.org/rights', 'format' => 'text/html' }]
148
+
149
+ it 'does not raise error for entry that is string' do
150
+ subject['rights'] = 'http://example.org/rights'
150
151
  expect { subject.validate }.not_to raise_error
151
152
  end
152
- it 'raises IllegalValueError for entry with "id" that is not URI' do
153
- subject['rights'] = [{ 'id' => 'bar', 'format' => 'text/html' }]
154
- exp_err_msg = "id value must be a String containing a URI for #{subject.class}"
155
- expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
156
- end
157
- it 'raises IllegalValueError for entry that does not contain "id"' do
158
- subject['rights'] = [{ 'whoops' => 'http://example.org/rights' }]
159
- exp_err_msg = 'rights members must be a Hash including "id"'
160
- expect { subject.validate }.to raise_error(IIIF::V3::Presentation::IllegalValueError, exp_err_msg)
161
- end
162
153
  end
154
+
163
155
  describe 'rendering' do
164
156
  it 'raises IllegalValueError for entry that is not a Hash' do
165
157
  subject['rendering'] = ['error']
@@ -322,9 +322,7 @@ describe IIIF::V3::Presentation::Manifest do
322
322
  "viewingDirection" => "right-to-left",
323
323
  "viewingHint" => ["paged"],
324
324
  "navDate" => "1856-01-01T00:00:00Z",
325
- "rights" => [{
326
- "id" =>"http://example.org/license.html",
327
- "format" => "text/html"}],
325
+ "rights" => "http://example.org/license.html",
328
326
  "requiredStatement" => {
329
327
  "label": { "en": [ "Attribution" ] },
330
328
  "value": { "en": [ "bleah" ] },
@@ -96,7 +96,7 @@ describe IIIF::V3::Presentation::Sequence do
96
96
  expect(sequence_object.items.first).to eq canvas_object
97
97
  end
98
98
  end
99
-
99
+
100
100
  describe 'example from Stanford purl' do
101
101
  let(:seq_id) { 'https://example.org/abc666#sequence-1' }
102
102
  let(:sequence_object) {
@@ -184,7 +184,7 @@ describe IIIF::V3::Presentation::Sequence do
184
184
  }]
185
185
  }],
186
186
  'attribution' => 'Provided by Example Organization',
187
- 'rights' => [{'id' => 'http://www.example.org/license.html'}],
187
+ 'rights' => 'Sample rights',
188
188
  'logo' => 'http://www.example.org/logos/institution1.jpg',
189
189
  'see_also' => 'http://www.example.org/library/catalog/book1.xml',
190
190
  'service' => [{
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif-presentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Stroop
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-09-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -270,7 +269,6 @@ homepage: https://github.com/iiif/osullivan
270
269
  licenses:
271
270
  - Simplified BSD
272
271
  metadata: {}
273
- post_install_message:
274
272
  rdoc_options: []
275
273
  require_paths:
276
274
  - lib
@@ -285,8 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
283
  - !ruby/object:Gem::Version
286
284
  version: '0'
287
285
  requirements: []
288
- rubygems_version: 3.5.17
289
- signing_key:
286
+ rubygems_version: 3.6.9
290
287
  specification_version: 4
291
288
  summary: API for working with IIIF Presentation manifests.
292
289
  test_files: