Skip to content
Snippets Groups Projects
Commit 1e092d52 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Update schema of LearningObject

parent 60acbffc
No related branches found
No related tags found
No related merge requests found
class LearningObject
include ActiveModel::Model
attr_accessor :id, :id_dspace, :title, :description, :date_creation,
:thumbnail, :metadata
attr_accessor :id,
:name, :description, :thumbnail, :date_creation, :last_modified,
:id_dspace, :type, :bitstreams, :metadata
attr_accessor :likes, :views
def initialize args
@id = args[:id]
@name = args[:name] || ''
@description = args[:description] || ''
@thumbnail = args[:thumbnail] || ''
@date_creation = args[:date_creation] || ''
@id_dspace = args[:id_dspace] || ''
@type = args[:type] || ''
@bitstreams = args[:bitstreams] || []
@metadata = args[:metadata] || []
@last_modified = args[:last_modified] || ''
end
def subjects
@subjects ||= learning_object_repository.get_subjects(self)
end
def get_metadata_value_of key
values = @metadata.select { |v| v["key"] == key }
unless values.empty?
return values.first["value"]
end
end
private
def learning_object_repository
......
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