Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused methods that were previously identified for removal #1772

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions app/models/embed/purl/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def previewable?
preview_types.include?(mimetype)
end

# unused (9/2016) - candidate for removal?
def image?
mimetype =~ %r{image/jp2}i
end
Expand All @@ -80,26 +79,11 @@ def size
@file.attributes['size'].try(:value).to_i
end

# unused (9/2016) - candidate for removal?
def height
@file.xpath('./*/@height').first.try(:text) if @file.xpath('./*/@height').present?
end

# unused (9/2016) - candidate for removal?
def width
@file.xpath('./*/@width').first.try(:text) if @file.xpath('./*/@width').present?
end

def duration
md = Embed::MediaDuration.new(@file.xpath('./*[@duration]').first) if @file.xpath('./*/@duration').present?
md&.to_s
end

# unused (9/2016) - candidate for removal?
def location
@file.xpath('./location[@type="url"]').first.try(:text) if @file.xpath('./location[@type="url"]').present?
end

def stanford_only?
value, _rule = @rights.stanford_only_rights_for_file(title)

Expand Down
34 changes: 0 additions & 34 deletions spec/models/embed/purl/resource_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,6 @@
end
end

describe 'image data' do
before { stub_purl_xml_response_with_fixture(image_purl_xml) }

let(:image) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the image height and width for image objects' do
expect(image.height).to eq '6123'
expect(image.width).to eq '5321'
end
end

describe 'file data' do
before { stub_purl_xml_response_with_fixture(file_purl_xml) }

let(:file) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the location data when available' do
expect(file.location).to eq 'http://stacks.stanford.edu/file/druid:abc123/Title_of_the_PDF.pdf'
end
end

describe 'duration' do
it 'gets duration string from videoData' do
f = double('File')
Expand Down Expand Up @@ -266,19 +245,6 @@
end
end

describe 'video_data' do
context 'with valid videoData' do
before { stub_purl_xml_response_with_fixture(multi_media_purl) }

let(:video) { Embed::Purl.new('12345').contents.first.files.first }

it 'gets the height and width for the video object' do
expect(video.height).to eq '288'
expect(video.width).to eq '352'
end
end
end

describe '#vtt?' do
subject { file.vtt? }

Expand Down