kaltura-client 18.14.0 → 18.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e97e44a2fb73833009ef943dd57437faa4f084d7286b45c6a35982376304d8d7
4
- data.tar.gz: 978df6f225a764576c541d3c04f82ed4430ba7b65a48dc43bc2cb3c86f7ab2a5
3
+ metadata.gz: fe94cfa588ff68a36f35261ded5c192496b6ca7abe314c679bb5f95ad1f227b7
4
+ data.tar.gz: e0d94f186140fa6a96026822dada121898f8083f3fd2a99b4c822ee52567bb40
5
5
  SHA512:
6
- metadata.gz: 4a431be5c3ebd47216d6ef6f06931464c81a4150c3c558607b2e8c53d17822409a094ef9ed36f6cd7a03fc2055c00d3a4ed3ff8616ab0b4453208ede0f30edd1
7
- data.tar.gz: f0da087b202b5fd47d766cf9f199f6cabb1f2e6454011d04db9560e4efb8922de5037747a6f19257fc6eb82d25e7dafa6459791fbfcb57acb785941d521c386b
6
+ metadata.gz: 150de887ab33dcd4b2bfdf18fdd0b93be2d75fd15fc5b17ca2d4f6655443f9f4abc6c0da02e49988b34eee8e48ace907d32babb0908f54ed735d69483f8a4a0a
7
+ data.tar.gz: 185985027e86df44f0114f166511bfbdb6a828e90b8768f8c2bdf3745502eb94ed512bb1c789b393809eace6cb69b5a9ad1d466b68300d76ae256d2e0e860376
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  Kaltura Ruby API Client Library.
2
- Compatible with Kaltura server version 18.14.0 and above.
2
+ Compatible with Kaltura server version 18.16.0 and above.
3
3
 
4
4
  This source contains:
5
5
  - The Kaltura client library (kaltura_client_base.rb)
@@ -6382,8 +6382,8 @@ module Kaltura
6382
6382
 
6383
6383
  def initialize(client)
6384
6384
  super(client)
6385
- self.client_tag = 'ruby:22-09-19'
6386
- self.api_version = '18.14.0'
6385
+ self.client_tag = 'ruby:22-10-24'
6386
+ self.api_version = '18.16.0'
6387
6387
  end
6388
6388
 
6389
6389
  def client_tag=(value)
@@ -6491,6 +6491,27 @@ module Kaltura
6491
6491
  end
6492
6492
 
6493
6493
 
6494
+ def language=(value)
6495
+ @request_configuration['language'] = value
6496
+ end
6497
+
6498
+ def set_language(value)
6499
+ self.language = value
6500
+ end
6501
+
6502
+ def language()
6503
+ if(@request_configuration.has_key?('language'))
6504
+ return @request_configuration['language']
6505
+ end
6506
+
6507
+ return KalturaNotImplemented
6508
+ end
6509
+
6510
+ def get_language()
6511
+ return self.language
6512
+ end
6513
+
6514
+
6494
6515
  def response_profile=(value)
6495
6516
  @request_configuration['responseProfile'] = value
6496
6517
  end
@@ -36,11 +36,18 @@ require 'digest/sha1'
36
36
  require 'base64'
37
37
  require 'date'
38
38
  require 'yaml'
39
+ require 'uri'
39
40
 
40
41
  module Kaltura
41
42
  class KalturaNotImplemented; end
42
43
 
43
44
  class KalturaClientBase
45
+
46
+ # KS V2 constants
47
+ FIELD_EXPIRY = '_e';
48
+ FIELD_TYPE = '_t';
49
+ FIELD_USER = '_u';
50
+
44
51
  attr_accessor :config
45
52
  attr_reader :is_multirequest
46
53
  attr_reader :responseHeaders
@@ -387,6 +394,62 @@ module Kaltura
387
394
 
388
395
  self.ks = cleaned
389
396
  end
