iiif_manifest 0.4.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +51 -0
- data/.coveralls.yml +1 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.rubocop.yml +15 -5
- data/.rubocop_todo.yml +44 -51
- data/CHANGELOG.md +118 -0
- data/CODE_OF_CONDUCT.md +36 -49
- data/CODE_OF_CONDUCT.old.md +49 -0
- data/CONTRIBUTING.md +161 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +76 -18
- data/Rakefile +0 -0
- data/SUPPORT.md +5 -0
- data/iiif_manifest.gemspec +6 -6
- 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 +0 -0
- data/lib/iiif_manifest/manifest_builder/canvas_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/canvas_builder_factory.rb +0 -0
- 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 +3 -3
- data/lib/iiif_manifest/manifest_builder/iiif_service.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/image_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/image_service_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/record_property_builder.rb +15 -16
- data/lib/iiif_manifest/manifest_builder/resource_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/sequence_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_builder/structure_builder.rb +0 -0
- data/lib/iiif_manifest/manifest_factory.rb +0 -0
- data/lib/iiif_manifest/manifest_service_locator.rb +2 -2
- data/lib/iiif_manifest/v3.rb +13 -0
- data/lib/iiif_manifest/v3/display_content.rb +20 -0
- data/lib/iiif_manifest/v3/manifest_builder.rb +61 -0
- data/lib/iiif_manifest/v3/manifest_builder/body_builder.rb +61 -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 +239 -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 +100 -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 +47 -29
- data/.travis.yml +0 -4
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
We want your help to make the Samvera community great. There are a few guidelines
|
4
|
+
that we need contributors to follow so that we can have a chance of
|
5
|
+
keeping on top of things.
|
6
|
+
|
7
|
+
## Code of Conduct
|
8
|
+
|
9
|
+
The Samvera Community is dedicated to providing a welcoming and positive
|
10
|
+
experience for all its members, whether they are at a formal gathering, in
|
11
|
+
a social setting, or taking part in activities online. Please see our
|
12
|
+
[Code of Conduct](CODE_OF_CONDUCT.md) for more information.
|
13
|
+
|
14
|
+
## Samvera Community Intellectual Property Licensing and Ownership
|
15
|
+
|
16
|
+
All code contributors must have an Individual Contributor License Agreement
|
17
|
+
(iCLA) on file with the Samvera Steering Group. If the contributor works for
|
18
|
+
an institution, the institution must have a Corporate Contributor License
|
19
|
+
Agreement (cCLA) on file.
|
20
|
+
|
21
|
+
https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
|
22
|
+
|
23
|
+
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
24
|
+
|
25
|
+
## Contribution Tasks
|
26
|
+
|
27
|
+
* Reporting Issues
|
28
|
+
* Making Changes
|
29
|
+
* Documenting Code
|
30
|
+
* Committing Changes
|
31
|
+
* Submitting Changes
|
32
|
+
* Reviewing and Merging Changes
|
33
|
+
|
34
|
+
### Reporting Issues
|
35
|
+
|
36
|
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
37
|
+
* Submit a [Github issue](https://github.com/samvera/iiif_manifest/issues/) by:
|
38
|
+
* Clearly describing the issue
|
39
|
+
* Provide a descriptive summary
|
40
|
+
* Explain the expected behavior
|
41
|
+
* Explain the actual behavior
|
42
|
+
* Provide steps to reproduce the actual behavior
|
43
|
+
|
44
|
+
### Making Changes
|
45
|
+
|
46
|
+
* Fork the repository on GitHub
|
47
|
+
* Create a topic branch from where you want to base your work.
|
48
|
+
* This is usually the master branch.
|
49
|
+
* To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
|
50
|
+
* Then checkout the new branch with `git checkout fix/master/my_contribution`.
|
51
|
+
* Please avoid working directly on the `master` branch.
|
52
|
+
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
53
|
+
* Make sure you have added sufficient tests and documentation for your changes.
|
54
|
+
* Test functionality with RSpec; Test features / UI with Capybara.
|
55
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
56
|
+
|
57
|
+
### Documenting Code
|
58
|
+
|
59
|
+
* All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
|
60
|
+
* Documentation should seek to answer the question "why does this code exist?"
|
61
|
+
* Document private / protected methods as desired.
|
62
|
+
* If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
|
63
|
+
* If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
|
64
|
+
* This work greatly increases the usability of the code base and supports the on-ramping of new committers.
|
65
|
+
* We will all be understanding of one another's time constraints in this area.
|
66
|
+
* [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
67
|
+
|
68
|
+
### Committing changes
|
69
|
+
|
70
|
+
* Make commits of logical units.
|
71
|
+
* Check for unnecessary whitespace with `git diff --check` before committing.
|
72
|
+
* Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
73
|
+
* If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
|
74
|
+
|
75
|
+
```
|
76
|
+
Present tense short summary (50 characters or less)
|
77
|
+
|
78
|
+
More detailed description, if necessary. It should be wrapped to 72
|
79
|
+
characters. Try to be as descriptive as you can, even if you think that
|
80
|
+
the commit content is obvious, it may not be obvious to others. You
|
81
|
+
should add such description also if it's already present in bug tracker,
|
82
|
+
it should not be necessary to visit a webpage to check the history.
|
83
|
+
|
84
|
+
Include Closes #<issue-number> when relavent.
|
85
|
+
|
86
|
+
Description can have multiple paragraphs and you can use code examples
|
87
|
+
inside, just indent it with 4 spaces:
|
88
|
+
|
89
|
+
class PostsController
|
90
|
+
def index
|
91
|
+
respond_to do |wants|
|
92
|
+
wants.html { render 'index' }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
You can also add bullet points:
|
98
|
+
|
99
|
+
- you can use dashes or asterisks
|
100
|
+
|
101
|
+
- also, try to indent next line of a point for readability, if it's too
|
102
|
+
long to fit in 72 characters
|
103
|
+
```
|
104
|
+
|
105
|
+
* Make sure you have added the necessary tests for your changes.
|
106
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
107
|
+
* When you are ready to submit a pull request
|
108
|
+
|
109
|
+
### Submitting Changes
|
110
|
+
|
111
|
+
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
112
|
+
* Make sure your branch is up to date with its parent branch (i.e. master)
|
113
|
+
* `git checkout master`
|
114
|
+
* `git pull --rebase`
|
115
|
+
* `git checkout <your-branch>`
|
116
|
+
* `git rebase master`
|
117
|
+
* It is a good idea to run your tests again.
|
118
|
+
* If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
|
119
|
+
* [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
|
120
|
+
* `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
|
121
|
+
* Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
|
122
|
+
* Push your changes to a topic branch in your fork of the repository.
|
123
|
+
* Submit a pull request from your fork to the project.
|
124
|
+
|
125
|
+
### Reviewing and Merging Changes
|
126
|
+
|
127
|
+
We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
|
128
|
+
Common checks that may occur in our repositories:
|
129
|
+
|
130
|
+
1. Travis CI - where our automated tests are running
|
131
|
+
2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
132
|
+
|
133
|
+
If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
|
134
|
+
|
135
|
+
*Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
|
136
|
+
|
137
|
+
#### Things to Consider When Reviewing
|
138
|
+
|
139
|
+
First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
|
140
|
+
|
141
|
+
* Ask clarifying questions
|
142
|
+
* State your understanding and expectations
|
143
|
+
* Provide example code or alternate solutions, and explain why
|
144
|
+
|
145
|
+
This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
|
146
|
+
|
147
|
+
* Does the commit message explain what is going on?
|
148
|
+
* Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
|
149
|
+
* Do new or changed methods, modules, and classes have documentation?
|
150
|
+
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
151
|
+
* Does the description of the new/changed specs match your understanding of what the spec is doing?
|
152
|
+
* Did the Travis tests complete successfully?
|
153
|
+
|
154
|
+
If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
|
155
|
+
|
156
|
+
# Additional Resources
|
157
|
+
|
158
|
+
* [General GitHub documentation](http://help.github.com/)
|
159
|
+
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
|
160
|
+
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
161
|
+
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,29 +1,42 @@
|
|
1
1
|
# IIIFManifest
|
2
|
-
[![Build Status](https://travis-ci.org/projecthydra-labs/iiif_manifest.svg?branch=master)](https://travis-ci.org/projecthydra-labs/iiif_manifest)
|
3
2
|
|
4
|
-
|
3
|
+
Code: [![CircleCI](https://circleci.com/gh/samvera/iiif_manifest.svg?style=svg)](https://circleci.com/gh/samvera/iiif_manifest) [![Coverage Status](https://coveralls.io/repos/github/samvera/iiif_manifest/badge.svg)](https://coveralls.io/github/samvera/iiif_manifest)
|
5
4
|
|
6
|
-
|
5
|
+
Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md) [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
7
6
|
|
8
|
-
|
7
|
+
Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
|
9
8
|
|
10
|
-
|
9
|
+
# What is IIIFManifest
|
11
10
|
|
12
|
-
|
11
|
+
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/>
|
13
12
|
|
14
|
-
|
13
|
+
## Product Owner & Maintenance
|
15
14
|
|
16
|
-
|
15
|
+
`iiif_manifest` is a Core Component of the Samvera community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
17
16
|
|
18
|
-
|
17
|
+
### Product Owner
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
[awead](https://github.com/awead)
|
20
|
+
|
21
|
+
# Usage
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
Additionally, it **_must_** have a `#description` method that returns a string.
|
26
|
+
|
27
|
+
Additionally it **_should_** implement `#manifest_url` that shows where the manifest can be found.
|
28
|
+
|
29
|
+
Additionally it **_should_** implement `#manifest_metadata` to provide an array containing hashes of metadata Label/Value pairs.
|
30
|
+
|
31
|
+
Additionally it **_may_** implement `#search_service` to contain the url for a IIIF search api compliant search endpoint and `#autocomplete_service` to contain the url for a 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 implemented a IIIF search service at the endpoint specified in the manifest.
|
32
|
+
|
33
|
+
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" }`).
|
34
|
+
|
35
|
+
Finally, it **_may_** implement `ranges`, which returns an array of objects which represent a table of contents or similar structure, each of which responds to `label`, `ranges`, and `file_set_presenters`.
|
23
36
|
|
24
37
|
For example:
|
25
38
|
|
26
|
-
|
39
|
+
```ruby
|
27
40
|
class Book
|
28
41
|
def initialize(id, pages = [])
|
29
42
|
@id = id
|
@@ -45,18 +58,18 @@ For example:
|
|
45
58
|
def description
|
46
59
|
'a brief description'
|
47
60
|
end
|
48
|
-
|
61
|
+
|
49
62
|
def manifest_metadata
|
50
63
|
[
|
51
64
|
{ "label" => "Title", "value" => "Title of the Item" },
|
52
65
|
{ "label" => "Creator", "value" => "Morrissey, Stephen Patrick" }
|
53
66
|
]
|
54
67
|
end
|
55
|
-
|
68
|
+
|
56
69
|
def search_service
|
57
70
|
"http://test.host/books/#{@id}/search"
|
58
71
|
end
|
59
|
-
|
72
|
+
|
60
73
|
def autocomplete_service
|
61
74
|
"http://test.host/books/#{@id}/autocomplete"
|
62
75
|
end
|
@@ -127,7 +140,28 @@ Then you can produce the manifest on the book object like this:
|
|
127
140
|
IIIFManifest::ManifestFactory.new(book).to_h.to_json
|
128
141
|
```
|
129
142
|
|
130
|
-
##
|
143
|
+
## Presentation 3.0 (Alpha)
|
144
|
+
|
145
|
+
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.
|
146
|
+
|
147
|
+
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 manifests can now be built using `IIIFManifest::V3::ManifestFactory`.
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
book = Book.new('book-77',[Page.new('page-99')])
|
151
|
+
IIIFManifest::V3::ManifestFactory.new(book).to_h.to_json
|
152
|
+
```
|
153
|
+
|
154
|
+
### Notable changes for Presentation 3.0
|
155
|
+
|
156
|
+
- 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>)
|
157
|
+
- 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>)
|
158
|
+
- Presenters **_may_** implement `#homepage` to contain a hash for linking back to a repository webpage for this manifest. The hash must contain "id", "format" (mime type), "type", and "label" (eg. `{ "id" => "repository url", "format" => "text/html", "type" => "Text", "label" => { "en": ["View in repository"] }`).
|
159
|
+
- File set presenters may target a fragment of its content by providing `#media_fragment` which will be appended to its `id`.
|
160
|
+
- 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.
|
161
|
+
- 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.
|
162
|
+
- DisplayContent may provide `#auth_service` which should return a hash containing a IIIF Authentication service definition (<https://iiif.io/api/auth/1.0/>) that will be included on the content resource.
|
163
|
+
|
164
|
+
# Development
|
131
165
|
|
132
166
|
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.
|
133
167
|
|
@@ -135,5 +169,29 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
135
169
|
|
136
170
|
## Contributing
|
137
171
|
|
138
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
172
|
+
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.
|
173
|
+
|
174
|
+
## Releasing
|
175
|
+
|
176
|
+
1. `bundle install`
|
177
|
+
2. Increase the version number in `lib/iiif_manifest/version.rb`
|
178
|
+
3. Increase the same version number in `.github_changelog_generator`
|
179
|
+
4. Update `CHANGELOG.md` by running this command:
|
180
|
+
|
181
|
+
```
|
182
|
+
github_changelog_generator --user samvera --project iiif_manifest --token YOUR_GITHUB_TOKEN_HERE
|
183
|
+
```
|
184
|
+
|
185
|
+
5. Commit these changes to the master branch
|
186
|
+
|
187
|
+
6. Run `rake release`
|
188
|
+
|
189
|
+
## Help
|
190
|
+
|
191
|
+
The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
|
192
|
+
|
193
|
+
# Acknowledgments
|
194
|
+
|
195
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).
|
139
196
|
|
197
|
+
![Samvera Logo](https://wiki.duraspace.org/download/thumbnails/87459292/samvera-fall-font2-200w.png?version=1&modificationDate=1498550535816&api=v2)
|
data/Rakefile
CHANGED
File without changes
|
data/SUPPORT.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
If you would like to report an issue, first search [the list of issues](https://github.com/samvera/iiif_manifest/issues/) to see if someone else has already reported it, and then feel free to [create a new issue](https://github.com/samvera/iiif_manifest/issues/new).
|
2
|
+
|
3
|
+
If you have questions or need help, please email [the Samvera community tech list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev channel in [the Samvera community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
|
4
|
+
|
5
|
+
You can learn more about the various Samvera communication channels on the [Get in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391) wiki page.
|
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
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Generate IIIF presentation manifests for Hydra::Works'
|
12
12
|
spec.description = '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/'
|
13
|
-
spec.homepage = '
|
13
|
+
spec.homepage = 'https://github.com/samvera/iiif_manifest'
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
16
|
spec.bindir = 'exe'
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_dependency 'activesupport', '>= 4'
|
21
21
|
|
22
|
-
spec.add_development_dependency '
|
22
|
+
spec.add_development_dependency 'bixby', '~> 3.0'
|
23
|
+
spec.add_development_dependency 'coveralls'
|
23
24
|
spec.add_development_dependency 'pry-byebug'
|
24
|
-
spec.add_development_dependency 'rake', '
|
25
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
25
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency 'rubocop-rspec'
|
27
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
28
28
|
end
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,9 +3,9 @@ module IIIFManifest
|
|
3
3
|
class DeepCanvasBuilderFactory < CanvasBuilderFactory
|
4
4
|
private
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def file_set_presenters(work)
|
7
|
+
DeepFileSetEnumerator.new(work).to_a
|
8
|
+
end
|
9
9
|
end
|
10
10
|
|
11
11
|
class DeepFileSetEnumerator
|
File without changes
|
File without changes
|
File without changes
|
@@ -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
|
@@ -47,10 +46,10 @@ module IIIFManifest
|
|
47
46
|
@iiif_autocomplete_service ||= iiif_autocomplete_service_factory.new
|
48
47
|
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
# Build services. Currently supported:
|
50
|
+
# search_service, with (optional) embedded autocomplete service
|
51
|
+
#
|
52
|
+
# @return [Array] array of services
|
54
53
|
def services
|
55
54
|
iiif_search_service.search_service = search_service
|
56
55
|
iiif_autocomplete_service.autocomplete_service = autocomplete_service
|
@@ -58,27 +57,27 @@ module IIIFManifest
|
|
58
57
|
[iiif_search_service]
|
59
58
|
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
# Validate manifest_metadata against the IIIF spec format for metadata
|
61
|
+
#
|
62
|
+
# @return [Boolean]
|
64
63
|
def valid_metadata?
|
65
64
|
return false unless record.respond_to?(:manifest_metadata)
|
66
65
|
metadata = record.manifest_metadata
|
67
66
|
valid_metadata_structure?(metadata) && valid_metadata_content?(metadata)
|
68
67
|
end
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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]
|
74
73
|
def valid_metadata_structure?(metadata)
|
75
74
|
metadata.is_a?(Array) && metadata.all? { |v| v.is_a?(Hash) }
|
76
75
|
end
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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]
|
82
81
|
def valid_metadata_content?(metadata)
|
83
82
|
metadata.all? { |v| v['label'].present? && v['value'].present? }
|
84
83
|
end
|