Skip to content

Commit

Permalink
Merge pull request #11 from performant-software/feature/cdc114_iiif_m…
Browse files Browse the repository at this point in the history
…anifests

CDC #114 - IIIF Manifests
  • Loading branch information
dleadbetter authored Feb 26, 2024
2 parents b4f9069 + d576e93 commit 2794131
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/services/triple_eye_effable/presentation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'httparty'

module TripleEyeEffable
class Presentation
include HTTParty

def initialize(api_key: nil, api_url: nil, project_id: nil)
@api_key = api_key || TripleEyeEffable.config.api_key
@api_url = api_url || TripleEyeEffable.config.url
@project_id = project_id || TripleEyeEffable.config.project_id
end

def create_collection(id:, label:, items:)
body = { id: id, label: label, items: items }
self.class.post("#{base_url}/collection", headers: headers, body: body)
end

def create_manifest(id:, label:, resource_ids:)
body = { id: id, label: label, resource_ids: resource_ids }
self.class.post("#{base_url}/manifest", headers: headers, body: body)
end

private

def base_url
"#{@api_url}/public/presentation"
end

def headers
{ 'X-API-KEY' => @api_key }
end
end
end

0 comments on commit 2794131

Please sign in to comment.