Class: Kaltura::KalturaSessionService

Inherits:
KalturaServiceBase show all
Defined in:
lib/kaltura_client.rb

Overview

Session service

Instance Attribute Summary

Attributes inherited from KalturaServiceBase

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ KalturaSessionService

Returns a new instance of KalturaSessionService.



12740
12741
12742
# File 'lib/kaltura_client.rb', line 12740

def initialize(client)
	super(client)
end

Instance Method Details

#endObject

End a session with the Kaltura server, making the current KS invalid.



12767
12768
12769
12770
12771
12772
12773
12774
# File 'lib/kaltura_client.rb', line 12767

def end()
	kparams = {}
	client.queue_service_action_call('session', 'end', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#get(session = KalturaNotImplemented) ⇒ Object

Parse session key and return its info



12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
# File 'lib/kaltura_client.rb', line 12821

def get(session=KalturaNotImplemented)
	kparams = {}
	# The KS to be parsed, keep it empty to use current session.
	client.add_param(kparams, 'session', session);
	client.queue_service_action_call('session', 'get', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#impersonate(secret, impersonated_partner_id, user_id = '', type = 0, partner_id = KalturaNotImplemented, expiry = 86400, privileges = KalturaNotImplemented) ⇒ Object

Start an impersonated session with Kaltura’s server. The result KS is the session key that you should pass to all services that requires a ticket.



12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
# File 'lib/kaltura_client.rb', line 12779

def impersonate(secret, impersonated_partner_id, user_id='', type=0, partner_id=KalturaNotImplemented, expiry=86400, privileges=KalturaNotImplemented)
	kparams = {}
	# - should be the secret (admin or user) of the original partnerId (not impersonatedPartnerId).
	client.add_param(kparams, 'secret', secret);
	client.add_param(kparams, 'impersonatedPartnerId', impersonated_partner_id);
	# - impersonated userId
	client.add_param(kparams, 'userId', user_id);
	client.add_param(kparams, 'type', type);
	client.add_param(kparams, 'partnerId', partner_id);
	# KS expiry time in seconds
	client.add_param(kparams, 'expiry', expiry);
	client.add_param(kparams, 'privileges', privileges);
	client.queue_service_action_call('session', 'impersonate', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#impersonate_by_ks(session, type = KalturaNotImplemented, expiry = KalturaNotImplemented, privileges = KalturaNotImplemented) ⇒ Object

Start an impersonated session with Kaltura’s server. The result KS info contains the session key that you should pass to all services that requires a ticket. Type, expiry and privileges won’t be changed if they’re not set



12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
# File 'lib/kaltura_client.rb', line 12802

def impersonate_by_ks(session, type=KalturaNotImplemented, expiry=KalturaNotImplemented, privileges=KalturaNotImplemented)
	kparams = {}
	# The old KS of the impersonated partner
	client.add_param(kparams, 'session', session);
	# Type of the new KS 
	client.add_param(kparams, 'type', type);
	# Expiry time in seconds of the new KS
	client.add_param(kparams, 'expiry', expiry);
	# Privileges of the new KS
	client.add_param(kparams, 'privileges', privileges);
	client.queue_service_action_call('session', 'impersonateByKs', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#start(secret, user_id = '', type = 0, partner_id = KalturaNotImplemented, expiry = 86400, privileges = KalturaNotImplemented) ⇒ Object

Start a session with Kaltura’s server. The result KS is the session key that you should pass to all services that requires a ticket.



12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
# File 'lib/kaltura_client.rb', line 12747

def start(secret, user_id='', type=0, partner_id=KalturaNotImplemented, expiry=86400, privileges=KalturaNotImplemented)
	kparams = {}
	# Remember to provide the correct secret according to the sessionType you want
	client.add_param(kparams, 'secret', secret);
	client.add_param(kparams, 'userId', user_id);
	# Regular session or Admin session
	client.add_param(kparams, 'type', type);
	client.add_param(kparams, 'partnerId', partner_id);
	# KS expiry time in seconds
	client.add_param(kparams, 'expiry', expiry);
	client.add_param(kparams, 'privileges', privileges);
	client.queue_service_action_call('session', 'start', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#start_widget_session(widget_id, expiry = 86400) ⇒ Object

Start a session for Kaltura’s flash widgets



12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
# File 'lib/kaltura_client.rb', line 12834

def start_widget_session(widget_id, expiry=86400)
	kparams = {}
	client.add_param(kparams, 'widgetId', widget_id);
	client.add_param(kparams, 'expiry', expiry);
	client.queue_service_action_call('session', 'startWidgetSession', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end