Module: ActsAsKaltura::Annotation

Extended by:
ActiveSupport::Concern
Included in:
ActiveRecord::Base
Defined in:
lib/acts_as_kaltura/annotation.rb

Defined Under Namespace

Modules: ClassMethods Classes: KalturaAnnotationAddFailure, KalturaAnnotationUpdateFailure

Instance Method Summary collapse

Instance Method Details

#create_kaltura_annotationObject



18
19
20
21
22
23
24
25
26
# File 'lib/acts_as_kaltura/annotation.rb', line 18

def create_kaltura_annotation
  if self.cuepoint_key.nil?
    @kaltura_annotation = self.class.kaltura_client.cuepoint_service.
        add( self.as_annotation_cuepoint )
    raise KalturaAnnotationAddFailure if @kaltura_annotation.nil?

    self.cuepoint_key = @kaltura_annotation.id.to_s
  end
end

#delete_kaltura_annotationObject



36
37
38
39
40
41
# File 'lib/acts_as_kaltura/annotation.rb', line 36

def delete_kaltura_annotation
  if self.cuepoint_key.present?
    self.class.kaltura_client.cuepoint_service.delete(self.cuepoint_key)
    @kaltura_annotation = nil
  end
end

#kaltura_annotationObject



43
44
45
# File 'lib/acts_as_kaltura/annotation.rb', line 43

def kaltura_annotation
  @kaltura_annotation ||= find_kaltura_annotation
end

#kaltura_annotation=(annotation) ⇒ Object



47
48
49
# File 'lib/acts_as_kaltura/annotation.rb', line 47

def kaltura_annotation=(annotation)
  @kaltura_annotation = annotation
end

#update_kaltura_annotationObject



28
29
30
31
32
33
34
# File 'lib/acts_as_kaltura/annotation.rb', line 28

def update_kaltura_annotation
  if self.cuepoint_key.present?
    @kaltura_annotation = self.class.kaltura_client.cuepoint_service.
        update(self.cuepoint_key, self.as_annotation_cuepoint )
    raise KalturaAnnotationUpdateFailure if @kaltura_annotation.nil?
  end
end