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,108 @@
|
|
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_cue_point_client_plugin.rb'
|
30
|
+
|
31
|
+
module Kaltura
|
32
|
+
|
33
|
+
class KalturaAdCuePointOrderBy
|
34
|
+
CREATED_AT_ASC = "+createdAt"
|
35
|
+
DURATION_ASC = "+duration"
|
36
|
+
END_TIME_ASC = "+endTime"
|
37
|
+
PARTNER_SORT_VALUE_ASC = "+partnerSortValue"
|
38
|
+
START_TIME_ASC = "+startTime"
|
39
|
+
UPDATED_AT_ASC = "+updatedAt"
|
40
|
+
CREATED_AT_DESC = "-createdAt"
|
41
|
+
DURATION_DESC = "-duration"
|
42
|
+
END_TIME_DESC = "-endTime"
|
43
|
+
PARTNER_SORT_VALUE_DESC = "-partnerSortValue"
|
44
|
+
START_TIME_DESC = "-startTime"
|
45
|
+
UPDATED_AT_DESC = "-updatedAt"
|
46
|
+
end
|
47
|
+
|
48
|
+
class KalturaAdProtocolType
|
49
|
+
CUSTOM = "0"
|
50
|
+
VAST = "1"
|
51
|
+
VAST_2_0 = "2"
|
52
|
+
VPAID = "3"
|
53
|
+
end
|
54
|
+
|
55
|
+
class KalturaAdType
|
56
|
+
VIDEO = "1"
|
57
|
+
OVERLAY = "2"
|
58
|
+
end
|
59
|
+
|
60
|
+
class KalturaAdCuePoint < KalturaCuePoint
|
61
|
+
attr_accessor :protocol_type
|
62
|
+
attr_accessor :source_url
|
63
|
+
attr_accessor :ad_type
|
64
|
+
attr_accessor :title
|
65
|
+
attr_accessor :end_time
|
66
|
+
# Duration in milliseconds
|
67
|
+
#
|
68
|
+
attr_accessor :duration
|
69
|
+
|
70
|
+
def end_time=(val)
|
71
|
+
@end_time = val.to_i
|
72
|
+
end
|
73
|
+
def duration=(val)
|
74
|
+
@duration = val.to_i
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class KalturaAdCuePointBaseFilter < KalturaCuePointFilter
|
79
|
+
attr_accessor :protocol_type_equal
|
80
|
+
attr_accessor :protocol_type_in
|
81
|
+
attr_accessor :title_like
|
82
|
+
attr_accessor :title_multi_like_or
|
83
|
+
attr_accessor :title_multi_like_and
|
84
|
+
attr_accessor :end_time_greater_than_or_equal
|
85
|
+
attr_accessor :end_time_less_than_or_equal
|
86
|
+
attr_accessor :duration_greater_than_or_equal
|
87
|
+
attr_accessor :duration_less_than_or_equal
|
88
|
+
|
89
|
+
def end_time_greater_than_or_equal=(val)
|
90
|
+
@end_time_greater_than_or_equal = val.to_i
|
91
|
+
end
|
92
|
+
def end_time_less_than_or_equal=(val)
|
93
|
+
@end_time_less_than_or_equal = val.to_i
|
94
|
+
end
|
95
|
+
def duration_greater_than_or_equal=(val)
|
96
|
+
@duration_greater_than_or_equal = val.to_i
|
97
|
+
end
|
98
|
+
def duration_less_than_or_equal=(val)
|
99
|
+
@duration_less_than_or_equal = val.to_i
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class KalturaAdCuePointFilter < KalturaAdCuePointBaseFilter
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,237 @@
|
|
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_cue_point_client_plugin.rb'
|
30
|
+
|
31
|
+
module Kaltura
|
32
|
+
|
33
|
+
class KalturaAnnotationOrderBy
|
34
|
+
CREATED_AT_ASC = "+createdAt"
|
35
|
+
DURATION_ASC = "+duration"
|
36
|
+
END_TIME_ASC = "+endTime"
|
37
|
+
PARTNER_SORT_VALUE_ASC = "+partnerSortValue"
|
38
|
+
START_TIME_ASC = "+startTime"
|
39
|
+
UPDATED_AT_ASC = "+updatedAt"
|
40
|
+
CREATED_AT_DESC = "-createdAt"
|
41
|
+
DURATION_DESC = "-duration"
|
42
|
+
END_TIME_DESC = "-endTime"
|
43
|
+
PARTNER_SORT_VALUE_DESC = "-partnerSortValue"
|
44
|
+
START_TIME_DESC = "-startTime"
|
45
|
+
UPDATED_AT_DESC = "-updatedAt"
|
46
|
+
end
|
47
|
+
|
48
|
+
class KalturaAnnotation < KalturaCuePoint
|
49
|
+
attr_accessor :parent_id
|
50
|
+
attr_accessor :text
|
51
|
+
# End time in milliseconds
|
52
|
+
#
|
53
|
+
attr_accessor :end_time
|
54
|
+
# Duration in milliseconds
|
55
|
+
#
|
56
|
+
attr_accessor :duration
|
57
|
+
# Depth in the tree
|
58
|
+
#
|
59
|
+
attr_accessor :depth
|
60
|
+
# Number of all descendants
|
61
|
+
#
|
62
|
+
attr_accessor :children_count
|
63
|
+
# Number of children, first generation only.
|
64
|
+
#
|
65
|
+
attr_accessor :direct_children_count
|
66
|
+
|
67
|
+
def end_time=(val)
|
68
|
+
@end_time = val.to_i
|
69
|
+
end
|
70
|
+
def duration=(val)
|
71
|
+
@duration = val.to_i
|
72
|
+
end
|
73
|
+
def depth=(val)
|
74
|
+
@depth = val.to_i
|
75
|
+
end
|
76
|
+
def children_count=(val)
|
77
|
+
@children_count = val.to_i
|
78
|
+
end
|
79
|
+
def direct_children_count=(val)
|
80
|
+
@direct_children_count = val.to_i
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class KalturaAnnotationListResponse < KalturaObjectBase
|
85
|
+
attr_accessor :objects
|
86
|
+
attr_accessor :total_count
|
87
|
+
|
88
|
+
def total_count=(val)
|
89
|
+
@total_count = val.to_i
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
class KalturaAnnotationBaseFilter < KalturaCuePointFilter
|
94
|
+
attr_accessor :parent_id_equal
|
95
|
+
attr_accessor :parent_id_in
|
96
|
+
attr_accessor :text_like
|
97
|
+
attr_accessor :text_multi_like_or
|
98
|
+
attr_accessor :text_multi_like_and
|
99
|
+
attr_accessor :end_time_greater_than_or_equal
|
100
|
+
attr_accessor :end_time_less_than_or_equal
|
101
|
+
attr_accessor :duration_greater_than_or_equal
|
102
|
+
attr_accessor :duration_less_than_or_equal
|
103
|
+
|
104
|
+
def end_time_greater_than_or_equal=(val)
|
105
|
+
@end_time_greater_than_or_equal = val.to_i
|
106
|
+
end
|
107
|
+
def end_time_less_than_or_equal=(val)
|
108
|
+
@end_time_less_than_or_equal = val.to_i
|
109
|
+
end
|
110
|
+
def duration_greater_than_or_equal=(val)
|
111
|
+
@duration_greater_than_or_equal = val.to_i
|
112
|
+
end
|
113
|
+
def duration_less_than_or_equal=(val)
|
114
|
+
@duration_less_than_or_equal = val.to_i
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class KalturaAnnotationFilter < KalturaAnnotationBaseFilter
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
# Annotation service - Video Annotation
|
124
|
+
#
|
125
|
+
class KalturaAnnotationService < KalturaServiceBase
|
126
|
+
def initialize(client)
|
127
|
+
super(client)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Allows you to add an annotation object associated with an entry
|
131
|
+
#
|
132
|
+
def add(annotation)
|
133
|
+
kparams = {}
|
134
|
+
client.add_param(kparams, 'annotation', annotation);
|
135
|
+
client.queue_service_action_call('annotation_annotation', 'add', kparams);
|
136
|
+
if (client.is_multirequest)
|
137
|
+
return nil;
|
138
|
+
end
|
139
|
+
return client.do_queue();
|
140
|
+
end
|
141
|
+
|
142
|
+
# Update annotation by id
|
143
|
+
#
|
144
|
+
def update(id, annotation)
|
145
|
+
kparams = {}
|
146
|
+
client.add_param(kparams, 'id', id);
|
147
|
+
client.add_param(kparams, 'annotation', annotation);
|
148
|
+
client.queue_service_action_call('annotation_annotation', 'update', kparams);
|
149
|
+
if (client.is_multirequest)
|
150
|
+
return nil;
|
151
|
+
end
|
152
|
+
return client.do_queue();
|
153
|
+
end
|
154
|
+
|
155
|
+
# List annotation objects by filter and pager
|
156
|
+
#
|
157
|
+
def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
|
158
|
+
kparams = {}
|
159
|
+
client.add_param(kparams, 'filter', filter);
|
160
|
+
client.add_param(kparams, 'pager', pager);
|
161
|
+
client.queue_service_action_call('annotation_annotation', 'list', kparams);
|
162
|
+
if (client.is_multirequest)
|
163
|
+
return nil;
|
164
|
+
end
|
165
|
+
return client.do_queue();
|
166
|
+
end
|
167
|
+
|
168
|
+
# Allows you to add multiple cue points objects by uploading XML that contains multiple cue point definitions
|
169
|
+
#
|
170
|
+
def add_from_bulk(file_data)
|
171
|
+
kparams = {}
|
172
|
+
client.add_param(kparams, 'fileData', file_data);
|
173
|
+
client.queue_service_action_call('annotation_annotation', 'addFromBulk', kparams);
|
174
|
+
if (client.is_multirequest)
|
175
|
+
return nil;
|
176
|
+
end
|
177
|
+
return client.do_queue();
|
178
|
+
end
|
179
|
+
|
180
|
+
# Download multiple cue points objects as XML definitions
|
181
|
+
#
|
182
|
+
def serve_bulk(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
|
183
|
+
kparams = {}
|
184
|
+
client.add_param(kparams, 'filter', filter);
|
185
|
+
client.add_param(kparams, 'pager', pager);
|
186
|
+
client.queue_service_action_call('annotation_annotation', 'serveBulk', kparams);
|
187
|
+
return client.get_serve_url();
|
188
|
+
end
|
189
|
+
|
190
|
+
# Retrieve an CuePoint object by id
|
191
|
+
#
|
192
|
+
def get(id)
|
193
|
+
kparams = {}
|
194
|
+
client.add_param(kparams, 'id', id);
|
195
|
+
client.queue_service_action_call('annotation_annotation', 'get', kparams);
|
196
|
+
if (client.is_multirequest)
|
197
|
+
return nil;
|
198
|
+
end
|
199
|
+
return client.do_queue();
|
200
|
+
end
|
201
|
+
|
202
|
+
# count cue point objects by filter
|
203
|
+
#
|
204
|
+
def count(filter=KalturaNotImplemented)
|
205
|
+
kparams = {}
|
206
|
+
client.add_param(kparams, 'filter', filter);
|
207
|
+
client.queue_service_action_call('annotation_annotation', 'count', kparams);
|
208
|
+
if (client.is_multirequest)
|
209
|
+
return nil;
|
210
|
+
end
|
211
|
+
return client.do_queue();
|
212
|
+
end
|
213
|
+
|
214
|
+
# delete cue point by id, and delete all children cue points
|
215
|
+
#
|
216
|
+
def delete(id)
|
217
|
+
kparams = {}
|
218
|
+
client.add_param(kparams, 'id', id);
|
219
|
+
client.queue_service_action_call('annotation_annotation', 'delete', kparams);
|
220
|
+
if (client.is_multirequest)
|
221
|
+
return nil;
|
222
|
+
end
|
223
|
+
return client.do_queue();
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class KalturaClient < KalturaClientBase
|
228
|
+
attr_reader :annotation_service
|
229
|
+
def annotation_service
|
230
|
+
if (@annotation_service == nil)
|
231
|
+
@annotation_service = KalturaAnnotationService.new(self)
|
232
|
+
end
|
233
|
+
return @annotation_service
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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
|
+
|
30
|
+
module Kaltura
|
31
|
+
|
32
|
+
|
33
|
+
# Aspera service
|
34
|
+
#
|
35
|
+
class KalturaAsperaService < KalturaServiceBase
|
36
|
+
def initialize(client)
|
37
|
+
super(client)
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_fasp_url(flavor_asset_id)
|
41
|
+
kparams = {}
|
42
|
+
client.add_param(kparams, 'flavorAssetId', flavor_asset_id);
|
43
|
+
client.queue_service_action_call('aspera_aspera', 'getFaspUrl', kparams);
|
44
|
+
if (client.is_multirequest)
|
45
|
+
return nil;
|
46
|
+
end
|
47
|
+
return client.do_queue();
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class KalturaClient < KalturaClientBase
|
52
|
+
attr_reader :aspera_service
|
53
|
+
def aspera_service
|
54
|
+
if (@aspera_service == nil)
|
55
|
+
@aspera_service = KalturaAsperaService.new(self)
|
56
|
+
end
|
57
|
+
return @aspera_service
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,227 @@
|
|
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
|
+
|
30
|
+
module Kaltura
|
31
|
+
|
32
|
+
class KalturaAttachmentAssetStatus
|
33
|
+
ERROR = -1
|
34
|
+
QUEUED = 0
|
35
|
+
READY = 2
|
36
|
+
DELETED = 3
|
37
|
+
IMPORTING = 7
|
38
|
+
EXPORTING = 9
|
39
|
+
end
|
40
|
+
|
41
|
+
class KalturaAttachmentAssetOrderBy
|
42
|
+
CREATED_AT_ASC = "+createdAt"
|
43
|
+
DELETED_AT_ASC = "+deletedAt"
|
44
|
+
SIZE_ASC = "+size"
|
45
|
+
UPDATED_AT_ASC = "+updatedAt"
|
46
|
+
CREATED_AT_DESC = "-createdAt"
|
47
|
+
DELETED_AT_DESC = "-deletedAt"
|
48
|
+
SIZE_DESC = "-size"
|
49
|
+
UPDATED_AT_DESC = "-updatedAt"
|
50
|
+
end
|
51
|
+
|
52
|
+
class KalturaAttachmentType
|
53
|
+
TEXT = "1"
|
54
|
+
MEDIA = "2"
|
55
|
+
DOCUMENT = "3"
|
56
|
+
end
|
57
|
+
|
58
|
+
class KalturaAttachmentAsset < KalturaAsset
|
59
|
+
# The filename of the attachment asset content
|
60
|
+
#
|
61
|
+
attr_accessor :filename
|
62
|
+
# Attachment asset title
|
63
|
+
#
|
64
|
+
attr_accessor :title
|
65
|
+
# The attachment format
|
66
|
+
#
|
67
|
+
attr_accessor :format
|
68
|
+
# The status of the asset
|
69
|
+
#
|
70
|
+
attr_accessor :status
|
71
|
+
|
72
|
+
def status=(val)
|
73
|
+
@status = val.to_i
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class KalturaAttachmentAssetListResponse < KalturaObjectBase
|
78
|
+
attr_accessor :objects
|
79
|
+
attr_accessor :total_count
|
80
|
+
|
81
|
+
def total_count=(val)
|
82
|
+
@total_count = val.to_i
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class KalturaAttachmentAssetBaseFilter < KalturaAssetFilter
|
87
|
+
attr_accessor :format_equal
|
88
|
+
attr_accessor :format_in
|
89
|
+
attr_accessor :status_equal
|
90
|
+
attr_accessor :status_in
|
91
|
+
attr_accessor :status_not_in
|
92
|
+
|
93
|
+
def status_equal=(val)
|
94
|
+
@status_equal = val.to_i
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class KalturaAttachmentAssetFilter < KalturaAttachmentAssetBaseFilter
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
# Retrieve information and invoke actions on attachment Asset
|
104
|
+
#
|
105
|
+
class KalturaAttachmentAssetService < KalturaServiceBase
|
106
|
+
def initialize(client)
|
107
|
+
super(client)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Add attachment asset
|
111
|
+
#
|
112
|
+
def add(entry_id, attachment_asset)
|
113
|
+
kparams = {}
|
114
|
+
client.add_param(kparams, 'entryId', entry_id);
|
115
|
+
client.add_param(kparams, 'attachmentAsset', attachment_asset);
|
116
|
+
client.queue_service_action_call('attachment_attachmentasset', 'add', kparams);
|
117
|
+
if (client.is_multirequest)
|
118
|
+
return nil;
|
119
|
+
end
|
120
|
+
return client.do_queue();
|
121
|
+
end
|
122
|
+
|
123
|
+
# Update content of attachment asset
|
124
|
+
#
|
125
|
+
def set_content(id, content_resource)
|
126
|
+
kparams = {}
|
127
|
+
client.add_param(kparams, 'id', id);
|
128
|
+
client.add_param(kparams, 'contentResource', content_resource);
|
129
|
+
client.queue_service_action_call('attachment_attachmentasset', 'setContent', kparams);
|
130
|
+
if (client.is_multirequest)
|
131
|
+
return nil;
|
132
|
+
end
|
133
|
+
return client.do_queue();
|
134
|
+
end
|
135
|
+
|
136
|
+
# Update attachment asset
|
137
|
+
#
|
138
|
+
def update(id, attachment_asset)
|
139
|
+
kparams = {}
|
140
|
+
client.add_param(kparams, 'id', id);
|
141
|
+
client.add_param(kparams, 'attachmentAsset', attachment_asset);
|
142
|
+
client.queue_service_action_call('attachment_attachmentasset', 'update', kparams);
|
143
|
+
if (client.is_multirequest)
|
144
|
+
return nil;
|
145
|
+
end
|
146
|
+
return client.do_queue();
|
147
|
+
end
|
148
|
+
|
149
|
+
# Get download URL for the asset
|
150
|
+
#
|
151
|
+
def get_url(id, storage_id=KalturaNotImplemented)
|
152
|
+
kparams = {}
|
153
|
+
client.add_param(kparams, 'id', id);
|
154
|
+
client.add_param(kparams, 'storageId', storage_id);
|
155
|
+
client.queue_service_action_call('attachment_attachmentasset', 'getUrl', kparams);
|
156
|
+
if (client.is_multirequest)
|
157
|
+
return nil;
|
158
|
+
end
|
159
|
+
return client.do_queue();
|
160
|
+
end
|
161
|
+
|
162
|
+
# Get remote storage existing paths for the asset
|
163
|
+
#
|
164
|
+
def get_remote_paths(id)
|
165
|
+
kparams = {}
|
166
|
+
client.add_param(kparams, 'id', id);
|
167
|
+
client.queue_service_action_call('attachment_attachmentasset', 'getRemotePaths', kparams);
|
168
|
+
if (client.is_multirequest)
|
169
|
+
return nil;
|
170
|
+
end
|
171
|
+
return client.do_queue();
|
172
|
+
end
|
173
|
+
|
174
|
+
# Serves attachment by its id
|
175
|
+
#
|
176
|
+
def serve(attachment_asset_id)
|
177
|
+
kparams = {}
|
178
|
+
client.add_param(kparams, 'attachmentAssetId', attachment_asset_id);
|
179
|
+
client.queue_service_action_call('attachment_attachmentasset', 'serve', kparams);
|
180
|
+
return client.get_serve_url();
|
181
|
+
end
|
182
|
+
|
183
|
+
def get(attachment_asset_id)
|
184
|
+
kparams = {}
|
185
|
+
client.add_param(kparams, 'attachmentAssetId', attachment_asset_id);
|
186
|
+
client.queue_service_action_call('attachment_attachmentasset', 'get', kparams);
|
187
|
+
if (client.is_multirequest)
|
188
|
+
return nil;
|
189
|
+
end
|
190
|
+
return client.do_queue();
|
191
|
+
end
|
192
|
+
|
193
|
+
# List attachment Assets by filter and pager
|
194
|
+
#
|
195
|
+
def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
|
196
|
+
kparams = {}
|
197
|
+
client.add_param(kparams, 'filter', filter);
|
198
|
+
client.add_param(kparams, 'pager', pager);
|
199
|
+
client.queue_service_action_call('attachment_attachmentasset', 'list', kparams);
|
200
|
+
if (client.is_multirequest)
|
201
|
+
return nil;
|
202
|
+
end
|
203
|
+
return client.do_queue();
|
204
|
+
end
|
205
|
+
|
206
|
+
def delete(attachment_asset_id)
|
207
|
+
kparams = {}
|
208
|
+
client.add_param(kparams, 'attachmentAssetId', attachment_asset_id);
|
209
|
+
client.queue_service_action_call('attachment_attachmentasset', 'delete', kparams);
|
210
|
+
if (client.is_multirequest)
|
211
|
+
return nil;
|
212
|
+
end
|
213
|
+
return client.do_queue();
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
class KalturaClient < KalturaClientBase
|
218
|
+
attr_reader :attachment_asset_service
|
219
|
+
def attachment_asset_service
|
220
|
+
if (@attachment_asset_service == nil)
|
221
|
+
@attachment_asset_service = KalturaAttachmentAssetService.new(self)
|
222
|
+
end
|
223
|
+
return @attachment_asset_service
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|