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

Commit

Permalink
Merge pull request #409 from sul-dlss/deprecate_get_preserved_file
Browse files Browse the repository at this point in the history
Add deprecation warning to get_preserved_file
  • Loading branch information
jcoyne committed Dec 4, 2018
2 parents d2f32ae + 5ad525c commit bdeb8bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/dor/models/concerns/contentable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def replace_file(file, file_name)
def get_preserved_file(file, version)
Sdr::Client.get_preserved_file_content(pid, file, version)
end
deprecation_deprecate get_preserved_file: 'use dor-services-app/v1/sdr/objects/:druid/content/:filename instead'

def get_file(file)
druid_tools = DruidTools::Druid.new(pid, Config.content.content_base_dir)
Expand Down
2 changes: 2 additions & 0 deletions spec/models/concerns/contentable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ def internal_uri
let(:preserved_file_content) { 'expected content' }
it 'should get the file content' do
expect(Sdr::Client).to receive(:get_preserved_file_content).with(@item.id, filename, item_version).and_return(preserved_file_content)
expect(Deprecation).to receive(:warn)
returned_content = @item.get_preserved_file(filename, item_version)
expect(returned_content).to eq(preserved_file_content)
end
end

describe 'get_file' do
it 'should fetch the file' do
data_file = File.new(File.join(fixture_dir, 'ab123cd4567_descMetadata.xml'))
Expand Down

0 comments on commit bdeb8bc

Please sign in to comment.