iiif_manifest 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3cba606c659d4ff84c0709b6332ba67cdf938015
4
- data.tar.gz: a140e32c9319b5747210da28634becb8213f35d3
2
+ SHA256:
3
+ metadata.gz: cfc7099813836fb900812b98e9c32b2946479b399beb603689bde033fbaae84e
4
+ data.tar.gz: bf71a041c8452f34c2c2e8acfbf6e88f74185574fde224134fa8c0e5f644b43c
5
5
  SHA512:
6
- metadata.gz: 0fbbff5fca777d6e14bda44fe3d46df558234b872a87e62d4136f011c4a1909a4659966dc1ddd6b2e2769de6cdb10898a10c13b832b39efe926c6d4f1ee9739b
7
- data.tar.gz: 48db3a55ee7899108d8c89a5a126046f0b92bc1b91fa983a3f47e0bd6a0db2dc32af8a56b7b0143c003481b69dcb348aaa336ef63936699fdfd9730a2d594d48
6
+ metadata.gz: 474f3b2a9a348067e83c7e1b63096be5aaafdb3d8c99a9e4c1c8ac7d442a6b6f2a12407c9897390d8c99cb13ed05a4fd0001a448c5274b3f0cb2a59f5702b265
7
+ data.tar.gz: 914f36916f395785a3f002a864aed38de35341684463b6a71154efc68bee1dcd0b9334cbe186f1756caa00ed3e8afcd01b45a823c7a17ec3f614932e5d905e21
data/README.md CHANGED
@@ -13,11 +13,11 @@ Additionally it ***should*** implement `#manifest_url` that shows where the mani
13
13
 
14
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 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.
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
 
20
- Finally, It ***may*** implement `ranges`, which returns an array of objects which
20
+ Finally, it ***may*** implement `ranges`, which returns an array of objects which
21
21
  represent a table of contents or similar structure, each of which responds to
22
22
  `label`, `ranges`, and `file_set_presenters`.
23
23
 
@@ -131,7 +131,7 @@ Then you can produce the manifest on the book object like this:
131
131
 
132
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
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`.
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 manifests can now be built using `IIIFManifest::V3::ManifestFactory`.
135
135
 
136
136
  ```ruby
137
137
  book = Book.new('book-77',[Page.new('page-99')])
@@ -141,9 +141,11 @@ The presentation 3.0 support has been contained to the `V3` namespace. Version
141
141
  ### Notable changes for Presentation 3.0
142
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
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
+ - 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"] }`).
144
145
  - File set presenters may target a fragment of its content by providing `#media_fragment` which will be appended to its `id`.
145
146
  - 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
147
  - 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.
148
+ - 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.
147
149
 
148
150
  ## Development
149
151
 
@@ -1,8 +1,10 @@
1
1
  module IIIFManifest
2
2
  module V3
3
3
  class DisplayContent
4
- attr_reader :url, :width, :height, :duration, :iiif_endpoint, :format, :type, :label
5
- def initialize(url, type:, width: nil, height: nil, duration: nil, label: nil, format: nil, iiif_endpoint: nil)
4
+ attr_reader :url, :width, :height, :duration, :iiif_endpoint, :format, :type,
5
+ :label, :auth_service
6
+ def initialize(url, type:, width: nil, height: nil, duration: nil, label: nil,
7
+ format: nil, iiif_endpoint: nil, auth_service: nil)
6
8
  @url = url
7
9
  @type = type
8
10
  @width = width
@@ -11,6 +13,7 @@ module IIIFManifest
11
13
  @label = label
12
14
  @format = format
13
15
  @iiif_endpoint = iiif_endpoint
16
+ @auth_service = auth_service
14
17
  end
15
18
  end
16
19
  end
@@ -12,6 +12,7 @@ module IIIFManifest
12
12
  def apply(annotation)
13
13
  build_body
14
14
  image_service_builder.apply(body) if iiif_endpoint
15
+ apply_auth_service if auth_service
15
16
  annotation.body = body
16
17
  end
17
18
 
@@ -42,6 +43,18 @@ module IIIFManifest
42
43
  def image_service_builder
43
44
  image_service_builder_factory.new(iiif_endpoint)
44
45
  end
46
+
47
+ def auth_service
48
+ display_content.try(:auth_service)
49
+ end
50
+
51
+ def apply_auth_service
52
+ body.service = if body['service'].blank?
53
+ [auth_service]
54
+ else
55
+ body['service'] + [auth_service]
56
+ end
57
+ end
45
58
  end
46
59
  end
47
60
  end
@@ -30,7 +30,7 @@ module IIIFManifest
30
30
 
31
31
  def path
32
32
  path = "#{parent.manifest_url}/canvas/#{record.id}"
33
- path << "##{record.media_fragment}" if record.respond_to?(:media_fragment)
33
+ path << "##{record.media_fragment}" if record.respond_to?(:media_fragment) && record.media_fragment.present?
34
34
  path
35
35
  end
36
36
 
@@ -68,6 +68,10 @@ module IIIFManifest
68
68
  inner_hash['rights'] = rights
69
69
  end
70
70
 
71
+ def homepage=(homepage)
72
+ inner_hash['homepage'] = homepage
73
+ end
74
+
71
75
  def initial_attributes
72
76
  {
73
77
  '@context' => [
@@ -41,6 +41,7 @@ module IIIFManifest
41
41
  canvas_builder_factory.from(record)
42
42
  end
43
43
 
44
+ # rubocop:disable Metrics/CyclomaticComplexity
44
45
  def setup_manifest_from_record(manifest, record)
45
46
  manifest['id'] = record.manifest_url.to_s
46
47
  manifest.label = ManifestBuilder.language_map(record.to_s) if record.to_s.present?
@@ -50,7 +51,9 @@ module IIIFManifest
50
51
  manifest.viewing_direction = viewing_direction if viewing_direction.present?
51
52
  manifest.service = services if search_service.present?
52
53
  manifest.rendering = populate_rendering
54
+ manifest.homepage = record.homepage if record.try(:homepage).present?
53
55
  end
56
+ # rubocop:enable Metrics/CyclomaticComplexity
54
57
 
55
58
  def metadata_from_record(record)
56
59
  if valid_v3_metadata?
@@ -1,3 +1,3 @@
1
1
  module IIIFManifest
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.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: 0.5.0
4
+ version: 0.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: 2018-10-01 00:00:00.000000000 Z
12
+ date: 2019-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -197,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.6.14
200
+ rubygems_version: 3.0.3
202
201
  signing_key:
203
202
  specification_version: 4
204
203
  summary: Generate IIIF presentation manifests for Hydra::Works