Module: ActsAsKaltura::Video::ClassMethods

Defined in:
lib/acts_as_kaltura/video.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_kaltura_video(options = { }) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/acts_as_kaltura/video.rb', line 12

def acts_as_kaltura_video(options = { })
  # Set instance accessors
  attr_accessor :video_file, :uploaded_video_token
  self._kaltura_options = options

  # Delegate kaltura attributes if :delegate option provided
  if options[:delegate].present?
    delegates_kaltura_attributes options[:delegate]
  end

  # Set validators
  validates :video_file, :presence => { :on => :create }

  # Set filters
  before_save :process_uploaded_video_file
  before_create :create_kaltura_video_entry
  before_update :update_kaltura_video_entry
  after_destroy :destroy_kaltura_video_entry
end