Class: Kaltura::KalturaQuizService

Inherits:
KalturaServiceBase show all
Defined in:
lib/kaltura_plugins/kaltura_quiz_client_plugin.rb

Overview

Allows user to handle quizzes

Instance Attribute Summary

Attributes inherited from KalturaServiceBase

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ KalturaQuizService

Returns a new instance of KalturaQuizService.



388
389
390
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 388

def initialize(client)
	super(client)
end

Instance Method Details

#add(entry_id, quiz) ⇒ KalturaQuiz

Allows to add a quiz to an entry

Returns:



394
395
396
397
398
399
400
401
402
403
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 394

def add(entry_id, quiz)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'quiz', quiz)
	client.queue_service_action_call('quiz_quiz', 'add', 'KalturaQuiz', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#get(entry_id) ⇒ KalturaQuiz

Allows to get a quiz

Returns:



407
408
409
410
411
412
413
414
415
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 407

def get(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.queue_service_action_call('quiz_quiz', 'get', 'KalturaQuiz', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#get_url(entry_id, quiz_output_type) ⇒ string

sends a with an api request for pdf from quiz object

Returns:

  • (string)


419
420
421
422
423
424
425
426
427
428
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 419

def get_url(entry_id, quiz_output_type)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'quizOutputType', quiz_output_type)
	client.queue_service_action_call('quiz_quiz', 'getUrl', 'string', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#list(filter = KalturaNotImplemented, pager = KalturaNotImplemented) ⇒ KalturaQuizListResponse

List quiz objects by filter and pager



432
433
434
435
436
437
438
439
440
441
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 432

def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'filter', filter)
	client.add_param(kparams, 'pager', pager)
	client.queue_service_action_call('quiz_quiz', 'list', 'KalturaQuizListResponse', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#serve(entry_id, quiz_output_type) ⇒ file

creates a pdf from quiz object The Output type defines the file format in which the quiz will be generated Currently only PDF files are supported

Returns:

  • (file)


447
448
449
450
451
452
453
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 447

def serve(entry_id, quiz_output_type)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'quizOutputType', quiz_output_type)
	client.queue_service_action_call('quiz_quiz', 'serve', 'file', kparams)
	return client.get_serve_url()
end

#update(entry_id, quiz) ⇒ KalturaQuiz

Allows to update a quiz

Returns:



457
458
459
460
461
462
463
464
465
466
# File 'lib/kaltura_plugins/kaltura_quiz_client_plugin.rb', line 457

def update(entry_id, quiz)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'quiz', quiz)
	client.queue_service_action_call('quiz_quiz', 'update', 'KalturaQuiz', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end