Class: Kaltura::KalturaDocumentsService

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

Overview

Document service lets you upload and manage document files

Instance Attribute Summary

Attributes inherited from KalturaServiceBase

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ KalturaDocumentsService

Returns a new instance of KalturaDocumentsService.



288
289
290
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 288

def initialize(client)
	super(client)
end

Instance Method Details

#add_from_entry(source_entry_id, document_entry = KalturaNotImplemented, source_flavor_params_id = KalturaNotImplemented) ⇒ Object

Copy entry into new entry



309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 309

def add_from_entry(source_entry_id, document_entry=KalturaNotImplemented, source_flavor_params_id=KalturaNotImplemented)
	kparams = {}
	# Document entry id to copy from
	client.add_param(kparams, 'sourceEntryId', source_entry_id);
	# Document entry metadata
	client.add_param(kparams, 'documentEntry', document_entry);
	# The flavor to be used as the new entry source, source flavor will be used if not specified
	client.add_param(kparams, 'sourceFlavorParamsId', source_flavor_params_id);
	client.queue_service_action_call('document_documents', 'addFromEntry', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_flavor_asset(source_flavor_asset_id, document_entry = KalturaNotImplemented) ⇒ Object

Copy flavor asset into new entry



326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 326

def add_from_flavor_asset(source_flavor_asset_id, document_entry=KalturaNotImplemented)
	kparams = {}
	# Flavor asset id to be used as the new entry source
	client.add_param(kparams, 'sourceFlavorAssetId', source_flavor_asset_id);
	# Document entry metadata
	client.add_param(kparams, 'documentEntry', document_entry);
	client.queue_service_action_call('document_documents', 'addFromFlavorAsset', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_uploaded_file(document_entry, upload_token_id) ⇒ Object

Add new document entry after the specific document file was uploaded and the upload token id exists



294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 294

def add_from_uploaded_file(document_entry, upload_token_id)
	kparams = {}
	# Document entry metadata
	client.add_param(kparams, 'documentEntry', document_entry);
	# Upload token id
	client.add_param(kparams, 'uploadTokenId', upload_token_id);
	client.queue_service_action_call('document_documents', 'addFromUploadedFile', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#approve_replace(entry_id) ⇒ Object

Approves document replacement



487
488
489
490
491
492
493
494
495
496
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 487

def approve_replace(entry_id)
	kparams = {}
	# document entry id to replace
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('document_documents', 'approveReplace', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#cancel_replace(entry_id) ⇒ Object

Cancels document replacement



500
501
502
503
504
505
506
507
508
509
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 500

def cancel_replace(entry_id)
	kparams = {}
	# Document entry id to cancel
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('document_documents', 'cancelReplace', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#convert(entry_id, conversion_profile_id = KalturaNotImplemented, dynamic_conversion_attributes = KalturaNotImplemented) ⇒ Object

Convert entry



341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 341

def convert(entry_id, conversion_profile_id=KalturaNotImplemented, dynamic_conversion_attributes=KalturaNotImplemented)
	kparams = {}
	# Document entry id
	client.add_param(kparams, 'entryId', entry_id);
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id);
	dynamicConversionAttributes.each do |obj|
		client.add_param(kparams, 'dynamicConversionAttributes', obj);
	end
	client.queue_service_action_call('document_documents', 'convert', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#convert_ppt_to_swf(entry_id) ⇒ Object

This will queue a batch job for converting the document file to swf Returns the URL where the new swf will be available



430
431
432
433
434
435
436
437
438
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 430

def convert_ppt_to_swf(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('document_documents', 'convertPptToSwf', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#delete(entry_id) ⇒ Object

Delete a document entry.



388
389
390
391
392
393
394
395
396
397
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 388

def delete(entry_id)
	kparams = {}
	# Document entry id to delete
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('document_documents', 'delete', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#get(entry_id, version = -1)) ⇒ Object

Get document entry by ID.



358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 358

def get(entry_id, version=-1)
	kparams = {}
	# Document entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Desired version of the data
	client.add_param(kparams, 'version', version);
	client.queue_service_action_call('document_documents', 'get', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

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

List document entries by filter with paging support.



401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 401

def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
	kparams = {}
	# Document entry filter
	client.add_param(kparams, 'filter', filter);
	# Pager
	client.add_param(kparams, 'pager', pager);
	client.queue_service_action_call('document_documents', 'list', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#serve(entry_id, flavor_asset_id = KalturaNotImplemented, force_proxy = false) ⇒ Object

Serves the file content



442
443
444
445
446
447
448
449
450
451
452
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 442

def serve(entry_id, flavor_asset_id=KalturaNotImplemented, force_proxy=false)
	kparams = {}
	# Document entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Flavor asset id
	client.add_param(kparams, 'flavorAssetId', flavor_asset_id);
	# force to get the content without redirect
	client.add_param(kparams, 'forceProxy', force_proxy);
	client.queue_service_action_call('document_documents', 'serve', kparams);
	return client.get_serve_url();
end

#serve_by_flavor_params_id(entry_id, flavor_params_id = KalturaNotImplemented, force_proxy = false) ⇒ Object

Serves the file content



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

def serve_by_flavor_params_id(entry_id, flavor_params_id=KalturaNotImplemented, force_proxy=false)
	kparams = {}
	# Document entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Flavor params id
	client.add_param(kparams, 'flavorParamsId', flavor_params_id);
	# force to get the content without redirect
	client.add_param(kparams, 'forceProxy', force_proxy);
	client.queue_service_action_call('document_documents', 'serveByFlavorParamsId', kparams);
	return client.get_serve_url();
end

#update(entry_id, document_entry) ⇒ Object

Update document entry. Only the properties that were set will be updated.



373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 373

def update(entry_id, document_entry)
	kparams = {}
	# Document entry id to update
	client.add_param(kparams, 'entryId', entry_id);
	# Document entry metadata to update
	client.add_param(kparams, 'documentEntry', document_entry);
	client.queue_service_action_call('document_documents', 'update', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_content(entry_id, resource, conversion_profile_id = KalturaNotImplemented) ⇒ Object

Replace content associated with the given document entry.



470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 470

def update_content(entry_id, resource, conversion_profile_id=KalturaNotImplemented)
	kparams = {}
	# document entry id to update
	client.add_param(kparams, 'entryId', entry_id);
	# Resource to be used to replace entry doc content
	client.add_param(kparams, 'resource', resource);
	# The conversion profile id to be used on the entry
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id);
	client.queue_service_action_call('document_documents', 'updateContent', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#upload(file_data) ⇒ Object

Upload a document file to Kaltura, then the file can be used to create a document entry.



416
417
418
419
420
421
422
423
424
425
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 416

def upload(file_data)
	kparams = {}
	# The file data
	client.add_param(kparams, 'fileData', file_data);
	client.queue_service_action_call('document_documents', 'upload', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end