397
+
398
+ def generate_session_v2(admin_secret, user_id, kaltura_session_type, partner_id, expiry=86400, privileges=nil)
399
+ fields = {}
400
+ if privileges !=nil
401
+ privileges.split(',').each do |privilege|
402
+ privilege.strip!
403
+ if !privilege
404
+ next
405
+ end
406
+ if (privilege == '*')
407
+ privilege = 'all:*'
408
+ end
409
+ splitted_privilege = privilege.split(':', 2)
410
+ if (splitted_privilege.count > 1)
411
+ fields[splitted_privilege[0]] = splitted_privilege[1]
412
+ else
413
+ fields[splitted_privilege[0]] = ''
414
+ end
415
+ end
416
+ end
417
+ fields[KalturaClientBase::FIELD_EXPIRY] = (Time.now.to_i + expiry.to_i)
418
+ fields[KalturaClientBase::FIELD_TYPE] = kaltura_session_type
419
+ fields[KalturaClientBase::FIELD_USER] = user_id
420
+
421
+ # build fields string
422
+ fields_str = URI.encode_www_form(fields)
423
+ rand = ''
424
+ for i in 0..15 do
425
+ rand += rand(0..0xff).chr
426
+ end
427
+ fields_str = rand + fields_str
428
+ fields_str = Digest::SHA1.digest(fields_str) + fields_str
429
+
430
+ # encrypt and encode
431
+ encrypted_fields = aes_encrypt(admin_secret, fields_str)
432
+ decoded_ks = "v2|#{partner_id}|" + encrypted_fields
433
+ # in other clients, we do not set the ks on the client object here, only return it; however, because
434
+ # this was done in generate_session(), I added it for compatibility reasons.
435
+ self.ks = Base64.urlsafe_encode64(decoded_ks).gsub('+','-').gsub('/','_')
436
+ return self.ks
437
+ end
438
+
439
+ def aes_encrypt(key, data)
440
+ iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" # no need for an IV since we add a random string to the message anyway
441
+ key = Digest::SHA1.digest(key)[0..15]
442
+ cipher = OpenSSL::Cipher::AES.new(128, :CBC)
443
+ cipher.encrypt
444
+
445
+ cipher.padding = 0 # we must disable native padding.
446
+ cipher.key = key
447
+ cipher.iv = iv
448
+ block_size = cipher.block_size
449
+ # this is needed to maintain compatibility with the legacy mcrypt extension, see https://github.com/kaltura/server/blob/Rigel-18.16.0/infra/general/KCryptoWrapper.class.php#L79
450
+ data = data + "\0" * (block_size - data.bytesize % block_size)
451
+ return cipher.update(data) + cipher.final
452
+ end
390
453
  end
391
454
 
392
455
  class KalturaServiceActionCall
data/lib/kaltura_enums.rb CHANGED
@@ -3874,6 +3874,8 @@ module Kaltura
3874
3874
  end
3875
3875
 
3876
3876
  class KalturaUserEntryExtendedStatus
3877
+ SYNC_STATUS_ERROR = "quiz.SYNC_STATUS_ERROR"
3878
+ SYNC_STATUS_SUCCESS = "quiz.SYNC_STATUS_SUCCESS"
3877
3879
  PLAYBACK_COMPLETE = "viewHistory.PLAYBACK_COMPLETE"
3878
3880
  PLAYBACK_STARTED = "viewHistory.PLAYBACK_STARTED"
3879
3881
  VIEWED = "viewHistory.VIEWED"
data/lib/kaltura_types.rb CHANGED
@@ -850,6 +850,26 @@ module Kaltura
850
850
 
851
851
  end
852
852
 
853
+ # A Multi Lingual String
854
+ class KalturaMultiLingualString < KalturaObjectBase
855
+ # The language of the value
856
+ attr_accessor :language
857
+ # Value
858
+ attr_accessor :value
859
+
860
+
861
+ def from_xml(xml_element)
862
+ super
863
+ if xml_element.elements['language'] != nil
864
+ self.language = xml_element.elements['language'].text
865
+ end
866
+ if xml_element.elements['value'] != nil
867
+ self.value = xml_element.elements['value'].text
868
+ end
869
+ end
870
+
871
+ end
872
+
853
873
  # Base class to all operation attributes types
854
874
  class KalturaOperationAttributes < KalturaObjectBase
855
875
 
@@ -865,8 +885,12 @@ module Kaltura
865
885
  attr_accessor :id
866
886
  # Entry name (Min 1 chars)
867
887
  attr_accessor :name
888
+ # Entry name (Min 1 chars)
889
+ attr_accessor :multi_lingual_name
868
890
  # Entry description
869
891
  attr_accessor :description
892
+ # Entry description
893
+ attr_accessor :multi_lingual_description
870
894
  attr_accessor :partner_id
871
895
  # The ID of the user who is the owner of this entry
872
896
  attr_accessor :user_id
@@ -874,6 +898,8 @@ module Kaltura
874
898
  attr_accessor :creator_id
875
899
  # Entry tags
876
900
  attr_accessor :tags
901
+ # Entry tags
902
+ attr_accessor :multi_lingual_tags
877
903
  # Entry admin tags can be updated only by administrators
878
904
  attr_accessor :admin_tags
879
905
  # Comma separated list of full names of categories to which this entry belongs. Only categories that don't have entitlement (privacy context) are listed, to retrieve the full list of categories, use the categoryEntry.list action.
@@ -1018,9 +1044,15 @@ module Kaltura
1018
1044
  if xml_element.elements['name'] != nil
1019
1045
  self.name = xml_element.elements['name'].text
1020
1046
  end
1047
+ if xml_element.elements['multiLingual_name'] != nil
1048
+ self.multi_lingual_name = KalturaClientBase.object_from_xml(xml_element.elements['multiLingual_name'], 'KalturaMultiLingualString')
1049
+ end
1021
1050
  if xml_element.elements['description'] != nil
1022
1051
  self.description = xml_element.elements['description'].text
1023
1052
  end
