Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
EphemeraBox generates valid JSON-LD
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Jul 10, 2017
1 parent 31bbed3 commit 8df76c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/presenters/hyrax_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def local_fields
end

def rights_object
return if solr_document.rights_statement.blank?
{
'@id': solr_document.rights_statement.first,
'@type': 'dcterms:RightsStatement',
Expand All @@ -63,6 +64,7 @@ def col_url(id)
end

def collection_objects
return if member_of_collection_ids.blank?
member_of_collection_ids.zip(collection).map { |arr| { '@id': col_url(arr.first), title: arr.last, '@type': 'pcdm:Collection' } }
end

Expand Down
10 changes: 10 additions & 0 deletions spec/presenters/ephemera_box_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@
expect(subject.member_ids).to eq [folder.id]
end
end

describe "#export_as_jsonld" do
before do
allow(subject).to receive(:id).and_return('abcd1234')
end
it "generates json" do
json = JSON.parse(subject.export_as_jsonld)
expect(json['@id']).to eq('http://plum.com/concern/ephemera_boxes/abcd1234')
end
end
end

0 comments on commit 8df76c5

Please sign in to comment.