iiif_manifest 0.4.0 → 0.5.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/.gitignore +0 -0
- data/.rspec +0 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +36 -0
- data/.travis.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +27 -10
- data/Rakefile +0 -0
- data/iiif_manifest.gemspec +2 -1
- data/lib/iiif_manifest.rb +1 -0
- data/lib/iiif_manifest/display_image.rb +0 -0
- data/lib/iiif_manifest/iiif_collection.rb +6 -4
- data/lib/iiif_manifest/iiif_endpoint.rb +0 -0
- data/lib/iiif_manifest/manifest_builder.rb +6 -6
- data/lib/iiif_manifest/manifest_builder/canvas_builder.rb +12 -12
- data/lib/iiif_manifest/manifest_builder/canvas_builder_factory.rb +3 -3
- data/lib/iiif_manifest/manifest_builder/child_manifest_builder_factory.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/composite_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/composite_builder_factory.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/deep_canvas_builder_factory.rb +6 -6
- data/lib/iiif_manifest/manifest_builder/iiif_service.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/image_builder.rb +9 -9
- data/lib/iiif_manifest/manifest_builder/image_service_builder.rb +3 -3
- data/lib/iiif_manifest/manifest_builder/record_property_builder.rb +50 -51
- data/lib/iiif_manifest/manifest_builder/resource_builder.rb +9 -9
- data/lib/iiif_manifest/manifest_builder/sequence_builder.rb +19 -19
- data/lib/iiif_manifest/manifest_builder/structure_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_factory.rb +3 -3
- data/lib/iiif_manifest/manifest_service_locator.rb +0 -0
- data/lib/iiif_manifest/v3.rb +13 -0
- data/lib/iiif_manifest/v3/display_content.rb +17 -0
- data/lib/iiif_manifest/v3/manifest_builder.rb +61 -0
- data/lib/iiif_manifest/v3/manifest_builder/body_builder.rb +48 -0
- data/lib/iiif_manifest/v3/manifest_builder/canvas_builder.rb +77 -0
- data/lib/iiif_manifest/v3/manifest_builder/choice_builder.rb +47 -0
- data/lib/iiif_manifest/v3/manifest_builder/content_builder.rb +38 -0
- data/lib/iiif_manifest/v3/manifest_builder/iiif_service.rb +235 -0
- data/lib/iiif_manifest/v3/manifest_builder/image_service_builder.rb +35 -0
- data/lib/iiif_manifest/v3/manifest_builder/record_property_builder.rb +97 -0
- data/lib/iiif_manifest/v3/manifest_builder/structure_builder.rb +87 -0
- data/lib/iiif_manifest/v3/manifest_factory.rb +38 -0
- data/lib/iiif_manifest/v3/manifest_service_locator.rb +148 -0
- data/lib/iiif_manifest/version.rb +1 -1
- metadata +29 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cba606c659d4ff84c0709b6332ba67cdf938015
|
4
|
+
data.tar.gz: a140e32c9319b5747210da28634becb8213f35d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fbbff5fca777d6e14bda44fe3d46df558234b872a87e62d4136f011c4a1909a4659966dc1ddd6b2e2769de6cdb10898a10c13b832b39efe926c6d4f1ee9739b
|
7
|
+
data.tar.gz: 48db3a55ee7899108d8c89a5a126046f0b92bc1b91fa983a3f47e0bd6a0db2dc32af8a56b7b0143c003481b69dcb348aaa336ef63936699fdfd9730a2d594d48
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require: rubocop-rspec
|
2
2
|
inherit_from: .rubocop_todo.yml
|
3
|
+
inherit_gem:
|
4
|
+
bixby: bixby_default.yml
|
3
5
|
|
4
6
|
AllCops:
|
5
7
|
DisplayCopNames: true
|
@@ -14,6 +16,7 @@ Metrics/BlockLength:
|
|
14
16
|
Naming/MethodName:
|
15
17
|
Exclude:
|
16
18
|
- 'lib/iiif_manifest/manifest_builder/iiif_service.rb'
|
19
|
+
- 'lib/iiif_manifest/v3/manifest_builder/iiif_service.rb'
|
17
20
|
|
18
21
|
RSpec/MultipleExpectations:
|
19
22
|
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -11,6 +11,10 @@ Metrics/AbcSize:
|
|
11
11
|
Exclude:
|
12
12
|
- 'lib/iiif_manifest/manifest_builder/resource_builder.rb'
|
13
13
|
- 'lib/iiif_manifest/manifest_factory.rb'
|
14
|
+
- 'lib/iiif_manifest/v3/manifest_builder/body_builder.rb'
|
15
|
+
- 'lib/iiif_manifest/v3/manifest_factory.rb'
|
16
|
+
- 'lib/iiif_manifest/v3/manifest_builder/content_builder.rb'
|
17
|
+
- 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb'
|
14
18
|
|
15
19
|
# Offense count: 1
|
16
20
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
@@ -31,16 +35,23 @@ RSpec/NamedSubject:
|
|
31
35
|
- 'spec/lib/iiif_manifest/display_image_spec.rb'
|
32
36
|
- 'spec/lib/iiif_manifest/iiif_endpoint_spec.rb'
|
33
37
|
- 'spec/lib/iiif_manifest/manifest_builder/resource_builder_spec.rb'
|
38
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/body_builder_spec.rb'
|
39
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/structure_builder_spec.rb'
|
34
40
|
|
35
41
|
# Offense count: 1
|
36
42
|
# Configuration parameters: IgnoreSymbolicNames.
|
37
43
|
RSpec/VerifiedDoubles:
|
38
44
|
Exclude:
|
39
45
|
- 'spec/lib/iiif_manifest/display_image_spec.rb'
|
46
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/canvas_builder_spec.rb'
|
47
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/structure_builder_spec.rb'
|
40
48
|
|
41
49
|
RSpec/ExampleLength:
|
42
50
|
Exclude:
|
43
51
|
- 'spec/lib/iiif_manifest/manifest_factory_spec.rb'
|
52
|
+
- 'spec/lib/iiif_manifest/v3/manifest_factory_spec.rb'
|
53
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/body_builder_spec.rb'
|
54
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/structure_builder_spec.rb'
|
44
55
|
|
45
56
|
# Offense count: 20
|
46
57
|
Style/Documentation:
|
@@ -66,7 +77,21 @@ Style/Documentation:
|
|
66
77
|
- 'lib/iiif_manifest/manifest_service_locator.rb'
|
67
78
|
- 'lib/iiif_manifest.rb'
|
68
79
|
- 'lib/iiif_manifest/manifest_builder/iiif_service.rb'
|
80
|
+
- 'lib/iiif_manifest/v3.rb'
|
81
|
+
- 'lib/iiif_manifest/v3/display_content.rb'
|
82
|
+
- 'lib/iiif_manifest/v3/manifest_factory.rb'
|
83
|
+
- 'lib/iiif_manifest/v3/manifest_builder/structure_builder.rb'
|
84
|
+
- 'lib/iiif_manifest/v3/manifest_builder/iiif_service.rb'
|
85
|
+
- 'lib/iiif_manifest/v3/manifest_builder/canvas_builder.rb'
|
86
|
+
- 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb'
|
87
|
+
- 'lib/iiif_manifest/v3/manifest_builder/content_builder.rb'
|
88
|
+
- 'lib/iiif_manifest/v3/manifest_builder/body_builder.rb'
|
89
|
+
- 'lib/iiif_manifest/v3/manifest_builder/record_property_builder.rb'
|
90
|
+
- 'lib/iiif_manifest/v3/manifest_builder/image_service_builder.rb'
|
91
|
+
- 'lib/iiif_manifest/v3/manifest_builder.rb'
|
92
|
+
- 'lib/iiif_manifest/v3/manifest_service_locator.rb'
|
69
93
|
- 'spec/lib/iiif_manifest/manifest_factory_spec.rb'
|
94
|
+
- 'spec/lib/iiif_manifest/v3/manifest_factory_spec.rb'
|
70
95
|
|
71
96
|
# Offense count: 1
|
72
97
|
Style/MethodMissing:
|
@@ -76,6 +101,7 @@ Style/MethodMissing:
|
|
76
101
|
Metrics/ClassLength:
|
77
102
|
Exclude:
|
78
103
|
- 'lib/iiif_manifest/manifest_service_locator.rb'
|
104
|
+
- 'lib/iiif_manifest/v3/manifest_service_locator.rb'
|
79
105
|
|
80
106
|
# Offense count: 1
|
81
107
|
# Cop supports --auto-correct.
|
@@ -83,3 +109,13 @@ Metrics/ClassLength:
|
|
83
109
|
# SupportedStyles: percent, brackets
|
84
110
|
Style/SymbolArray:
|
85
111
|
EnforcedStyle: brackets
|
112
|
+
|
113
|
+
Metrics/ParameterLists:
|
114
|
+
Exclude:
|
115
|
+
- 'lib/iiif_manifest/v3/display_content.rb'
|
116
|
+
- 'lib/iiif_manifest/v3/manifest_builder/canvas_builder.rb'
|
117
|
+
|
118
|
+
RSpec/NestedGroups:
|
119
|
+
Exclude:
|
120
|
+
- 'spec/lib/iiif_manifest/v3/manifest_factory_spec.rb'
|
121
|
+
- 'spec/lib/iiif_manifest/v3/manifest_builder/body_builder_spec.rb'
|
data/.travis.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# IIIFManifest
|
2
|
-
[](https://travis-ci.org/projecthydra-labs/iiif_manifest)
|
3
3
|
|
4
4
|
IIIF http://iiif.io/ defines an API for presenting related images in a viewer. This transforms Hydra::Works objects into that format usable by players such as http://universalviewer.io/
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
8
|
-
Your application ***must*** have an object that implements `#file_set_presenters` and `#work_presenters`. The former method should return as set of leaf nodes and the later any interstitial nodes. If none are found an empty array should be returned.
|
8
|
+
Your application ***must*** have an object that implements `#file_set_presenters` and `#work_presenters`. The former method should return as set of leaf nodes and the later any interstitial nodes. If none are found an empty array should be returned.
|
9
9
|
|
10
10
|
Additionally, it ***must*** have a `#description` method that returns a string.
|
11
11
|
|
12
|
-
Additionally it ***should*** implement `#manifest_url` that shows where the manifest can be found.
|
12
|
+
Additionally it ***should*** implement `#manifest_url` that shows where the manifest can be found.
|
13
13
|
|
14
|
-
Additionally it ***should*** implement `#manifest_metadata` to provide an array containing hashes of metadata Label/Value pairs.
|
14
|
+
Additionally it ***should*** implement `#manifest_metadata` to provide an array containing hashes of metadata Label/Value pairs.
|
15
15
|
|
16
|
-
Additionally it ***may*** implement `#search_service` to contain the url for an IIIF search api compliant search endpoint and `#autocomplete_service` to contain the url for an IIIF search api compliant autocomplete endpoint. Please note, the autocomplete service is embedded within the search service description so if an autocomplete_service is supplied without a search_service it will be ignored. The IIIF `profile` added to the service descriptions is version 0 as this is the version supported by the current version of Universal Viewer. Only include a search_service within the manifest if your application has impelmented an IIIF search service at the endpoint specified in the manifest.
|
16
|
+
Additionally it ***may*** implement `#search_service` to contain the url for an IIIF search api compliant search endpoint and `#autocomplete_service` to contain the url for an IIIF search api compliant autocomplete endpoint. Please note, the autocomplete service is embedded within the search service description so if an autocomplete_service is supplied without a search_service it will be ignored. The IIIF `profile` added to the service descriptions is version 0 as this is the version supported by the current version of Universal Viewer. Only include a search_service within the manifest if your application has impelmented an IIIF search service at the endpoint specified in the manifest.
|
17
17
|
|
18
18
|
Additionally it ***may*** implement `#sequence_rendering` to contain an array of hashes for file downloads to be offered at sequences level. Each hash must contain "@id", "format" (mime type) and "label" (eg. `{ "@id" => "download url", "format" => "application/pdf", "label" => "user friendly label" }`).
|
19
19
|
|
@@ -45,18 +45,18 @@ For example:
|
|
45
45
|
def description
|
46
46
|
'a brief description'
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def manifest_metadata
|
50
50
|
[
|
51
51
|
{ "label" => "Title", "value" => "Title of the Item" },
|
52
52
|
{ "label" => "Creator", "value" => "Morrissey, Stephen Patrick" }
|
53
53
|
]
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def search_service
|
57
57
|
"http://test.host/books/#{@id}/search"
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def autocomplete_service
|
61
61
|
"http://test.host/books/#{@id}/autocomplete"
|
62
62
|
end
|
@@ -127,6 +127,24 @@ Then you can produce the manifest on the book object like this:
|
|
127
127
|
IIIFManifest::ManifestFactory.new(book).to_h.to_json
|
128
128
|
```
|
129
129
|
|
130
|
+
## Presentation 3.0 (Alpha)
|
131
|
+
|
132
|
+
Provisional support for the [3.0 alpha version of the IIIF presentation api spec](https://iiif.io/api/presentation/3.0/) has been added with a focus on audiovisual content. The [change log](https://iiif.io/api/presentation/3.0/change-log/) lists the changes to the specification.
|
133
|
+
|
134
|
+
The presentation 3.0 support has been contained to the `V3` namespace. Version 2.0 manifests are still be built using `IIIFManifest::ManifestFactory` while version 3.0 manifets can now be built using `IIIFManifest::V3::ManifestFactory`.
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
book = Book.new('book-77',[Page.new('page-99')])
|
138
|
+
IIIFManifest::V3::ManifestFactory.new(book).to_h.to_json
|
139
|
+
```
|
140
|
+
|
141
|
+
### Notable changes for Presentation 3.0
|
142
|
+
- Presenters must still define `#description` but it is now serialized as `summary`. (https://iiif.io/api/presentation/3.0/change-log/#126-rename-description-to-summary)
|
143
|
+
- All textual strings, including metadata labels and values, are now serialized as language maps and may be provided as a hash with language code keys with string values. Values not provided in this format are automatically converted so no change to `#description`, `#manifest_metadata`, range labels, or other fields are required. (https://iiif.io/api/presentation/3.0/change-log/#133-use-language-map-pattern-for-label-value-summary)
|
144
|
+
- File set presenters may target a fragment of its content by providing `#media_fragment` which will be appended to its `id`.
|
145
|
+
- Range objects may now implement `#items` instead of `#ranges` and `#file_set_presenters` to allow for interleaving these objects. `#items` is not required and existing range objects should continue to work.
|
146
|
+
- File set presenters may provide `#display_content` which should return an instance of `IIIFManifest::V3::DisplayContent` (or an array of instances in the case of a user `Choice`). `#display_image` is no longer required but will still work if provided.
|
147
|
+
|
130
148
|
## Development
|
131
149
|
|
132
150
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -135,5 +153,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
135
153
|
|
136
154
|
## Contributing
|
137
155
|
|
138
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
139
|
-
|
156
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/samvera-labs/iiif_manifest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/Rakefile
CHANGED
File without changes
|
data/iiif_manifest.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'iiif_manifest/version'
|
4
4
|
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_dependency 'activesupport', '>= 4'
|
21
21
|
|
22
|
+
spec.add_development_dependency 'bixby', '~> 1.0'
|
22
23
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
23
24
|
spec.add_development_dependency 'pry-byebug'
|
24
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/iiif_manifest.rb
CHANGED
File without changes
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module IIIFManifest
|
2
|
+
class IIIFCollection < SimpleDelegator
|
3
|
+
def viewing_hint
|
4
|
+
return super if __getobj__.respond_to?(:viewing_hint)
|
5
|
+
'multi-part'
|
6
|
+
end
|
5
7
|
end
|
6
8
|
end
|
File without changes
|
@@ -35,12 +35,12 @@ module IIIFManifest
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
def manifest
|
39
|
+
@manifest ||= manifest_builder_class
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
def top_record
|
43
|
+
top_record_factory.new
|
44
|
+
end
|
45
45
|
end
|
46
46
|
end
|
@@ -28,18 +28,18 @@ module IIIFManifest
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
def display_image
|
32
|
+
record.display_image if record.respond_to?(:display_image)
|
33
|
+
end
|
34
|
+
|
35
|
+
def apply_record_properties
|
36
|
+
canvas['@id'] = path
|
37
|
+
canvas.label = record.to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
def attach_image
|
41
|
+
image_builder.new(display_image).apply(canvas)
|
42
|
+
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -26,13 +26,13 @@ module IIIFManifest
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def file_set_presenters
|
30
|
+
work.try(:file_set_presenters) || []
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def work_presenters
|
34
|
+
work.try(:work_presenters) || []
|
35
|
+
end
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
File without changes
|
@@ -18,17 +18,17 @@ module IIIFManifest
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def build_resource
|
22
|
+
resource_builder.apply(annotation)
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def resource_builder
|
26
|
+
resource_builder_factory.new(display_image)
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def annotation
|
30
|
+
@annotation ||= iiif_annotation_factory.new
|
31
|
+
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -8,7 +8,6 @@ module IIIFManifest
|
|
8
8
|
@iiif_autocomplete_service_factory = iiif_autocomplete_service_factory
|
9
9
|
end
|
10
10
|
|
11
|
-
# rubocop:disable Metrics/AbcSize
|
12
11
|
def apply(manifest)
|
13
12
|
manifest['@id'] = record.manifest_url.to_s
|
14
13
|
manifest.label = record.to_s
|
@@ -23,65 +22,65 @@ module IIIFManifest
|
|
23
22
|
|
24
23
|
private
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
def viewing_hint
|
26
|
+
(record.respond_to?(:viewing_hint) && record.send(:viewing_hint))
|
27
|
+
end
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def viewing_direction
|
30
|
+
(record.respond_to?(:viewing_direction) && record.send(:viewing_direction))
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
def autocomplete_service
|
34
|
+
(record.respond_to?(:autocomplete_service) && record.send(:autocomplete_service))
|
35
|
+
end
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def search_service
|
38
|
+
(record.respond_to?(:search_service) && record.send(:search_service))
|
39
|
+
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def iiif_search_service
|
42
|
+
@iiif_search_service ||= iiif_search_service_factory.new
|
43
|
+
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
def iiif_autocomplete_service
|
46
|
+
@iiif_autocomplete_service ||= iiif_autocomplete_service_factory.new
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
49
|
+
# Build services. Currently supported:
|
50
|
+
# search_service, with (optional) embedded autocomplete service
|
51
|
+
#
|
52
|
+
# @return [Array] array of services
|
53
|
+
def services
|
54
|
+
iiif_search_service.search_service = search_service
|
55
|
+
iiif_autocomplete_service.autocomplete_service = autocomplete_service
|
56
|
+
iiif_search_service.service = iiif_autocomplete_service if autocomplete_service.present?
|
57
|
+
[iiif_search_service]
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
# Validate manifest_metadata against the IIIF spec format for metadata
|
61
|
+
#
|
62
|
+
# @return [Boolean]
|
63
|
+
def valid_metadata?
|
64
|
+
return false unless record.respond_to?(:manifest_metadata)
|
65
|
+
metadata = record.manifest_metadata
|
66
|
+
valid_metadata_structure?(metadata) && valid_metadata_content?(metadata)
|
67
|
+
end
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
# Manifest metadata must be an array containing hashes
|
70
|
+
#
|
71
|
+
# @param metadata [Array<Hash>] a list of metadata with label and value as required keys for each entry
|
72
|
+
# @return [Boolean]
|
73
|
+
def valid_metadata_structure?(metadata)
|
74
|
+
metadata.is_a?(Array) && metadata.all? { |v| v.is_a?(Hash) }
|
75
|
+
end
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
77
|
+
# Manifest Metadata Hashes must contain 'label' and 'value' keys
|
78
|
+
#
|
79
|
+
# @param metadata [Array<Hash>] a list of metadata with label and value as required keys for each entry
|
80
|
+
# @return [Boolean]
|
81
|
+
def valid_metadata_content?(metadata)
|
82
|
+
metadata.all? { |v| v['label'].present? && v['value'].present? }
|
83
|
+
end
|
85
84
|
end
|
86
85
|
end
|
87
86
|
end
|