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

creating attachment builder

parent f8d47890
No related branches found
No related tags found
No related merge requests found
module LearningObject
class AttachmentBuilder < ::Builder
##disable method
# build attachments with id's is out of scope.
def self.build(objects = [])
raise NotImplementedError, 'LearningObject::AttachmentBuilder#build is out of scope.'
end
def self.build_from_orientdb(args = {})
build_from_cache args do
::LearningObject::Attachment.new(args)
end
end
private
def self.build_from_cache(args={})
object = nil
unless args.nil? || !block_given?
# cache object when build
object = Rails.cache.fetch(cache_key(args['id'], args['link']), expires_in: 12.hours) { yield }
end
object
end
end
end
\ No newline at end of file
class LearningObject::Attachment
include ActiveModel::Model
#this attributes mirror Dspace bitstream values
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