Sha256: 05e50ac613b32b88e3e8602130edba1bc5d12b144b02aefc9ee9c3e40d3bfb0e

Contents?: true

Size: 793 Bytes

Versions: 3

Compression:

Stored size: 793 Bytes

Contents

require 'kaltura'

module KalturaBox
  module Category
    module InstanceMethods

      def edit(options={})
        client = KalturaBox::Client.update_session
        category_svc = Kaltura::KalturaCategoryService.new(client)

        category = Kaltura::KalturaCategory.new
        category.name = options[:name]
        category.description = options[:description]

        if category = category_svc.update(self.ref_id, category)
          self.update(name: category.name, description: category.description)
        end
      end

      def remove
        client = KalturaBox::Client.update_session
        category_svc = Kaltura::KalturaCategoryService.new(client)

        result = category_svc.delete(self.ref_id) # should returns nil
        self.destroy
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaltura_box-0.0.3 lib/kaltura_box/category/instance_methods.rb
kaltura_box-0.0.2 lib/kaltura_box/category/instance_methods.rb
kaltura_box-0.0.1 lib/kaltura_box/category/instance_methods.rb