Skip to content

Commit

Permalink
Refactors the processing of the returned coordinate url. (#2303)
Browse files Browse the repository at this point in the history
* Refactors the processing of the returned coordinate url.

* fixes syntax error.
  • Loading branch information
bwatson78 authored Jan 9, 2025
1 parent 7f29329 commit 9180bd2
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,28 @@ def fetch_and_parse_coords
end

def emory_iiif_id_url
"http://#{ENV['HOSTNAME'] || 'localhost:3000'}/iiif/#{parent_document[:id]}/manifest"
"#{manifest_base_uri}/iiif/#{parent_document[:id]}/manifest"
end

def manifest_base_uri
pulled_uri = parsed_uri
pulled_uri.to_s[/\A.*(?=#{pulled_uri.path}\z)/]
end

def presenter
Hyrax::CurateGenericWorkPresenter.new(parent_document, ManifestAbility.new)
end

def manifest
@manifest ||= ManifestBuilderService.build_manifest(presenter: presenter, curation_concern: CurateGenericWork.find(parent_document[:id]))
end

def parsed_manifest
JSON.parse(manifest)
end

def parsed_uri
URI.parse(parsed_manifest['sequences'][0]['canvases'][0]['@id'])
end
end
end

0 comments on commit 9180bd2

Please sign in to comment.