Skip to content

Commit

Permalink
use APP_CONFIG record prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
lsat12357 committed Apr 1, 2016
1 parent c75d59e commit 001944d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/app.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pyramidal_tiff_path:
oai:
repository_name: "Oregon Digital OAI Repository"
repository_url: "http://oregondigital.org/oai"
record_prefix: ""
record_prefix: "oai:oregondigital.org"
admin_email: "admin@oregondigital.org"
sample_id: "oregondigital:h989r3203"

Expand Down
6 changes: 4 additions & 2 deletions lib/oregon_digital/oai/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class OregonDigital::OAI::Provider < ::OAI::Provider::Base

OAI::Provider::Response::RecordResponse.class_eval do
def identifier_for(record)
setid = ""
if !record.descMetadata.primarySet.empty?
setid = record.descMetadata.primarySet.first.id.gsub("oregondigital:","")
else setid = record.descMetadata.set.first.id.gsub("oregondigital:","")
elsif !record.descMetadata.set.empty?
setid = record.descMetadata.set.first.id.gsub("oregondigital:","")
end
"#{Base.prefix}:#{setid}/#{record.id.gsub('oregondigital:','')}"
"#{APP_CONFIG['oai']['record_prefix']}:#{setid}/#{record.id.gsub('oregondigital:','')}"
end
end

Expand Down
3 changes: 1 addition & 2 deletions spec/features/oai_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@
#expect(page).to have_content("oai:oregondigital.org:myset/" + asset.pid.gsub("oregondigital:",""))
end
it "should have the primarySet in the header identifier" do
binding.pry
id = asset.pid.gsub("oregondigital:","")
prefix = APP_CONFIG["oai"]["record_prefix"]
expect(page).to have_xpath('//identifier[@value="#{prefix}:myset/#{id}"]')
expect(page).to have_selector('header/identifier',text: "#{prefix}:myset/#{id}")
end
#note that can't look for dc:lcsubject because nokogiri doesn't recognize the namespace
it "should use the mapped_field if there is one" do
Expand Down

0 comments on commit 001944d

Please sign in to comment.