Skip to content
Snippets Groups Projects
Commit f8d47890 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

refactoring attachment model of learning objects

parent 496d357a
No related branches found
No related tags found
No related merge requests found
class LearningObject::Attachment
attr_accessor :bitstreams
def initialize(bitstreams)
@bitstreams = bitstreams
end
def get_retrievelink
get_bitstream_retrievelink_of "ORIGINAL"
end
def get_filename
get_bitstream_filename_of "ORIGINAL"
end
private
def get_bitstream_retrievelink_of name
values = @bitstreams.select { |v| v["bundleName"] == name }
unless values.empty?
return "#{DspaceService.link}#{values.first["retrieveLink"]}"
end
end
def get_bitstream_filename_of name
values = @bitstreams.select { |v| v["bundleName"] == name }
unless values.empty?
return values.first["name"]
end
end
include ActiveModel::Model
attr_accessor :id, :name, :link, :retrieve_link, :description, :format, :mime_type, :size
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment