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.



490
491
492
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 490

def initialize(client)
	super(client)
end

Instance Method Details

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

Copy entry into new entry



496
497
498
499
500
501
502
503
504
505
506
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 496

def add_from_entry(source_entry_id, document_entry=KalturaNotImplemented, source_flavor_params_id=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'sourceEntryId', source_entry_id)
	client.add_param(kparams, 'documentEntry', document_entry)
	client.add_param(kparams, 'sourceFlavorParamsId', source_flavor_params_id)
	client.queue_service_action_call('document_documents', 'addFromEntry', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#add_from_flavor_asset(source_flavor_asset_id, document_entry = KalturaNotImplemented) ⇒ KalturaDocumentEntry

Copy flavor asset into new entry



510
511
512
513
514
515
516
517
518
519
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 510

def add_from_flavor_asset(source_flavor_asset_id, document_entry=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'sourceFlavorAssetId', source_flavor_asset_id)
	client.add_param(kparams, 'documentEntry', document_entry)
	client.queue_service_action_call('document_documents', 'addFromFlavorAsset', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#add_from_uploaded_file(document_entry, upload_token_id) ⇒ KalturaDocumentEntry

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



523
524
525
526
527
528
529
530
531
532
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 523

def add_from_uploaded_file(document_entry, upload_token_id)
	kparams = {}
	client.add_param(kparams, 'documentEntry', document_entry)
	client.add_param(kparams, 'uploadTokenId', upload_token_id)
	client.queue_service_action_call('document_documents', 'addFromUploadedFile', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#approve_replace(entry_id) ⇒ KalturaDocumentEntry

Approves document replacement



536
537
538
539
540
541
542
543
544
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 536

def approve_replace(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.queue_service_action_call('document_documents', 'approveReplace', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#cancel_replace(entry_id) ⇒ KalturaDocumentEntry

Cancels document replacement



548
549
550
551
552
553
554
555
556
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 548

def cancel_replace(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.queue_service_action_call('document_documents', 'cancelReplace', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

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

Convert entry

Returns:

  • (bigint)


560
561
562
563
564
565
566
567
568
569
570
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 560

def convert(entry_id, conversion_profile_id=KalturaNotImplemented, dynamic_conversion_attributes=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id)
	client.add_param(kparams, 'dynamicConversionAttributes', dynamic_conversion_attributes)
	client.queue_service_action_call('document_documents', 'convert', 'bigint', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#convert_ppt_to_swf(entry_id) ⇒ string

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

Returns:

  • (string)


575
576
577
578
579
580
581
582
583
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 575

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

#delete(entry_id) ⇒ Object

Delete a document entry.

Returns:



587
588
589
590
591
592
593
594
595
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 587

def delete(entry_id)
	kparams = {}
	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)) ⇒ KalturaDocumentEntry

Get document entry by ID.



599
600
601
602
603
604
605
606
607
608
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 599

def get(entry_id, version=-1)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'version', version)
	client.queue_service_action_call('document_documents', 'get', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

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

List document entries by filter with paging support.



612
613
614
615
616
617
618
619
620
621
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 612

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

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

Serves the file content

Returns:

  • (file)


625
626
627
628
629
630
631
632
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 625

def serve(entry_id, flavor_asset_id=KalturaNotImplemented, force_proxy=false)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'flavorAssetId', flavor_asset_id)
	client.add_param(kparams, 'forceProxy', force_proxy)
	client.queue_service_action_call('document_documents', 'serve', 'file', kparams)
	return client.get_serve_url()
end

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

Serves the file content

Returns:

  • (file)


636
637
638
639
640
641
642
643
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 636

def serve_by_flavor_params_id(entry_id, flavor_params_id=KalturaNotImplemented, force_proxy=false)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'flavorParamsId', flavor_params_id)
	client.add_param(kparams, 'forceProxy', force_proxy)
	client.queue_service_action_call('document_documents', 'serveByFlavorParamsId', 'file', kparams)
	return client.get_serve_url()
end

#update(entry_id, document_entry) ⇒ KalturaDocumentEntry

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



647
648
649
650
651
652
653
654
655
656
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 647

def update(entry_id, document_entry)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'documentEntry', document_entry)
	client.queue_service_action_call('document_documents', 'update', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

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

Replace content associated with the given document entry.



660
661
662
663
664
665
666
667
668
669
670
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 660

def update_content(entry_id, resource, conversion_profile_id=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'resource', resource)
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id)
	client.queue_service_action_call('document_documents', 'updateContent', 'KalturaDocumentEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#upload(file_data) ⇒ string

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

Returns:

  • (string)


674
675
676
677
678
679
680
681
682
683
# File 'lib/kaltura_plugins/kaltura_document_client_plugin.rb', line 674

def upload(file_data)
	kparams = {}
	kfiles = {}
	client.add_param(kfiles, 'fileData', file_data)
	client.queue_service_action_call('document_documents', 'upload', 'string', kparams, kfiles)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end