-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensuring that the license and rendering properties are exposed within…
… the IIIF Manifest
- Loading branch information
1 parent
cfb0563
commit c066ba4
Showing
4 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
class ManifestBuilder | ||
class RenderingBuilder | ||
attr_reader :resource | ||
|
||
## | ||
# @param [Valhalla::Resource] resource the Resource being viewed | ||
def initialize(resource) | ||
@resource = RootNode.new(resource) | ||
end | ||
|
||
## | ||
# Append the license to the IIIF Manifest | ||
# @param [IIIF::Presentation::Manifest] manifest the IIIF manifest being | ||
# @return [IIIF::Presentation::Manifest] | ||
def apply(manifest) | ||
manifest.rendering = rendering_hash if identifier? | ||
manifest | ||
end | ||
|
||
private | ||
|
||
def identifier? | ||
resource.decorate.identifier.present? | ||
end | ||
|
||
def identifier | ||
Array.wrap(resource.decorate.identifier).first | ||
end | ||
|
||
def rendering_hash | ||
{ | ||
"@id" => "http://arks.princeton.edu/#{identifier}", | ||
"format" => "text/html" | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters