Module: ActsAsKaltura::Category

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#kaltura_categoryObject



31
32
33
34
35
36
37
38
# File 'lib/acts_as_kaltura/category.rb', line 31

def kaltura_category
  if @kaltura_category.nil? && self.kaltura_category_key.present?
    @kaltura_category = self.class.kaltura_client.
        category_service.get(self.kaltura_category_key)
  end

  @kaltura_category
end

#kaltura_parent_categoriesObject



25
26
27
28
29
# File 'lib/acts_as_kaltura/category.rb', line 25

def kaltura_parent_categories
  filter = Kaltura::Filter::CategoryFilter.new
  filter.parent_id_equal = 0
  local_or_global_kaltura_client.category_service.list(filter)
end

#kaltura_reference_found?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/acts_as_kaltura/category.rb', line 52

def kaltura_reference_found?
  self.parent && self.parent.kaltura_category_key.present?
end

#kaltura_siblingsObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/acts_as_kaltura/category.rb', line 40

def kaltura_siblings
  filter = Kaltura::Filter::CategoryFilter.new

  if self.parent && self.parent.kaltura_category_key
    filter.parent_id_equal = self.parent.kaltura_category_key
  else
    filter.parent_id_equal = 0
  end

  self.class.kaltura_client.category_service.list(filter)
end