Class: Kaltura::KalturaMetadataService

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

Overview

Metadata service

Instance Attribute Summary

Attributes inherited from KalturaServiceBase

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ KalturaMetadataService

Returns a new instance of KalturaMetadataService.



409
410
411
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 409

def initialize(client)
	super(client)
end

Instance Method Details

#add(metadata_profile_id, object_type, object_id, xml_data) ⇒ Object

Allows you to add a metadata object and metadata content associated with Kaltura object



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

def add(, object_type, object_id, xml_data)
	kparams = {}
	client.add_param(kparams, 'metadataProfileId', );
	client.add_param(kparams, 'objectType', object_type);
	client.add_param(kparams, 'objectId', object_id);
	# XML metadata
	client.add_param(kparams, 'xmlData', xml_data);
	client.queue_service_action_call('metadata_metadata', 'add', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_bulk(metadata_profile_id, object_type, object_id, url) ⇒ Object

Allows you to add a metadata xml data from remote URL. Enables different permissions than addFromUrl action.



464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 464

def add_from_bulk(, object_type, object_id, url)
	kparams = {}
	client.add_param(kparams, 'metadataProfileId', );
	client.add_param(kparams, 'objectType', object_type);
	client.add_param(kparams, 'objectId', object_id);
	# XML metadata remote url
	client.add_param(kparams, 'url', url);
	client.queue_service_action_call('metadata_metadata', 'addFromBulk', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_file(metadata_profile_id, object_type, object_id, xml_file) ⇒ Object

Allows you to add a metadata object and metadata file associated with Kaltura object



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

def add_from_file(, object_type, object_id, xml_file)
	kparams = {}
	client.add_param(kparams, 'metadataProfileId', );
	client.add_param(kparams, 'objectType', object_type);
	client.add_param(kparams, 'objectId', object_id);
	# XML metadata
	client.add_param(kparams, 'xmlFile', xml_file);
	client.queue_service_action_call('metadata_metadata', 'addFromFile', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_url(metadata_profile_id, object_type, object_id, url) ⇒ Object

Allows you to add a metadata xml data from remote URL



447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 447

def add_from_url(, object_type, object_id, url)
	kparams = {}
	client.add_param(kparams, 'metadataProfileId', );
	client.add_param(kparams, 'objectType', object_type);
	client.add_param(kparams, 'objectId', object_id);
	# XML metadata remote url
	client.add_param(kparams, 'url', url);
	client.queue_service_action_call('metadata_metadata', 'addFromUrl', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#delete(id) ⇒ Object

Delete an existing metadata



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

def delete(id)
	kparams = {}
	client.add_param(kparams, 'id', id);
	client.queue_service_action_call('metadata_metadata', 'delete', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#get(id) ⇒ Object

Retrieve a metadata object by id



480
481
482
483
484
485
486
487
488
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 480

def get(id)
	kparams = {}
	client.add_param(kparams, 'id', id);
	client.queue_service_action_call('metadata_metadata', 'get', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#index(id, should_update) ⇒ Object

Index metadata by id, will also index the related object



562
563
564
565
566
567
568
569
570
571
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 562

def index(id, should_update)
	kparams = {}
	client.add_param(kparams, 'id', id);
	client.add_param(kparams, 'shouldUpdate', should_update);
	client.queue_service_action_call('metadata_metadata', 'index', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#invalidate(id, version = KalturaNotImplemented) ⇒ Object

Mark existing metadata as invalid Used by batch metadata transform



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

def invalidate(id, version=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'id', id);
	# Enable update only if the metadata object version did not change by other process
	client.add_param(kparams, 'version', version);
	client.queue_service_action_call('metadata_metadata', 'invalidate', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

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

List metadata objects by filter and pager



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

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

#serve(id) ⇒ Object

Serves metadata XML file



575
576
577
578
579
580
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 575

def serve(id)
	kparams = {}
	client.add_param(kparams, 'id', id);
	client.queue_service_action_call('metadata_metadata', 'serve', kparams);
	return client.get_serve_url();
end

#update(id, xml_data = KalturaNotImplemented, version = KalturaNotImplemented) ⇒ Object

Update an existing metadata object with new XML content



492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 492

def update(id, xml_data=KalturaNotImplemented, version=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'id', id);
	# XML metadata
	client.add_param(kparams, 'xmlData', xml_data);
	# Enable update only if the metadata object version did not change by other process
	client.add_param(kparams, 'version', version);
	client.queue_service_action_call('metadata_metadata', 'update', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_from_file(id, xml_file = KalturaNotImplemented) ⇒ Object

Update an existing metadata object with new XML file



508
509
510
511
512
513
514
515
516
517
518
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 508

def update_from_file(id, xml_file=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'id', id);
	# XML metadata
	client.add_param(kparams, 'xmlFile', xml_file);
	client.queue_service_action_call('metadata_metadata', 'updateFromFile', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_from_xsl(id, xsl_file) ⇒ Object

Action transforms current metadata object XML using a provided XSL.



584
585
586
587
588
589
590
591
592
593
# File 'lib/kaltura_plugins/kaltura_metadata_client_plugin.rb', line 584

def update_from_xsl(id, xsl_file)
	kparams = {}
	client.add_param(kparams, 'id', id);
	client.add_param(kparams, 'xslFile', xsl_file);
	client.queue_service_action_call('metadata_metadata', 'updateFromXSL', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end