kaltura-client 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/README +21 -0
  3. data/Rakefile +19 -0
  4. data/agpl.txt +674 -0
  5. data/kaltura.yml +7 -0
  6. data/lib/kaltura.rb +31 -0
  7. data/lib/kaltura_client.rb +15649 -0
  8. data/lib/kaltura_client_base.rb +432 -0
  9. data/lib/kaltura_plugins/kaltura_abc_screeners_watermark_access_control_client_plugin.rb +37 -0
  10. data/lib/kaltura_plugins/kaltura_ad_cue_point_client_plugin.rb +110 -0
  11. data/lib/kaltura_plugins/kaltura_annotation_client_plugin.rb +239 -0
  12. data/lib/kaltura_plugins/kaltura_aspera_client_plugin.rb +61 -0
  13. data/lib/kaltura_plugins/kaltura_attachment_client_plugin.rb +227 -0
  14. data/lib/kaltura_plugins/kaltura_audit_client_plugin.rb +349 -0
  15. data/lib/kaltura_plugins/kaltura_bulk_upload_client_plugin.rb +116 -0
  16. data/lib/kaltura_plugins/kaltura_bulk_upload_csv_client_plugin.rb +55 -0
  17. data/lib/kaltura_plugins/kaltura_bulk_upload_filter_client_plugin.rb +58 -0
  18. data/lib/kaltura_plugins/kaltura_bulk_upload_xml_client_plugin.rb +40 -0
  19. data/lib/kaltura_plugins/kaltura_caption_client_plugin.rb +406 -0
  20. data/lib/kaltura_plugins/kaltura_caption_search_client_plugin.rb +138 -0
  21. data/lib/kaltura_plugins/kaltura_code_cue_point_client_plugin.rb +99 -0
  22. data/lib/kaltura_plugins/kaltura_content_distribution_client_plugin.rb +1725 -0
  23. data/lib/kaltura_plugins/kaltura_cue_point_client_plugin.rb +312 -0
  24. data/lib/kaltura_plugins/kaltura_document_client_plugin.rb +522 -0
  25. data/lib/kaltura_plugins/kaltura_drm_client_plugin.rb +401 -0
  26. data/lib/kaltura_plugins/kaltura_drop_folder_client_plugin.rb +827 -0
  27. data/lib/kaltura_plugins/kaltura_drop_folder_xml_bulk_upload_client_plugin.rb +39 -0
  28. data/lib/kaltura_plugins/kaltura_email_notification_client_plugin.rb +273 -0
  29. data/lib/kaltura_plugins/kaltura_event_cue_point_client_plugin.rb +67 -0
  30. data/lib/kaltura_plugins/kaltura_event_notification_client_plugin.rb +415 -0
  31. data/lib/kaltura_plugins/kaltura_external_media_client_plugin.rb +203 -0
  32. data/lib/kaltura_plugins/kaltura_file_sync_client_plugin.rb +157 -0
  33. data/lib/kaltura_plugins/kaltura_http_notification_client_plugin.rb +309 -0
  34. data/lib/kaltura_plugins/kaltura_kontiki_client_plugin.rb +72 -0
  35. data/lib/kaltura_plugins/kaltura_like_client_plugin.rb +82 -0
  36. data/lib/kaltura_plugins/kaltura_metadata_client_plugin.rb +785 -0
  37. data/lib/kaltura_plugins/kaltura_multi_centers_client_plugin.rb +45 -0
  38. data/lib/kaltura_plugins/kaltura_play_ready_client_plugin.rb +347 -0
  39. data/lib/kaltura_plugins/kaltura_scheduled_task_client_plugin.rb +347 -0
  40. data/lib/kaltura_plugins/kaltura_scheduled_task_event_notification_client_plugin.rb +45 -0
  41. data/lib/kaltura_plugins/kaltura_scheduled_task_metadata_client_plugin.rb +51 -0
  42. data/lib/kaltura_plugins/kaltura_short_link_client_plugin.rb +231 -0
  43. data/lib/kaltura_plugins/kaltura_tag_search_client_plugin.rb +145 -0
  44. data/lib/kaltura_plugins/kaltura_thumb_cue_point_client_plugin.rb +105 -0
  45. data/lib/kaltura_plugins/kaltura_var_console_client_plugin.rb +238 -0
  46. data/lib/kaltura_plugins/kaltura_velocix_client_plugin.rb +40 -0
  47. data/lib/kaltura_plugins/kaltura_virus_scan_client_plugin.rb +263 -0
  48. data/lib/kaltura_plugins/kaltura_webex_drop_folder_client_plugin.rb +111 -0
  49. data/lib/kaltura_plugins/kaltura_widevine_client_plugin.rb +195 -0
  50. data/test/access_control_service_test.rb +75 -0
  51. data/test/base_entry_service_test.rb +267 -0
  52. data/test/configuration_test.rb +178 -0
  53. data/test/cue_point_service_test.rb +67 -0
  54. data/test/data_service_test.rb +76 -0
  55. data/test/document_service_test.rb +41 -0
  56. data/test/media/test.mov +0 -0
  57. data/test/media/test.pdf +0 -0
  58. data/test/media/test.png +0 -0
  59. data/test/media/test.swf +0 -0
  60. data/test/media/test.wmv +0 -0
  61. data/test/media_service_test.rb +294 -0
  62. data/test/metadata_profile_service_test.rb +63 -0
  63. data/test/test_helper.rb +59 -0
  64. metadata +132 -0
