kaltura-ruby-client 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README +20 -0
- data/Rakefile +19 -0
- data/agpl.txt +674 -0
- data/kaltura.yml +7 -0
- data/lib/kaltura.rb +31 -0
- data/lib/kaltura_client.rb +14450 -0
- data/lib/kaltura_client_base.rb +432 -0
- data/lib/kaltura_plugins/kaltura_abc_screeners_watermark_access_control_client_plugin.rb +37 -0
- data/lib/kaltura_plugins/kaltura_ad_cue_point_client_plugin.rb +108 -0
- data/lib/kaltura_plugins/kaltura_annotation_client_plugin.rb +237 -0
- data/lib/kaltura_plugins/kaltura_aspera_client_plugin.rb +61 -0
- data/lib/kaltura_plugins/kaltura_attachment_client_plugin.rb +227 -0
- data/lib/kaltura_plugins/kaltura_audit_client_plugin.rb +349 -0
- data/lib/kaltura_plugins/kaltura_bulk_upload_client_plugin.rb +109 -0
- data/lib/kaltura_plugins/kaltura_bulk_upload_csv_client_plugin.rb +55 -0
- data/lib/kaltura_plugins/kaltura_bulk_upload_filter_client_plugin.rb +46 -0
- data/lib/kaltura_plugins/kaltura_bulk_upload_xml_client_plugin.rb +40 -0
- data/lib/kaltura_plugins/kaltura_caption_client_plugin.rb +406 -0
- data/lib/kaltura_plugins/kaltura_caption_search_client_plugin.rb +138 -0
- data/lib/kaltura_plugins/kaltura_code_cue_point_client_plugin.rb +97 -0
- data/lib/kaltura_plugins/kaltura_content_distribution_client_plugin.rb +1717 -0
- data/lib/kaltura_plugins/kaltura_cue_point_client_plugin.rb +290 -0
- data/lib/kaltura_plugins/kaltura_document_client_plugin.rb +522 -0
- data/lib/kaltura_plugins/kaltura_drm_client_plugin.rb +204 -0
- data/lib/kaltura_plugins/kaltura_drop_folder_client_plugin.rb +810 -0
- data/lib/kaltura_plugins/kaltura_drop_folder_xml_bulk_upload_client_plugin.rb +39 -0
- data/lib/kaltura_plugins/kaltura_email_notification_client_plugin.rb +276 -0
- data/lib/kaltura_plugins/kaltura_event_notification_client_plugin.rb +405 -0
- data/lib/kaltura_plugins/kaltura_external_media_client_plugin.rb +203 -0
- data/lib/kaltura_plugins/kaltura_file_sync_client_plugin.rb +151 -0
- data/lib/kaltura_plugins/kaltura_http_notification_client_plugin.rb +309 -0
- data/lib/kaltura_plugins/kaltura_kontiki_client_plugin.rb +72 -0
- data/lib/kaltura_plugins/kaltura_like_client_plugin.rb +82 -0
- data/lib/kaltura_plugins/kaltura_metadata_client_plugin.rb +788 -0
- data/lib/kaltura_plugins/kaltura_multi_centers_client_plugin.rb +45 -0
- data/lib/kaltura_plugins/kaltura_short_link_client_plugin.rb +231 -0
- data/lib/kaltura_plugins/kaltura_tag_search_client_plugin.rb +145 -0
- data/lib/kaltura_plugins/kaltura_var_console_client_plugin.rb +238 -0
- data/lib/kaltura_plugins/kaltura_velocix_client_plugin.rb +40 -0
- data/lib/kaltura_plugins/kaltura_virus_scan_client_plugin.rb +263 -0
- data/lib/kaltura_plugins/kaltura_webex_drop_folder_client_plugin.rb +121 -0
- data/lib/kaltura_plugins/kaltura_widevine_client_plugin.rb +195 -0
- data/license.txt +674 -0
- data/test/access_control_service_test.rb +75 -0
- data/test/base_entry_service_test.rb +267 -0
- data/test/configuration_test.rb +178 -0
- data/test/cue_point_service_test.rb +67 -0
- data/test/data_service_test.rb +76 -0
- data/test/document_service_test.rb +41 -0
- data/test/media/test.mov +0 -0
- data/test/media/test.pdf +0 -0
- data/test/media/test.png +0 -0
- data/test/media/test.swf +0 -0
- data/test/media/test.wmv +0 -0
- data/test/media_service_test.rb +294 -0
- data/test/metadata_profile_service_test.rb +63 -0
- data/test/test_helper.rb +59 -0
- metadata +127 -0
@@ -0,0 +1,67 @@
|
|
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 CuePointServiceTest < Test::Unit::TestCase
|
31
|
+
|
32
|
+
# this test adds a cuepoint and retrieves the list of cue_points to demonstrate the use of kaltura plugins.
|
33
|
+
should "creates a cue_point and get the cue_point list" do
|
34
|
+
|
35
|
+
# creates a media_entry
|
36
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
37
|
+
media_entry.name = "kaltura_test1"
|
38
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
39
|
+
video_file = File.open("test/media/test.wmv")
|
40
|
+
|
41
|
+
video_token = @client.media_service.upload(video_file)
|
42
|
+
created_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
43
|
+
|
44
|
+
assert_not_nil created_entry.id
|
45
|
+
|
46
|
+
# creates a cue_point
|
47
|
+
cue_point = Kaltura::KalturaAnnotation.new
|
48
|
+
cue_point.cue_point_type = Kaltura::KalturaCuePointType::ANNOTATION
|
49
|
+
cue_point.entry_id = created_entry.id
|
50
|
+
|
51
|
+
created_cue_point = @client.cue_point_service.add(cue_point)
|
52
|
+
|
53
|
+
assert_not_nil created_cue_point.id
|
54
|
+
|
55
|
+
# list the cuepoints
|
56
|
+
cue_point_filter = Kaltura::KalturaCuePointFilter.new
|
57
|
+
cue_point_filter.entry_id_equal = created_entry.id
|
58
|
+
filter_pager = Kaltura::KalturaFilterPager.new
|
59
|
+
|
60
|
+
cue_point_list = @client.cue_point_service.list(cue_point_filter, filter_pager)
|
61
|
+
|
62
|
+
assert_equal cue_point_list.total_count, 1
|
63
|
+
|
64
|
+
assert_nil @client.cue_point_service.delete(created_cue_point.id)
|
65
|
+
assert_nil @client.media_service.delete(created_entry.id)
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,76 @@
|
|
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 'open-uri'
|
30
|
+
|
31
|
+
class DataServiceTest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
# this test creates a data entry and calls serve action to get a file url.
|
34
|
+
should "get the file url with data content" do
|
35
|
+
|
36
|
+
data_entry = Kaltura::KalturaDataEntry.new
|
37
|
+
data_entry.name = "kaltura_test"
|
38
|
+
data_entry.data_content = @content
|
39
|
+
|
40
|
+
created_entry = @client.data_service.add(data_entry)
|
41
|
+
|
42
|
+
assert_not_nil created_entry.id
|
43
|
+
|
44
|
+
file_url = @client.data_service.serve(created_entry.id)
|
45
|
+
|
46
|
+
assert_equal @content, open(file_url).read
|
47
|
+
|
48
|
+
assert_nil @client.data_service.delete(created_entry.id)
|
49
|
+
end
|
50
|
+
|
51
|
+
# this test creates a data entry, calls serve action to get file url and test file content.
|
52
|
+
should "get the file url with data content when the forceProxy is 0" do
|
53
|
+
|
54
|
+
data_entry = Kaltura::KalturaDataEntry.new
|
55
|
+
data_entry.name = "kaltura_test"
|
56
|
+
data_entry.data_content = @content
|
57
|
+
|
58
|
+
created_entry = @client.data_service.add(data_entry)
|
59
|
+
|
60
|
+
assert_not_nil created_entry.id
|
61
|
+
|
62
|
+
file_url = @client.data_service.serve(created_entry.id, nil, false)
|
63
|
+
|
64
|
+
assert_equal @content, open(file_url).read
|
65
|
+
|
66
|
+
assert_nil @client.data_service.delete(created_entry.id)
|
67
|
+
end
|
68
|
+
|
69
|
+
def setup
|
70
|
+
super
|
71
|
+
@content =
|
72
|
+
<<-TXT
|
73
|
+
Test data content.
|
74
|
+
TXT
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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 DocumentServiceTest < Test::Unit::TestCase
|
31
|
+
|
32
|
+
# this test tries to access the depricated document service and retrieves the list of documents.
|
33
|
+
should "get the document list" do
|
34
|
+
|
35
|
+
document_entry_filter = Kaltura::KalturaDocumentEntryFilter.new
|
36
|
+
filter_pager = Kaltura::KalturaFilterPager.new
|
37
|
+
|
38
|
+
document_list = @client.document_service.list(document_entry_filter, filter_pager)
|
39
|
+
assert_not_nil document_list.total_count
|
40
|
+
end
|
41
|
+
end
|
data/test/media/test.mov
ADDED
Binary file
|
data/test/media/test.pdf
ADDED
Binary file
|
data/test/media/test.png
ADDED
Binary file
|
data/test/media/test.swf
ADDED
Binary file
|
data/test/media/test.wmv
ADDED
Binary file
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# ===================================================================================================
|
4
|
+
# _ __ _ _
|
5
|
+
# | |/ /__ _| | |_ _ _ _ _ __ _
|
6
|
+
# | ' </ _` | | _| || | '_/ _` |
|
7
|
+
# |_|\_\__,_|_|\__|\_,_|_| \__,_|
|
8
|
+
#
|
9
|
+
# This file is part of the Kaltura Collaborative Media Suite which allows users
|
10
|
+
# to do with audio, video, and animation what Wiki platfroms allow them to do with
|
11
|
+
# text.
|
12
|
+
#
|
13
|
+
# Copyright (C) 2006-2011 Kaltura Inc.
|
14
|
+
#
|
15
|
+
# This program is free software: you can redistribute it and/or modify
|
16
|
+
# it under the terms of the GNU Affero General Public License as
|
17
|
+
# published by the Free Software Foundation, either version 3 of the
|
18
|
+
# License, or (at your option) any later version.
|
19
|
+
#
|
20
|
+
# This program is distributed in the hope that it will be useful,
|
21
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23
|
+
# GNU Affero General Public License for more details.
|
24
|
+
#
|
25
|
+
# You should have received a copy of the GNU Affero General Public License
|
26
|
+
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
27
|
+
#
|
28
|
+
# @ignore
|
29
|
+
# ===================================================================================================
|
30
|
+
require 'test_helper'
|
31
|
+
require 'uri'
|
32
|
+
|
33
|
+
class MediaServiceTest < Test::Unit::TestCase
|
34
|
+
|
35
|
+
# this test uploads a video file to kaltura and creates a media entry using the uploaded file.
|
36
|
+
should "upload a video file and create a kaltura entry" do
|
37
|
+
|
38
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
39
|
+
media_entry.name = "kaltura_test1"
|
40
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
41
|
+
video_file = File.open("test/media/test.wmv")
|
42
|
+
|
43
|
+
video_token = @client.media_service.upload(video_file)
|
44
|
+
created_entry1 = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
45
|
+
|
46
|
+
assert_not_nil created_entry1.id
|
47
|
+
assert_nil @client.media_service.delete(created_entry1.id)
|
48
|
+
end
|
49
|
+
|
50
|
+
# this test uploads a image file to kaltura and creates a media entry using the uploaded file.
|
51
|
+
should "upload a image file and create a kaltura entry" do
|
52
|
+
|
53
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
54
|
+
media_entry.name = "kaltura_test2"
|
55
|
+
media_entry.media_type = Kaltura::KalturaMediaType::IMAGE
|
56
|
+
video_file = File.open("test/media/test.png")
|
57
|
+
|
58
|
+
video_token = @client.media_service.upload(video_file)
|
59
|
+
created_entry2 = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
60
|
+
|
61
|
+
assert_not_nil created_entry2.id
|
62
|
+
assert_nil @client.media_service.delete(created_entry2.id)
|
63
|
+
end
|
64
|
+
|
65
|
+
# this test uploads a video file to kaltura reading from a url and creates a media entry using the uploaded file.
|
66
|
+
should "upload a flv file from url and create a kaltura entry" do
|
67
|
+
|
68
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
69
|
+
media_entry.name = "kaltura_test3"
|
70
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
71
|
+
|
72
|
+
created_entry3 = @client.media_service.add_from_url(media_entry, URI.escape("http://www.kaltura.org/kalorg/kaltura-api-clients-generators/trunk/sources/csharp/KalturaClientTester/DemoVideo.flv", Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")))
|
73
|
+
|
74
|
+
assert_not_nil created_entry3.id
|
75
|
+
assert_equal created_entry3.status, Kaltura::KalturaEntryStatus::IMPORT
|
76
|
+
assert_nil @client.media_service.delete(created_entry3.id)
|
77
|
+
end
|
78
|
+
|
79
|
+
# this test creates an entry and ranks it
|
80
|
+
should "set the rank attributes" do
|
81
|
+
|
82
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
83
|
+
media_entry.name = "kaltura_test"
|
84
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
85
|
+
video_file = File.open("test/media/test.wmv")
|
86
|
+
|
87
|
+
video_token = @client.media_service.upload(video_file)
|
88
|
+
created_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
89
|
+
|
90
|
+
assert_not_nil created_entry.id
|
91
|
+
assert_equal created_entry.rank, 0
|
92
|
+
assert_equal created_entry.total_rank, 0
|
93
|
+
assert_equal created_entry.votes, 0
|
94
|
+
|
95
|
+
@client.media_service.anonymous_rank(created_entry.id, 5)
|
96
|
+
created_entry = @client.media_service.get(created_entry.id)
|
97
|
+
|
98
|
+
assert_equal created_entry.rank, 5
|
99
|
+
assert_equal created_entry.total_rank, 5
|
100
|
+
assert_equal created_entry.votes, 1
|
101
|
+
|
102
|
+
@client.media_service.anonymous_rank(created_entry.id, 2)
|
103
|
+
created_entry = @client.media_service.get(created_entry.id)
|
104
|
+
|
105
|
+
assert_equal created_entry.rank, 3.5
|
106
|
+
assert_equal created_entry.total_rank, 7
|
107
|
+
assert_equal created_entry.votes, 2
|
108
|
+
|
109
|
+
assert_nil @client.media_service.delete(created_entry.id)
|
110
|
+
end
|
111
|
+
|
112
|
+
# this test creates an entry and updates the thumbnail of it using a image url
|
113
|
+
should "update the thumbnail from url" do
|
114
|
+
|
115
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
116
|
+
media_entry.name = "kaltura_test"
|
117
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
118
|
+
video_file = File.open("test/media/test.wmv")
|
119
|
+
|
120
|
+
video_token = @client.media_service.upload(video_file)
|
121
|
+
created_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
122
|
+
|
123
|
+
assert_not_nil created_entry.id
|
124
|
+
|
125
|
+
updated_entry = @client.media_service.update_thumbnail_from_url(created_entry.id, "http://corp.kaltura.com/sites/kaltura-website/files/logo_0.png")
|
126
|
+
|
127
|
+
assert_not_nil updated_entry
|
128
|
+
assert_not_nil updated_entry.thumbnail_url
|
129
|
+
assert_not_equal created_entry.thumbnail_url, updated_entry.thumbnail_url
|
130
|
+
|
131
|
+
assert_nil @client.media_service.delete(created_entry.id)
|
132
|
+
end
|
133
|
+
|
134
|
+
# this test tries to create a media entry with invalid token.
|
135
|
+
should "not create a media entry for a invalid token" do
|
136
|
+
|
137
|
+
assert_raise Kaltura::KalturaAPIError do
|
138
|
+
@created_entry = @client.media_service.get("invalid entry id")
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# this test validates the response of a multi request when thre are no requests in the queue
|
143
|
+
should "get empty array for multi request when there are no requests in the queue" do
|
144
|
+
|
145
|
+
@client.start_multirequest
|
146
|
+
|
147
|
+
retVal = @client.do_multirequest
|
148
|
+
|
149
|
+
assert_equal retVal, []
|
150
|
+
end
|
151
|
+
|
152
|
+
# this test starts multirequest couple of times
|
153
|
+
should "not raise any errors for double start multi request" do
|
154
|
+
|
155
|
+
assert_nothing_raised Kaltura::KalturaAPIError do
|
156
|
+
@client.start_multirequest
|
157
|
+
@client.start_multirequest
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# this test calls do_multirequest without stating it.
|
162
|
+
should "get an empty array for the multirequest when it calls without starting it" do
|
163
|
+
|
164
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
165
|
+
media_entry.name = "kaltura_test3"
|
166
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
167
|
+
video_file = File.open("test/media/test.wmv")
|
168
|
+
|
169
|
+
video_token = @client.media_service.upload(video_file)
|
170
|
+
|
171
|
+
ceated_media_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
172
|
+
|
173
|
+
media_entry_filter = Kaltura::KalturaMediaEntryFilter.new
|
174
|
+
media_entry_filter.name_multi_like_or = "kaltura_test3"
|
175
|
+
filter_pager = Kaltura::KalturaFilterPager.new
|
176
|
+
@client.media_service.list(media_entry_filter, filter_pager)
|
177
|
+
|
178
|
+
retVal = @client.do_multirequest
|
179
|
+
|
180
|
+
assert_equal retVal, []
|
181
|
+
|
182
|
+
assert_nil @client.media_service.delete(ceated_media_entry.id)
|
183
|
+
end
|
184
|
+
|
185
|
+
# this test uses multi request to retrieve the media entry list and create a new entry.
|
186
|
+
should "get the media list and create a media entry" do
|
187
|
+
|
188
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
189
|
+
media_entry.name = "kaltura_test3"
|
190
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
191
|
+
video_file = File.open("test/media/test.wmv")
|
192
|
+
|
193
|
+
video_token = @client.media_service.upload(video_file)
|
194
|
+
|
195
|
+
@client.start_multirequest
|
196
|
+
|
197
|
+
@client.media_service.add_from_uploaded_file(media_entry, video_token)
|
198
|
+
|
199
|
+
media_entry_filter = Kaltura::KalturaMediaEntryFilter.new
|
200
|
+
media_entry_filter.name_multi_like_or = "kaltura_test3"
|
201
|
+
filter_pager = Kaltura::KalturaFilterPager.new
|
202
|
+
@client.media_service.list(media_entry_filter, filter_pager)
|
203
|
+
|
204
|
+
retVal = @client.do_multirequest
|
205
|
+
|
206
|
+
assert_instance_of Kaltura::KalturaMediaEntry, retVal[0]
|
207
|
+
assert_instance_of Kaltura::KalturaMediaListResponse, retVal[1]
|
208
|
+
assert_not_nil retVal[0].id
|
209
|
+
assert_not_nil retVal[1].total_count
|
210
|
+
assert_nil @client.media_service.delete(retVal[0].id)
|
211
|
+
end
|
212
|
+
|
213
|
+
# this test retrieves error objects when a action in a multi request fails.
|
214
|
+
should "return error objects for failed actions" do
|
215
|
+
|
216
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
217
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
218
|
+
|
219
|
+
@client.start_multirequest
|
220
|
+
|
221
|
+
@client.media_service.get("invalid entry id")
|
222
|
+
|
223
|
+
media_entry_filter = Kaltura::KalturaMediaEntryFilter.new
|
224
|
+
filter_pager = Kaltura::KalturaFilterPager.new
|
225
|
+
@client.media_service.list(media_entry_filter, filter_pager)
|
226
|
+
|
227
|
+
retVal = @client.do_multirequest
|
228
|
+
|
229
|
+
assert_instance_of Kaltura::KalturaAPIError, retVal[0]
|
230
|
+
assert_instance_of Kaltura::KalturaMediaListResponse, retVal[1]
|
231
|
+
assert_not_nil retVal[1].total_count
|
232
|
+
end
|
233
|
+
|
234
|
+
# this test uses utf8 content in the media entry meta data.
|
235
|
+
should "support UTF content in entry metadata" do
|
236
|
+
|
237
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
238
|
+
media_entry.name = "שלום"
|
239
|
+
media_entry.description = @description
|
240
|
+
|
241
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
242
|
+
video_file = File.open("test/media/test.wmv")
|
243
|
+
|
244
|
+
video_token = @client.media_service.upload(video_file)
|
245
|
+
created_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
246
|
+
|
247
|
+
assert_not_nil created_entry.id
|
248
|
+
|
249
|
+
media_entry = @client.base_entry_service.get(created_entry.id)
|
250
|
+
|
251
|
+
assert_equal media_entry.name, "שלום"
|
252
|
+
assert_equal media_entry.description, @description
|
253
|
+
assert_nil @client.media_service.delete(media_entry.id)
|
254
|
+
end
|
255
|
+
|
256
|
+
# this test resets content in the media entry meta data.
|
257
|
+
should "support setting nil for content in entry metadata" do
|
258
|
+
|
259
|
+
media_entry = Kaltura::KalturaMediaEntry.new
|
260
|
+
media_entry.name = "kaltura_test1"
|
261
|
+
media_entry.description = "kaltura_test1 description"
|
262
|
+
media_entry.media_type = Kaltura::KalturaMediaType::VIDEO
|
263
|
+
video_file = File.open("test/media/test.wmv")
|
264
|
+
|
265
|
+
video_token = @client.media_service.upload(video_file)
|
266
|
+
created_entry = @client.media_service.add_from_uploaded_file(media_entry, video_token)
|
267
|
+
|
268
|
+
assert_not_nil created_entry.id
|
269
|
+
|
270
|
+
media_entry = @client.base_entry_service.get(created_entry.id)
|
271
|
+
|
272
|
+
assert_equal media_entry.name, "kaltura_test1"
|
273
|
+
assert_equal media_entry.description, "kaltura_test1 description"
|
274
|
+
|
275
|
+
# update the desc with value
|
276
|
+
media_entry = Kaltura::KalturaBaseEntry.new
|
277
|
+
media_entry.name = "kaltura_test1 updated"
|
278
|
+
media_entry.description = nil
|
279
|
+
media_entry_updated = @client.base_entry_service.update(created_entry.id, media_entry)
|
280
|
+
|
281
|
+
assert_equal media_entry_updated.description, nil
|
282
|
+
|
283
|
+
assert_nil @client.media_service.delete(media_entry_updated.id)
|
284
|
+
end
|
285
|
+
|
286
|
+
def setup
|
287
|
+
super
|
288
|
+
@description=
|
289
|
+
<<-DESC
|
290
|
+
שלום עולם
|
291
|
+
DESC
|
292
|
+
end
|
293
|
+
|
294
|
+
end
|