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

Commit

Permalink
Point urls in ARK metadata on geo objects to their records in Pulmap
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Sep 14, 2017
1 parent c55b3a8 commit 0075ec1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/services/complete_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def title
end

def url
if record.try(:source_metadata_identifier).blank?
if GeoWorksService.new(record).geo_work?
noid = identifier.gsub(%r(ark:/\d{5}/), '')
return "https://maps.princeton.edu/catalog/princeton-#{noid}"
elsif record.try(:source_metadata_identifier).blank?
return ManifestBuilder::ManifestHelper.new.polymorphic_url(record)
elsif RemoteRecord.bibdata?(record.source_metadata_identifier.first)
return "https://pulsearch.princeton.edu/catalog/#{record.source_metadata_identifier.first}#view"
Expand Down
11 changes: 10 additions & 1 deletion spec/services/complete_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe CompleteRecord do
subject { described_class.new(obj) }
let(:ark) { 'ark:88435/x1234567' }
let(:ark) { 'ark:/88435/x1234567' }
let(:minter) { double('Ezid::Identifier') }
let(:base_metadata) {{
dc_publisher: 'Princeton University Library',
Expand Down Expand Up @@ -44,5 +44,14 @@
subject.complete
end
end

context "with a bibdata source_metadata_identifier" do
let(:metadata) { base_metadata.merge(target: "https://maps.princeton.edu/catalog/princeton-x1234567") }
let(:obj) { FactoryGirl.create :vector_work, identifier: [ark], source_metadata_identifier: nil }
it "links to Pulmap" do
expect(minter).to receive(:modify).with(ark, metadata)
subject.complete
end
end
end
end

0 comments on commit 0075ec1

Please sign in to comment.