@@ -0,0 +1,111 @@
1
+ # ===================================================================================================
2
+ # _ __ _ _
3
+ # | |/ /__ _| | |_ _ _ _ _ __ _
4
+ # | ' </ _` | | _| || | '_/ _` |
5
+ # |_|\_\__,_|_|\__|\_,_|_| \__,_|
6
+ #
7
+ # This file is part of the Kaltura Collaborative Media Suite which allows users
8
+ # to do with audio, video, and animation what Wiki platfroms allow them to do with
9
+ # text.
10
+ #
11
+ # Copyright (C) 2006-2011 Kaltura Inc.
12
+ #
13
+ # This program is free software: you can redistribute it and/or modify
14
+ # it under the terms of the GNU Affero General Public License as
15
+ # published by the Free Software Foundation, either version 3 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU Affero General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Affero General Public License
24
+ # along with this program. If not, see <http:#www.gnu.org/licenses/>.
25
+ #
26
+ # @ignore
27
+ # ===================================================================================================
28
+ require 'kaltura_client.rb'
29
+ require File.dirname(__FILE__) + '/kaltura_drop_folder_client_plugin.rb'
30
+
31
+ module Kaltura
32
+
33
+ class KalturaWebexDropFolderFileOrderBy
34
+ CREATED_AT_ASC = "+createdAt"
35
+ FILE_NAME_ASC = "+fileName"
36
+ FILE_SIZE_ASC = "+fileSize"
37
+ FILE_SIZE_LAST_SET_AT_ASC = "+fileSizeLastSetAt"
38
+ ID_ASC = "+id"
39
+ PARSED_FLAVOR_ASC = "+parsedFlavor"
40
+ PARSED_SLUG_ASC = "+parsedSlug"
41
+ UPDATED_AT_ASC = "+updatedAt"
42
+ CREATED_AT_DESC = "-createdAt"
43
+ FILE_NAME_DESC = "-fileName"
44
+ FILE_SIZE_DESC = "-fileSize"
45
+ FILE_SIZE_LAST_SET_AT_DESC = "-fileSizeLastSetAt"
46
+ ID_DESC = "-id"
47
+ PARSED_FLAVOR_DESC = "-parsedFlavor"
48
+ PARSED_SLUG_DESC = "-parsedSlug"
49
+ UPDATED_AT_DESC = "-updatedAt"
50
+ end
51
+
52
+ class KalturaWebexDropFolderOrderBy
53
+ CREATED_AT_ASC = "+createdAt"
54
+ ID_ASC = "+id"
55
+ NAME_ASC = "+name"
56
+ UPDATED_AT_ASC = "+updatedAt"
57
+ CREATED_AT_DESC = "-createdAt"
58
+ ID_DESC = "-id"
59
+ NAME_DESC = "-name"
60
+ UPDATED_AT_DESC = "-updatedAt"
61
+ end
62
+
63
+ class KalturaWebexDropFolder < KalturaDropFolder
64
+ attr_accessor :webex_user_id
65
+ attr_accessor :webex_password
66
+ attr_accessor :webex_site_id
67
+ attr_accessor :webex_partner_id
68
+ attr_accessor :webex_service_url
69
+ attr_accessor :webex_host_id_metadata_field_name
70
+
71
+ def webex_site_id=(val)
72
+ @webex_site_id = val.to_i
73
+ end
74
+ end
75
+
76
+ class KalturaWebexDropFolderFile < KalturaDropFolderFile
77
+ attr_accessor :recording_id
78
+ attr_accessor :webex_host_id
79
+ attr_accessor :description
80
+ attr_accessor :conf_id
81
+ attr_accessor :content_url
82
+
83
+ def recording_id=(val)
84
+ @recording_id = val.to_i
85
+ end
86
+ end
87
+
88
+ class KalturaWebexDropFolderContentProcessorJobData < KalturaDropFolderContentProcessorJobData
89
+ attr_accessor :description
90
+ attr_accessor :webex_host_id
91
+
92
+ end
93
+
94
+ class KalturaWebexDropFolderBaseFilter < KalturaDropFolderFilter
95
+
96
+ end
97
+
98
+ class KalturaWebexDropFolderFileBaseFilter < KalturaDropFolderFileFilter
99
+
100
+ end
101
+
102
+ class KalturaWebexDropFolderFileFilter < KalturaWebexDropFolderFileBaseFilter
103
+
104
+ end
105
+
106
+ class KalturaWebexDropFolderFilter < KalturaWebexDropFolderBaseFilter
107
+
108
+ end
109
+
110
+
111
+ end
@@ -0,0 +1,195 @@
1
+ # ===================================================================================================
2
+ # _ __ _ _
3
+ # | |/ /__ _| | |_ _ _ _ _ __ _
4
+ # | ' </ _` | | _| || | '_/ _` |
5
+ # |_|\_\__,_|_|\__|\_,_|_| \__,_|
6
+ #
7
+ # This file is part of the Kaltura Collaborative Media Suite which allows users
8
+ # to do with audio, video, and animation what Wiki platfroms allow them to do with
9
+ # text.
10
+ #
11
+ # Copyright (C) 2006-2011 Kaltura Inc.
12
+ #
13
+ # This program is free software: you can redistribute it and/or modify
14
+ # it under the terms of the GNU Affero General Public License as
15
+ # published by the Free Software Foundation, either version 3 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU Affero General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Affero General Public License
24
+ # along with this program. If not, see <http:#www.gnu.org/licenses/>.
25
+ #
26
+ # @ignore
27
+ # ===================================================================================================
28
+ require 'kaltura_client.rb'
29
+ require File.dirname(__FILE__) + '/kaltura_drm_client_plugin.rb'
30
+
31
+ module Kaltura
32
+
33
+ class KalturaWidevineRepositorySyncMode
34
+ MODIFY = 0
35
+ end
36
+
37
+ class KalturaWidevineFlavorAssetOrderBy
38
+ CREATED_AT_ASC = "+createdAt"
39
+ DELETED_AT_ASC = "+deletedAt"
40
+ SIZE_ASC = "+size"
41
+ UPDATED_AT_ASC = "+updatedAt"
42
+ CREATED_AT_DESC = "-createdAt"
43
+ DELETED_AT_DESC = "-deletedAt"
44
+ SIZE_DESC = "-size"
45
+ UPDATED_AT_DESC = "-updatedAt"
46
+ end
47
+
48
+ class KalturaWidevineFlavorParamsOrderBy
49
+ end
50
+
51
+ class KalturaWidevineFlavorParamsOutputOrderBy
52
+ end
53
+
54
+ class KalturaWidevineProfileOrderBy
55
+ ID_ASC = "+id"
56
+ NAME_ASC = "+name"
57
+ ID_DESC = "-id"
58
+ NAME_DESC = "-name"
59
+ end
60
+
61
+ class KalturaWidevineProfile < KalturaDrmProfile
62
+ attr_accessor :key
63
+ attr_accessor :iv
64
+ attr_accessor :owner
65
+ attr_accessor :portal
66
+ attr_accessor :max_gop
67
+ attr_accessor :reg_server_host
68
+
69
+ def max_gop=(val)
70
+ @max_gop = val.to_i
71
+ end
72
+ end
73
+
74
+ class KalturaWidevineRepositorySyncJobData < KalturaJobData
75
+ attr_accessor :sync_mode
76
+ attr_accessor :wv_asset_ids
77
+ attr_accessor :modified_attributes
78
+ attr_accessor :monitor_sync_completion
79
+
80
+ def sync_mode=(val)
81
+ @sync_mode = val.to_i
82
+ end
83
+ def monitor_sync_completion=(val)
84
+ @monitor_sync_completion = val.to_i
85
+ end
86
+ end
87
+
88
+ class KalturaWidevineFlavorAsset < KalturaFlavorAsset
89
+ # License distribution window start date
90
+ #
91
+ attr_accessor :widevine_distribution_start_date
92
+ # License distribution window end date
93
+ #
94
+ attr_accessor :widevine_distribution_end_date
95
+ # Widevine unique asset id
96
+ #
97
+ attr_accessor :widevine_asset_id
98
+
99
+ def widevine_distribution_start_date=(val)
100
+ @widevine_distribution_start_date = val.to_i
101
+ end
102
+ def widevine_distribution_end_date=(val)
103
+ @widevine_distribution_end_date = val.to_i
104
+ end
105
+ def widevine_asset_id=(val)
106
+ @widevine_asset_id = val.to_i
107
+ end
108
+ end
109
+
110
+ class KalturaWidevineFlavorParams < KalturaFlavorParams
111
+
112
+ end
113
+
114
+ class KalturaWidevineFlavorParamsOutput < KalturaFlavorParamsOutput
115
+ # License distribution window start date
116
+ #
117
+ attr_accessor :widevine_distribution_start_date
118
+ # License distribution window end date
119
+ #
120
+ attr_accessor :widevine_distribution_end_date
121
+
122
+ def widevine_distribution_start_date=(val)
123
+ @widevine_distribution_start_date = val.to_i
124
+ end
125
+ def widevine_distribution_end_date=(val)
126
+ @widevine_distribution_end_date = val.to_i
127
+ end
128
+ end
129
+
130
+ class KalturaWidevineProfileBaseFilter < KalturaDrmProfileFilter
131
+
132
+ end
133
+
134
+ class KalturaWidevineProfileFilter < KalturaWidevineProfileBaseFilter
135
+
136
+ end
137
+
138
+ class KalturaWidevineFlavorAssetBaseFilter < KalturaFlavorAssetFilter
139
+
140
+ end
141
+
142
+ class KalturaWidevineFlavorParamsBaseFilter < KalturaFlavorParamsFilter
143
+
144
+ end
145
+
146
+ class KalturaWidevineFlavorAssetFilter < KalturaWidevineFlavorAssetBaseFilter
147
+
148
+ end
149
+
150
+ class KalturaWidevineFlavorParamsFilter < KalturaWidevineFlavorParamsBaseFilter
151
+
152
+ end
153
+
154
+ class KalturaWidevineFlavorParamsOutputBaseFilter < KalturaFlavorParamsOutputFilter
155
+
156
+ end
157
+
158
+ class KalturaWidevineFlavorParamsOutputFilter < KalturaWidevineFlavorParamsOutputBaseFilter
159
+
160
+ end
161
+
162
+
163
+ # WidevineDrmService serves as a license proxy to a Widevine license server
164
+ #
165
+ class KalturaWidevineDrmService < KalturaServiceBase
166
+ def initialize(client)
167
+ super(client)
168
+ end
169
+
170
+ # Get license for encrypted content playback
171
+ #
172
+ def get_license(flavor_asset_id, referrer=KalturaNotImplemented)
173
+ kparams = {}
174
+ client.add_param(kparams, 'flavorAssetId', flavor_asset_id);
175
+ # 64base encoded
176
+ client.add_param(kparams, 'referrer', referrer);
177
+ client.queue_service_action_call('widevine_widevinedrm', 'getLicense', kparams);
178
+ if (client.is_multirequest)
179
+ return nil;
180
+ end
181
+ return client.do_queue();
182
+ end
183
+ end
184
+
185
+ class KalturaClient < KalturaClientBase
186
+ attr_reader :widevine_drm_service
187
+ def widevine_drm_service
188
+ if (@widevine_drm_service == nil)
189
+ @widevine_drm_service = KalturaWidevineDrmService.new(self)
190
+ end
191
+ return @widevine_drm_service
192
+ end
193
+ end
194
+
195
+ end
@@ -0,0 +1,75 @@
1
+ # ===================================================================================================
2
+ # _ __ _ _
3
+ # | |/ /__ _| | |_ _ _ _ _ __ _
4
+ # | ' </ _` | | _| || | '_/ _` |
5
+ # |_|\_\__,_|_|\__|\_,_|_| \__,_|
6
+ #
7
+ # This file is part of the Kaltura Collaborative Media Suite which allows users
8
+ # to do with audio, video, and animation what Wiki platfroms allow them to do with
9
+ # text.
10
+ #
11
+ # Copyright (C) 2006-2011 Kaltura Inc.
12
+ #
13
+ # This program is free software: you can redistribute it and/or modify
14
+ # it under the terms of the GNU Affero General Public License as
15
+ # published by the Free Software Foundation, either version 3 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU Affero General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Affero General Public License
24
+ # along with this program. If not, see <http:#www.gnu.org/licenses/>.
25
+ #
26
+ # @ignore
27
+ # ===================================================================================================
28
+ require 'test_helper'
29
+ require 'uri'
30
+
31
+ class AccessControlServiceTest < Test::Unit::TestCase
32
+
33
+ # this test create a access control object and reset the restrictions using and empty array.
34
+ should "be able to send empty array to the api and reset the values" do
35
+
36
+ # cleaning up the list
37
+ access_control_filter = Kaltura::KalturaAccessControlFilter.new
38
+ filter_pager = Kaltura::KalturaFilterPager.new
39
+ access_control_list = @client.access_control_service.list(access_control_filter, filter_pager)
40
+ access_control_list.objects.each do |obj|
41
+ @client.access_control_service.delete(obj.id) rescue nil
42
+ end if access_control_list.objects
43
+
44
+ access_control = Kaltura::KalturaAccessControl.new
45
+ access_control.name = "kaltura_test"
46
+ access_control.is_default = Kaltura::KalturaNullableBoolean::FALSE_VALUE
47
+
48
+ access_control.restrictions = []
49
+
50
+ restriction1 = Kaltura::KalturaCountryRestriction.new
51
+ restriction1.country_restriction_type = Kaltura::KalturaCountryRestrictionType::RESTRICT_COUNTRY_LIST
52
+ restriction1.country_list = 'UK,LK'
53
+ access_control.restrictions << restriction1
54
+
55
+ restriction2 = Kaltura::KalturaSiteRestriction.new
56
+ restriction2.site_restriction_type = Kaltura::KalturaSiteRestrictionType::RESTRICT_SITE_LIST
57
+ restriction2.site_list = 'http://www.kaltura.com'
58
+ access_control.restrictions << restriction2
59
+
60
+ created_access_control = @client.access_control_service.add(access_control)
61
+
62
+ assert_not_nil created_access_control.id
63
+ assert_equal created_access_control.restrictions.size, 2
64
+
65
+ # edited access control
66
+ edited_access_control = Kaltura::KalturaAccessControl.new
67
+ edited_access_control.name = access_control.name
68
+ edited_access_control.restrictions = []
69
+
70
+ updated_access_control = @client.access_control_service.update(created_access_control.id, edited_access_control)
71
+
72
+ assert_equal updated_access_control.restrictions, nil
73
+ assert_nil @client.access_control_service.delete(updated_access_control.id)
74
+ end
75
+ end
@@ -0,0 +1,267 @@
1
+ # ===================================================================================================
2
+ # _ __ _ _
3
+ # | |/ /__ _| | |_ _ _ _ _ __ _
4
+ # | ' </ _` | | _| || | '_/ _` |
5
+ # |_|\_\__,_|_|\__|\_,_|_| \__,_|
6
+ #
7
+ # This file is part of the Kaltura Collaborative Media Suite which allows users
8
+ # to do with audio, video, and animation what Wiki platfroms allow them to do with
9
+ # text.
10
+ #
11
+ # Copyright (C) 2006-2011 Kaltura Inc.
12
+ #
13
+ # This program is free software: you can redistribute it and/or modify
14
+ # it under the terms of the GNU Affero General Public License as
15
+ # published by the Free Software Foundation, either version 3 of the
16
+ # License, or (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU Affero General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU Affero General Public License
24
+ # along with this program. If not, see <http:#www.gnu.org/licenses/>.
25
+ #
26
+ # @ignore
27
+ # ===================================================================================================
28
+ require 'test_helper'
29
+
30
+ class BaseEntryServiceTest < Test::Unit::TestCase
31
+
32
+ # this test uploads a file to kaltura and creates an entry using the uploaded file.
33
+ should "upload a file and create an entry" do
34
+
35
+ base_entry = Kaltura::KalturaBaseEntry.new
36
+ base_entry.type = Kaltura::KalturaEntryType::DOCUMENT
37
+ base_entry.name = "kaltura_test"
38
+ pdf_file = File.open("test/media/test.pdf")
39
+
40
+ pdf_token = @client.base_entry_service.upload(pdf_file)
41
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
42
+
43
+ assert_not_nil created_entry.id
44
+ assert_nil @client.base_entry_service.delete(created_entry.id)
45
+ end
46
+
47
+ # this test uploads a file to kaltura and creates an entry using the uploaded file.
48
+ should "upload a file and create an entry" do
49
+
50
+ base_entry = Kaltura::KalturaBaseEntry.new
51
+ base_entry.type = Kaltura::KalturaEntryType::AUTOMATIC
52
+ base_entry.name = "kaltura_test"
53
+ swf_file = File.open("test/media/test.swf")
54
+
55
+ pdf_token = @client.base_entry_service.upload(swf_file)
56
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
57
+
58
+ assert_not_nil created_entry.id
59
+ assert_nil @client.base_entry_service.delete(created_entry.id)
60
+ end
61
+
62
+ # this test simulates an api response with 'not supported' attributes and try to parse and generate an entry object out of it.
63
+ should "silently ignore any fields returned from the server that it does not recognize" do
64
+
65
+ response_body =
66
+ <<-XML
67
+ <?xml version='1.0' encoding='utf-8'?><xml><result><objectType>KalturaBaseEntry</objectType><id>0_npdg4rrs</id><not_supported_attr>not_supported_attr val</not_supported_attr><name>102_1321456940</name><description></description><partnerId>102</partnerId><userId></userId><tags></tags><adminTags></adminTags><categories></categories><status>2</status><moderationStatus>6</moderationStatus><moderationCount>0</moderationCount><type>10</type><createdAt>1321456940</createdAt><rank>0</rank><totalRank>0</totalRank><votes>0</votes><groupId></groupId><partnerData></partnerData><downloadUrl>http://ec2-174-129-124-16.compute-1.amazonaws.com/p/102/sp/10200/raw/entry_id/0_npdg4rrs/version/100000</downloadUrl><searchText> 102_1321456940 </searchText><licenseType>-1</licenseType><version>100000</version><thumbnailUrl>http://ec2-174-129-124-16.compute-1.amazonaws.com/p/102/sp/10200/thumbnail/entry_id/0_npdg4rrs/version/0</thumbnailUrl><accessControlId>4</accessControlId><startDate></startDate><endDate></endDate></result><executionTime>0.110525846481</executionTime></xml>
68
+ XML
69
+ created_entry = @client.parse_to_objects(response_body)
70
+
71
+ assert_instance_of Kaltura::KalturaBaseEntry, created_entry
72
+ assert_not_nil created_entry.id
73
+ end
74
+
75
+ # this test creates an entry and retrieves the list of entries and count from kaltura by setting a filter.
76
+ should "get the base entry list" do
77
+
78
+ # cleaning up the list
79
+ base_entry_filter = Kaltura::KalturaBaseEntryFilter.new
80
+ base_entry_filter.name_multi_like_or = "kaltura_test"
81
+ filter_pager = Kaltura::KalturaFilterPager.new
82
+ base_entry_list = @client.base_entry_service.list(base_entry_filter, filter_pager)
83
+ base_entry_list.objects.each do |obj|
84
+ @client.base_entry_service.delete(obj.id) rescue nil
85
+ end if base_entry_list.objects
86
+
87
+ base_entry = Kaltura::KalturaBaseEntry.new
88
+ base_entry.type = Kaltura::KalturaEntryType::AUTOMATIC
89
+ base_entry.name = "kaltura_test"
90
+ swf_file = File.open("test/media/test.swf")
91
+
92
+ pdf_token = @client.base_entry_service.upload(swf_file)
93
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
94
+
95
+ assert_not_nil created_entry.id
96
+
97
+ base_entry_filter = Kaltura::KalturaBaseEntryFilter.new
98
+ base_entry_filter.name_multi_like_or = "kaltura_test"
99
+ filter_pager = Kaltura::KalturaFilterPager.new
100
+ base_entry_list = @client.base_entry_service.list(base_entry_filter, filter_pager)
101
+
102
+ assert_equal base_entry_list.total_count, 1
103
+
104
+ count = @client.base_entry_service.count(base_entry_filter)
105
+
106
+ assert_equal count.to_i, 1
107
+
108
+ assert_nil @client.base_entry_service.delete(created_entry.id)
109
+ end
110
+
111
+ # this test creates an entry and retrieves it back using the id.
112
+ should "get the base entry" do
113
+
114
+ base_entry = Kaltura::KalturaBaseEntry.new
115
+ base_entry.type = Kaltura::KalturaEntryType::DOCUMENT
116
+ base_entry.name = "kaltura_test"
117
+ swf_file = File.open("test/media/test.pdf")
118
+
119
+ pdf_token = @client.base_entry_service.upload(swf_file)
120
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
121
+
122
+ assert_not_nil created_entry.id
123
+
124
+ base_entry = @client.base_entry_service.get(created_entry.id)
125
+
126
+ assert_not_nil base_entry
127
+ assert_instance_of Kaltura::KalturaDocumentEntry, base_entry
128
+ assert_equal base_entry.id, created_entry.id
129
+ assert_nil @client.base_entry_service.delete(base_entry.id)
130
+ end
131
+
132
+ # this test creates couple of entries and retrieves them back using the ids
133
+ should "get the base entries using the ids" do
134
+
135
+ base_entry = Kaltura::KalturaBaseEntry.new
136
+ base_entry.type = Kaltura::KalturaEntryType::DOCUMENT
137
+ base_entry.name = "kaltura_test"
138
+ swf_file = File.open("test/media/test.pdf")
139
+
140
+ pdf_token = @client.base_entry_service.upload(swf_file)
141
+ created_entry1 = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
142
+
143
+ assert_not_nil created_entry1.id
144
+
145
+ base_entry = Kaltura::KalturaBaseEntry.new
146
+ base_entry.type = Kaltura::KalturaEntryType::AUTOMATIC
147
+ base_entry.name = "kaltura_test"
148
+ swf_file = File.open("test/media/test.swf")
149
+
150
+ pdf_token = @client.base_entry_service.upload(swf_file)
151
+ created_entry2 = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
152
+
153
+ assert_not_nil created_entry2.id
154
+
155
+ base_entry_list = @client.base_entry_service.get_by_ids("#{created_entry1.id},#{created_entry2.id}")
156
+
157
+ assert_not_nil base_entry_list
158
+ assert_instance_of Array, base_entry_list
159
+ assert_equal base_entry_list.count, 2
160
+ assert_nil @client.base_entry_service.delete(created_entry1.id)
161
+ assert_nil @client.base_entry_service.delete(created_entry2.id)
162
+ end
163
+
164
+ # this test tries toretrieve an entry with invalid id.
165
+ should "throw an error for invalid base entry id" do
166
+
167
+ assert_raise Kaltura::KalturaAPIError do
168
+ @client.base_entry_service.get("invalid_base_entry_id")
169
+ end
170
+
171
+ end
172
+
173
+ # this test creates an entry and updates the metadata of it.
174
+ should "update the base entry metadata" do
175
+
176
+ base_entry = Kaltura::KalturaBaseEntry.new
177
+ base_entry.type = Kaltura::KalturaEntryType::AUTOMATIC
178
+ base_entry.name = "kaltura test"
179
+ swf_file = File.open("test/media/test.swf")
180
+
181
+ pdf_token = @client.base_entry_service.upload(swf_file)
182
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
183
+
184
+ assert_not_nil created_entry.id
185
+
186
+ base_entry = Kaltura::KalturaBaseEntry.new
187
+ base_entry.name = "kaltura test updated"
188
+ base_entry.description = "kaltura test description"
189
+ base_entry_updated = @client.base_entry_service.update(created_entry.id, base_entry)
190
+
191
+ assert_not_nil base_entry_updated
192
+ assert_instance_of Kaltura::KalturaBaseEntry, base_entry_updated
193
+ assert_equal base_entry_updated.name, "kaltura test updated"
194
+ assert_equal base_entry_updated.description, "kaltura test description"
195
+
196
+ assert_nil @client.base_entry_service.delete(base_entry_updated.id)
197
+ end
198
+
199
+ # this test creates an entry and updates it's thumbnail.
200
+ should "upload a thumbnail for the base entry " do
201
+
202
+ base_entry = Kaltura::KalturaBaseEntry.new
203
+ base_entry.type = Kaltura::KalturaEntryType::DOCUMENT
204
+ base_entry.name = "kaltura_test"
205
+ pdf_file = File.open("test/media/test.pdf")
206
+
207
+ pdf_token = @client.base_entry_service.upload(pdf_file)
208
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
209
+
210
+ assert_not_nil created_entry.id
211
+
212
+ img_file = File.open("test/media/test.png")
213
+
214
+ updated_entry = @client.base_entry_service.update_thumbnail_jpeg(created_entry.id, img_file)
215
+
216
+ assert_not_nil updated_entry.thumbnail_url
217
+ assert_not_equal updated_entry.thumbnail_url, created_entry.thumbnail_url
218
+ assert_nil @client.base_entry_service.delete(updated_entry.id)
219
+ end
220
+
221
+ # this test creates an entry and set it's moderation flags.
222
+ should "set the moderation flags" do
223
+
224
+ base_entry = Kaltura::KalturaBaseEntry.new
225
+ base_entry.type = Kaltura::KalturaEntryType::DOCUMENT
226
+ base_entry.name = "kaltura_test"
227
+ pdf_file = File.open("test/media/test.pdf")
228
+
229
+ pdf_token = @client.base_entry_service.upload(pdf_file)
230
+ created_entry = @client.base_entry_service.add_from_uploaded_file(base_entry, pdf_token)
231
+
232
+ assert_not_nil created_entry.id
233
+
234
+ # first list the flags. should be empty
235
+ moderation_flag_list = @client.base_entry_service.list_flags(created_entry.id)
236
+
237
+ assert_equal moderation_flag_list.total_count, 0
238
+
239
+ # add a new flag for moderate
240
+ flag = Kaltura::KalturaModerationFlag.new
241
+ flag.flagged_entry_id = created_entry.id
242
+ flag.flag_type = Kaltura::KalturaModerationFlagType::SEXUAL_CONTENT
243
+ flag = @client.base_entry_service.flag(flag)
244
+
245
+ # list the flags, should be 1
246
+ moderation_flag_list = @client.base_entry_service.list_flags(created_entry.id)
247
+
248
+ assert_equal moderation_flag_list.total_count, 1
249
+ assert_equal moderation_flag_list.objects[0].status, Kaltura::KalturaModerationFlagStatus::PENDING
250
+
251
+ # approve the flags
252
+ @client.base_entry_service.approve(created_entry.id)
253
+
254
+ # list the flags, should be empty
255
+ moderation_flag_list = @client.base_entry_service.list_flags(created_entry.id)
256
+
257
+ assert_equal moderation_flag_list.total_count, 0
258
+
259
+ # get the entry and check the moderation status
260
+ created_entry = @client.base_entry_service.get(created_entry.id)
261
+
262
+ assert_equal created_entry.moderation_status, Kaltura::KalturaEntryModerationStatus::APPROVED
263
+
264
+ assert_nil @client.base_entry_service.delete(created_entry.id)
265
+ end
266
+
267
+ end