class IMS::LTI::Models::ContentItems::ContentItem

Constants

TYPE

Public Class Methods

from_json(json) click to toggle source
# File lib/ims/lti/models/content_items/content_item.rb, line 19
def self.from_json(json)
  data = json.is_a?(String) ? JSON.parse(json) : json
  case data['@type']
  when 'FileItem'
    FileItem.new.from_json(data)
  when 'LtiLinkItem', 'LtiLink'
    LtiLinkItem.new.from_json(data)
  else
    ContentItem.new.from_json(data)
  end
end
new(attributes = {}) click to toggle source
Calls superclass method IMS::LTI::Models::LTIModel::new
# File lib/ims/lti/models/content_items/content_item.rb, line 14
def initialize(attributes = {})
  super(attributes)
  self.type = TYPE
end