1053
+ if xml_element.elements['multiLingual_description'] != nil
1054
+ self.multi_lingual_description = KalturaClientBase.object_from_xml(xml_element.elements['multiLingual_description'], 'KalturaMultiLingualString')
1055
+ end
1024
1056
  if xml_element.elements['partnerId'] != nil
1025
1057
  self.partner_id = xml_element.elements['partnerId'].text
1026
1058
  end
@@ -1033,6 +1065,9 @@ module Kaltura
1033
1065
  if xml_element.elements['tags'] != nil
1034
1066
  self.tags = xml_element.elements['tags'].text
1035
1067
  end
1068
+ if xml_element.elements['multiLingual_tags'] != nil
1069
+ self.multi_lingual_tags = KalturaClientBase.object_from_xml(xml_element.elements['multiLingual_tags'], 'KalturaMultiLingualString')
1070
+ end
1036
1071
  if xml_element.elements['adminTags'] != nil
1037
1072
  self.admin_tags = xml_element.elements['adminTags'].text
1038
1073
  end
@@ -9031,6 +9066,8 @@ module Kaltura
9031
9066
  attr_accessor :partner_id
9032
9067
  # Kaltura API session
9033
9068
  attr_accessor :ks
9069
+ # language
9070
+ attr_accessor :language
9034
9071
  # Response profile - this attribute will be automatically unset after every API call.
9035
9072
  attr_accessor :response_profile
9036
9073
 
@@ -9046,6 +9083,9 @@ module Kaltura
9046
9083
  if xml_element.elements['ks'] != nil
9047
9084
  self.ks = xml_element.elements['ks'].text
9048
9085
  end
9086
+ if xml_element.elements['language'] != nil
9087
+ self.language = xml_element.elements['language'].text
9088
+ end
9049
9089
  if xml_element.elements['responseProfile'] != nil
9050
9090
  self.response_profile = KalturaClientBase.object_from_xml(xml_element.elements['responseProfile'], 'KalturaBaseResponseProfile')
9051
9091
  end
@@ -64,10 +64,10 @@ class ConfigurationTest < Test::Unit::TestCase
64
64
  config.logger = Logger.new(STDOUT)
65
65
  config.timeout = timeout
66
66
 
67
- @client = Kaltura::KalturaClient.new( config )
67
+ @client = Kaltura::KalturaClient.new(config)
68
68
  assert_equal @client.ks, Kaltura::KalturaNotImplemented
69
69
 
70
- session = @client.session_service.start( administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
70
+ session = @client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
71
71
  @client.ks = session
72
72
 
73
73
  assert_not_nil @client.ks
@@ -86,10 +86,10 @@ class ConfigurationTest < Test::Unit::TestCase
86
86
  config.service_url = service_url
87
87
  config.logger = Logger.new(STDOUT)
88
88
 
89
- @client = Kaltura::KalturaClient.new( config )
89
+ @client = Kaltura::KalturaClient.new(config)
90
90
 
91
91
  assert_raise Kaltura::KalturaAPIError do
92
- session = @client.session_service.start( administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
92
+ session = @client.session_service.start(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
93
93
  end
94
94
  end
95
95
 
@@ -105,10 +105,10 @@ class ConfigurationTest < Test::Unit::TestCase
105
105
  config.service_url = service_url
106
106
  config.logger = Logger.new(STDOUT)
107
107
 
108
- @client = Kaltura::KalturaClient.new( config )
108
+ @client = Kaltura::KalturaClient.new(config)
109
109
 
110
110
  assert_raise Kaltura::KalturaAPIError do
111
- session = @client.session_service.start( "invalid_administrator_secret", '', Kaltura::KalturaSessionType::ADMIN, partner_id)
111
+ session = @client.session_service.start("invalid_administrator_secret", '', Kaltura::KalturaSessionType::ADMIN, partner_id)
112
112
  @client.ks = session
113
113
  end
114
114
 
@@ -130,11 +130,11 @@ class ConfigurationTest < Test::Unit::TestCase
130
130
  config.logger = Logger.new(STDOUT)
131
131
  config.timeout = timeout
132
132
 
133
- @client = Kaltura::KalturaClient.new( config )
133
+ @client = Kaltura::KalturaClient.new(config)
134
134
 
135
135
  assert_equal @client.ks, Kaltura::KalturaNotImplemented
136
136
 
137
- @client.generate_session(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
137
+ @client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
138
138
 
139
139
  assert_not_nil @client.ks
140
140
 
data/test/test_helper.rb CHANGED
@@ -54,8 +54,8 @@ class Test::Unit::TestCase
54
54
  config.logger = Logger.new(STDOUT)
55
55
  config.timeout = timeout
56
56
 
57
- @client = Kaltura::KalturaClient.new( config )
58
- @client.generate_session(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id )
57
+ @client = Kaltura::KalturaClient.new(config)
58
+ @client.generate_session_v2(administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, partner_id)
59
59
  end
60
60
 
61
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaltura-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.14.0
4
+ version: 18.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaltura Inc.