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



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

def create_kaltura_annotation
  if self.cuepoint_key.nil?
    @kaltura_annotation = local_or_global_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



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

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

#kaltura_annotationObject



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

def kaltura_annotation
  @kaltura_annotation ||= find_kaltura_annotation
end

#kaltura_annotation=(annotation) ⇒ Object



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

def kaltura_annotation=(annotation)
  @kaltura_annotation = annotation
end

#update_kaltura_annotationObject



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

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