Class: MeducationSDK::MediaFile

Inherits:
Resource
  • Object
show all
Defined in:
lib/meducation_sdk/resources/media_file.rb

Direct Known Subclasses

MediaFileMock

Defined Under Namespace

Modules: State

Constant Summary

Constants included from Helpers

Helpers::SDK_TO_SPI_MAPPINGS

Instance Method Summary collapse

Methods inherited from Resource

#created_at, spi_type=, #updated_at

Methods included from Helpers

#sdk_class_for, #sdk_type_for, #spi_type_for

Instance Method Details

#commentsObject



9
10
11
# File 'lib/meducation_sdk/resources/media_file.rb', line 9

def comments
  @comments ||= Comment.where(item_id: id, item_type: "MediaFile")
end

#indexable_contentObject



13
14
15
16
17
18
# File 'lib/meducation_sdk/resources/media_file.rb', line 13

def indexable_content
  @indexable_content ||= begin
    object = IndexableContent.where(item_id: id, item_type: "MediaFile").first
    object ? object.content : ''
 end
end

#userObject



5
6
7
# File 'lib/meducation_sdk/resources/media_file.rb', line 5

def user
  @user ||= User.find(user_id)
end