velir_kaltura-ruby 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,8 +10,8 @@ begin
10
10
  gem.email = "patrick.robertson@velir.com"
11
11
  gem.homepage = "http://github.com/Velir/kaltura-ruby"
12
12
  gem.authors = ["Patrick Robertson"]
13
- gem.add_dependency('activesupport', '<=2.3.8')
14
- gem.add_dependency('activeresource','<=2.3.8')
13
+ gem.add_dependency('activesupport', '>=2.3.8')
14
+ gem.add_dependency('activeresource','>=2.3.8')
15
15
  gem.add_dependency('json')
16
16
  gem.add_dependency('rest-client', '>= 1.5.1')
17
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 5
4
+ :patch: 6
5
5
  :build:
@@ -628,8 +628,16 @@ module Kaltura
628
628
 
629
629
  end
630
630
 
631
+ ##
632
+ # The LiveStreamAdminEntry object is what the LiveStreamService utilizes to create streams.
633
+ #
634
+ # It is important to note that the fields media_type, and the encoding fields are necessary
635
+ # to create a LiveStream on the Kaltura server.
636
+ ##
631
637
  class LiveStreamAdminEntry < LiveStreamEntry
638
+ # This field is required to create a new LiveStream on the Kaltura server.
632
639
  attr_accessor :encoding_ip1
640
+ # This field is required to create a new LiveStream on the Kaltura server.
633
641
  attr_accessor :encoding_ip2
634
642
  attr_accessor :stream_password
635
643
  attr_accessor :stream_username
@@ -1,19 +1,74 @@
1
1
  module Kaltura
2
2
  module Service
3
+ ##
4
+ # AccessControlService is responsible for adding and managing access control profiles.
5
+ #
6
+ # @example Add a new access control profile:
7
+ # access_control = Kaltura::AccessControl.new
8
+ # access_control.name = "Restrictions"
9
+ # client.access_control_service.add(access_control)
10
+ #
11
+ # @example Retrive an access control profile:
12
+ # client.access_control_service.get(5)
13
+ #
14
+ # @example Update an existing access control profile:
15
+ # new_access_control = Kaltura::AccessControl.new
16
+ # new_access_control.description = "making the world safer one profile at a time."
17
+ # client.access_control_service.update(5,new_access_control)
18
+ #
19
+ # @example Delete an eisting access control profile:
20
+ # client.access_control_service.delete(5)
21
+ #
22
+ # @example List up to 10 Access Control Profiles ordered by name:
23
+ # filter = Kaltura::Filter::AccessControlFilter.new
24
+ # filter.order_by('name')
25
+ # pager = Kaltura::FilterPager.new
26
+ # pager.page_size = 10
27
+ # client.access_control_service.list(filter,pager)
28
+ ##
3
29
  class AccessControlService < BaseService
4
-
30
+
31
+ ##
32
+ # Adds a new Access Control Profile.
33
+ #
34
+ # @param [Kaltura::AccessControl] access_control The new profile to add.
35
+ #
36
+ # @return [Kaltura::AccessControl] Returns the AccessControl object if the action was successful. Useful for knowing the id of the object.
37
+ #
38
+ # @raise [Kaltura::APIError] default Kaltura error messages.
39
+ ##
5
40
  def add(access_control)
6
41
  kparams = {}
7
42
  client.add_param(kparams, 'accessControl', access_control)
8
43
  perform_request('accessControl','add',kparams,false)
9
44
  end
10
-
45
+
46
+ ##
47
+ # Retrieves an Access Control Profile by ID.
48
+ #
49
+ # @param [Integer] id The Access Control Profile ID.
50
+ #
51
+ # @return [Kaltura::AccessControl] Returns the AccessControl object if the action was successful.
52
+ #
53
+ # @raise [Kaltura::APIError] default Kaltura error messages.
54
+ ##
11
55
  def get(id)
12
56
  kparams = {}
13
57
  client.add_param(kparams, 'id', id)
14
58
  perform_request('accessControl','get',kparams,false)
15
59
  end
16
60
 
61
+ ##
62
+ # Updates an Access Control Profile by ID. Like other API update service calls, you instantiate a new AccessControl object,
63
+ # perform your changes to the new object, and use that as the second parameter. There are no required parameters.
64
+ #
65
+ # @param [Integer] id The Access Control Profile ID.
66
+ # @param [Kaltura::AccessControl] access_control A newly instantiated AccessControl object that has the only the attributes you want to edit.
67
+ #
68
+ # @return [Kaltura:AccessControl] Returns the updated Access Control profile if the action was successful.
69
+ #
70
+ # @raise [Kaltura::APIError] default Kaltura error messages.
71
+ ##
17
72
  def update(id, access_control)
18
73
  kparams = {}
19
74
  client.add_param(kparams, 'id', id)
@@ -21,12 +76,29 @@ module Kaltura
21
76
  perform_request('accessControl','update',kparams,false)
22
77
  end
23
78
 
79
+ ##
80
+ # Deletes an Access Control Profile by ID.
81
+ #
82
+ # @param [Integer] id The Access Control Profile ID.
83
+ #
84
+ # @return [nil] returns nothing
85
+ #
86
+ # @raise [Kaltura::APIError] default Kaltura error messages.
87
+ ##
24
88
  def delete(id)
25
89
  kparams = {}
26
90
  client.add_param(kparams, 'id', id)
27
91
  perform_request('accessControl','delete',kparams,false)
28
92
  end
29
-
93
+
94
+ ##
95
+ # Lists Access Control Profiles given an optional filter and pager.
96
+ #
97
+ # @param [Kaltura::Filter::AccessControlFilter] filter
98
+ # @param [Kaltura::FilterPager] pager
99
+ #
100
+ # @return [Kaltura::Response::AccessControlListResponse] Returns an equivalent response to Kaltura::BaseResponse.
101
+ ##
30
102
  def list(filter=nil, pager=nil)
31
103
  kparams = {}
32
104
  client.add_param(kparams, 'filter', filter)
@@ -1,7 +1,29 @@
1
1
  module Kaltura
2
2
  module Service
3
+ ##
4
+ # AdminUserService manages details for the administrative KMC user.
5
+ #
6
+ # @example Setting a new Admin password:
7
+ # client.admin_user_service.update_password('pat@velir.com','OMGWTFPASSWRD',,'PASSWRDBBQ')
8
+ # @example Setting a new Admin password/email:
9
+ # client.admin_user_service.update_password('pat@velir.com','OMGWTFPASSWRD','patrick@velir.com','PASSWRDBBQ')
10
+ # @example Resetting a admins password:
11
+ # client.admin_user_service.reset_password('pat@velir.com')
12
+ ##
3
13
  class AdminUserService < BaseService
4
-
14
+
15
+ ##
16
+ # Updates the admin password and email.
17
+ #
18
+ # @param [String] email Administrative user email.
19
+ # @param [String] password Current administrative user password.
20
+ # @param [String] new_email
21
+ #
22
+ # @return [Kaltura::AdminUser] The administrative user updated.
23
+ #
24
+ # @raise [Kaltura::APIError] Returns two additional error messages: INVALID_FIELD_VALUE when a field isn't valid
25
+ # and ADMIN_KUSER_WRONG_OLD_PASSWORD when the old password is wrong.
26
+ ##
5
27
  def update_password(email, password, new_email='', new_password='')
6
28
  kparams = {}
7
29
  client.add_param(kparams, 'email', email)
@@ -11,12 +33,31 @@ module Kaltura
11
33
  perform_request('adminUser','updatePassword',kparams,false)
12
34
  end
13
35
 
36
+ ##
37
+ # Resets admins user password and sends the new one to the admins' email address.
38
+ #
39
+ # @param [String] email The admin's email address.
40
+ #
41
+ # @return [nil] returns nil.
42
+ #
43
+ # @raise [Kaltura::APIError] raises default Kaltura errors.
44
+ ##
14
45
  def reset_password(email)
15
46
  kparams = {}
16
47
  client.add_param(kparams, 'email', email)
17
48
  perform_request('adminUser','resetPassword',kparams,false)
18
49
  end
19
-
50
+
51
+ ##
52
+ # Gets an admin session using the admin email and password. This method is used for the KMC login.
53
+ #
54
+ # @param [String] email The admin's email address.
55
+ # @param [String] password The admin's password.
56
+ #
57
+ # @return [String] User session string.
58
+ #
59
+ # @raise [Kaltura::APIError] raises default Kaltura errors in addition to ADMIN_KUSER_NOT_FOUND if the user isn't found.
60
+ ##
20
61
  def login(email, password)
21
62
  kparams = {}
22
63
  client.add_param(kparams, 'email', email)
@@ -1,7 +1,50 @@
1
1
  module Kaltura
2
2
  module Service
3
+ ##
4
+ # BaseEntryService is a service for generic entries. If you do not know what type of media you are working with,
5
+ # this is a good service to use. You need to know what media type you are working with for MediaService.
6
+ #
7
+ # @example Retrieve a base entry:
8
+ # client.base_entry_service.get('1_qua324a')
9
+ #
10
+ # @example Upload a new entry:
11
+ # upload_file = File.open("/path/to/media_file")
12
+ # upload_token = client.base_entry_service.upload(upload_file)
13
+ # base_entry = Kaltura::BaseEntry.new
14
+ # base_entry.name = "WAFFLES ARE MY FRIEND"
15
+ # client.base_entry_service.add_from_uploaded_file(base_entry,upload_token)
16
+ #
17
+ # @example Update an existing entry:
18
+ # update_entry = Kaltura::BaseEntry.new
19
+ # update_entry.description = "Pancakes are lame yo."
20
+ # client.base_entry_service.update('1_qua324a',update_entry)
21
+ #
22
+ # @example Delete an existing entry:
23
+ # client.base_entry_service.delete('1_qua324a')
24
+ #
25
+ # @example Update an Entry thumbnail via file upload:
26
+ # thumbnail_file = File.open('/path/to/thumbnail_file')
27
+ # client.base_entry_service.update_thumbnail_from_jpeg('1_qua324a',thumbnail_file)
28
+ #
29
+ # @example Update an entry thumbnail from a url:
30
+ # client.base_entry_service.update_thumbnail_from_url('1_qua324a','http://twitter.com/waffles/waffletastic.jpg')
31
+ #
32
+ # @example Update an entry thumbnail from another entry:
33
+ # client.base_entry_service.update_thumbnail_from_source_entry('1_qua324a','0_k24aj1b',5)
34
+ ##
3
35
  class BaseEntryService < BaseService
4
-
36
+
37
+ ##
38
+ # Generic add entry using an uploaded file, should be used when the uploaded entry type is not known.
39
+ #
40
+ # @param [Kaltura::BaseEntry] entry A newly instantiated BaseEntry object filled in with appropriate fields.
41
+ # @param [String] upload_token_id The upload token from the upload() method.
42
+ # @param [Kaltura::Constants::Entry::Type] type The type of entry. This should be defaulted. Otherwise use the MediaService.
43
+ #
44
+ # @return [Kaltura::BaseEntry] Returns a Kaltura Entry. This is helpful to retrieve the entry_id.
45
+ #
46
+ # @raise [Kaltura::APIError] Default Kaltura errors.
47
+ ##
5
48
  def add_from_uploaded_file(entry, upload_token_id, type=-1)
6
49
  kparams = {}
7
50
  client.add_param(kparams, 'entry', entry)
@@ -10,65 +53,168 @@ module Kaltura
10
53
  perform_request('baseEntry','addFromUploadedFile',kparams,false)
11
54
  end
12
55
 
56
+ ##
57
+ # Gets a base entry by ID.
58
+ #
59
+ # @param [String] entry_id Kaltura entry.
60
+ # @param [Integer] version Version of the entry.
61
+ #
62
+ # @return [Kaltura::BaseEntry] The requested Entry.
63
+ #
64
+ # @raise [Kaltura::APIError] Default Kaltura errors.
65
+ ##
13
66
  def get(entry_id, version=-1)
14
67
  kparams = {}
15
68
  client.add_param(kparams, 'entryId', entry_id)
16
69
  client.add_param(kparams, 'version', version)
17
70
  perform_request('baseEntry','get',kparams,false)
18
71
  end
19
-
72
+
73
+ ##
74
+ # Updates a base entry. It is best to instantiate a new base entry for the second parameter and initilize
75
+ # those fields for the changes you want to change instead of using an existing entry object.
76
+ #
77
+ # @param [String] entry_id The Kaltura entry to be updated.
78
+ # @param [Kaltura::BaseEntry] base_entry A BaseEntry object with fields populated that you wish to change.
79
+ #
80
+ # @return [Kaltura::BaseEntry] Returns the Entry defined by entry_id with the updated fields.
81
+ #
82
+ # @raise [Kaltura::APIError] raises "ENTRY_ID_NOT_FOUND" if the entry_id isn't found in addition to default errors.
83
+ ##
20
84
  def update(entry_id, base_entry)
21
85
  kparams = {}
22
86
  client.add_param(kparams, 'entryId', entry_id)
23
87
  client.add_param(kparams, 'baseEntry', base_entry)
24
88
  perform_request('baseEntry','update',kparams,false)
25
89
  end
26
-
90
+
91
+ ##
92
+ # Retrieves an array of BaseEntries when provided a comma seperated list of entry_id's.
93
+ #
94
+ # @param [String] entry_ids A comma delimited list of Kaltura entry_id's.
95
+ #
96
+ # @return [Array] Returns an array of Entries, based upon their format.
97
+ #
98
+ # @raise [Kaltura::APIError] Default Kaltura errors.
99
+ ##
27
100
  def get_by_ids(entry_ids)
28
101
  kparams = {}
29
102
  client.add_param(kparams, 'entryIds', entry_ids)
30
103
  perform_request('baseEntry','getByIds',kparams,false)
31
104
  end
32
105
 
106
+ ##
107
+ # Deletes the specified Kaltura Entry.
108
+ #
109
+ # @param [String] entry_id The Kaltura entry to be deleted.
110
+ #
111
+ # @return [nil] Returns nothing.
112
+ #
113
+ # @raise [Kaltura::APIError] Default Kaltura errors.
114
+ ##
33
115
  def delete(entry_id)
34
116
  kparams = {}
35
117
  client.add_param(kparams, 'entryId', entry_id)
36
118
  perform_request('baseEntry','delete',kparams,false)
37
119
  end
38
-
120
+
121
+ ##
122
+ # Lists base entries by the filter with paging support.
123
+ #
124
+ # @param [Kaltura::Filter::BaseEntryFilter] filter
125
+ # @param [Kaltura::FilterPager] pager
126
+ #
127
+ # @return [Kaltura::Response::BaseEntryListResponse] wrapper for Kaltura::Response::BaseResponse.
128
+ #
129
+ # @raise [Kaltura::APIError] Default Kaltura errors.
130
+ ##
39
131
  def list(filter=nil, pager=nil)
40
132
  kparams = {}
41
133
  client.add_param(kparams, 'filter', filter)
42
134
  client.add_param(kparams, 'pager', pager)
43
135
  perform_request('baseEntry','list',kparams,false)
44
136
  end
45
-
137
+
138
+ ##
139
+ # Returns a count based on a specified base entry filter.
140
+ #
141
+ # @param [Kaltura::Filter::BaseEntryFilter] filter
142
+ #
143
+ # @return [Integer] Number of base entries within the filter.
144
+ #
145
+ # @raise [Kaltura::APIError] Default Kaltura errors.
146
+ ##
46
147
  def count(filter=nil)
47
148
  kparams = {}
48
149
  client.add_param(kparams, 'filter', filter)
49
150
  perform_request('baseEntry','count',kparams,false)
50
151
  end
51
152
 
153
+ ##
154
+ # Uploads a file to the Kaltura server and returns a token to be used to create a Kaltura entry.
155
+ #
156
+ # @param [File] file_data The file to upload to Kaltura.
157
+ #
158
+ # @return [String] The file upload_token_id to be used by entry adding methods.
159
+ #
160
+ # @raise [Kaltura::APIError] Default Kaltura errors.
161
+ ##
52
162
  def upload(file_data)
53
163
  kparams = {}
54
164
  client.add_param(kparams, 'fileData', file_data)
55
165
  perform_request('baseEntry','upload',kparams,false)
56
166
  end
57
167
 
168
+ ##
169
+ # Updates an entries thumbnail using a raw jpeg file.
170
+ #
171
+ # @param [String] entry_id The Kaltura entry.
172
+ # @param [File] file_data The MIME type of 'image/jpg' file to be used as the entries thumbnail.
173
+ # This will update the entries version and the thumbnail's version.
174
+ #
175
+ # @return [Kaltura::BaseEntry] The updated Kaltura entry. The primary change will be a version bump.
176
+ #
177
+ # @raise [Kaltura::APIError] Will raise 'PERMISSION_DENIED_TO_UPDATE_ENTRY'
178
+ # if the user session doesn't have permissions to edit this particular entry.
179
+ ##
58
180
  def update_thumbnail_jpeg(entry_id, file_data)
59
181
  kparams = {}
60
182
  client.add_param(kparams, 'entryId', entry_id)
61
183
  client.add_param(kparams, 'fileData', file_data)
62
184
  perform_request('baseEntry','updateThumbnailJpeg',kparams,false)
63
185
  end
64
-
186
+ ##
187
+ # Updates an entries thumbnail using a valid URL.
188
+ #
189
+ # @param [String] entry_id The Kaltura entry.
190
+ # @param [File] url The URL to pull the thumbnail from.
191
+ # This will update the entries version and the thumbnail's version.
192
+ #
193
+ # @return [Kaltura::BaseEntry] The updated Kaltura entry. The primary change will be a version bump.
194
+ #
195
+ # @raise [Kaltura::APIError] Will raise 'PERMISSION_DENIED_TO_UPDATE_ENTRY'
196
+ # if the user session doesn't have permissions to edit this particular entry.
197
+ ##
65
198
  def update_thumbnail_from_url(entry_id, url)
66
199
  kparams = {}
67
200
  client.add_param(kparams, 'entryId', entry_id)
68
201
  client.add_param(kparams, 'url', url)
69
202
  perform_request('baseEntry','updateThumbnailFromUrl',kparams,false)
70
203
  end
71
-
204
+
205
+ ##
206
+ # Updates the entries thumbnail from another entry given a specified time offset.
207
+ # This is one truly odd API call.
208
+ #
209
+ # @param [String] entry_id The Kaltura entry to be changed.
210
+ # @param [String] source_entry_id The Kaltura entry providing the change.
211
+ # @param [Integer] time_offset The time in seconds to offset the source_entry_id thumbnail by.
212
+ #
213
+ # @return [Kaltura::BaseEntry] The updated Kaltura entry. The primary change will be a version bump.
214
+ #
215
+ # @raise [Kaltura::APIError] Will raise 'PERMISSION_DENIED_TO_UPDATE_ENTRY'
216
+ # if the user session doesn't have permissions to edit this particular entry.
217
+ ##
72
218
  def update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset)
73
219
  kparams = {}
74
220
  client.add_param(kparams, 'entryId', entry_id)
@@ -77,31 +223,84 @@ module Kaltura
77
223
  perform_request('baseEntry','updateThumbnailFromSourceEntry',kparams,false)
78
224
  end
79
225
 
226
+ ##
227
+ # Flags an inappropriate Kaltura entry for moderation.
228
+ # The entry ID is provided in the moderation_flag, so it isn't blatently obvious which entry you are
229
+ # interacting with. The method also outputs nothing, so success/failure is more difficult than necessary
230
+ # to track.
231
+ #
232
+ # @param [Kaltura::ModerationFlag] moderation_flag The Kaltura Entry being flagged is hidden down in the field 'flagged_entry_id'.
233
+ #
234
+ # @return [nil] Returns nothing.
235
+ #
236
+ # @raise [Kaltura::APIError] raises "ENTRY_ID_NOT_FOUND" if the entry_id isn't found in addition to default errors.
237
+ ##
80
238
  def flag(moderation_flag)
81
239
  kparams = {}
82
240
  client.add_param(kparams, 'moderationFlag', moderation_flag)
83
241
  perform_request('baseEntry','flag',kparams,false)
84
242
  end
85
243
 
244
+ ##
245
+ # Rejects a Kaltura entry and marks any pending flags as moderated.
246
+ # This makes the entry unplayable and is a much more sane method to flag content than the flag method.
247
+ #
248
+ # @param [String] entry_id The Kaltura entry to reject.
249
+ #
250
+ # @return [nil] Returns nothing.
251
+ #
252
+ # @raise [Kaltura::APIError] raises "ENTRY_ID_NOT_FOUND" if the entry_id isn't found in addition to default errors.
253
+ ##
86
254
  def reject(entry_id)
87
255
  kparams = {}
88
256
  client.add_param(kparams, 'entryId', entry_id)
89
257
  perform_request('baseEntry','reject',kparams,false)
90
258
  end
91
259
 
260
+ ##
261
+ # Approves an entry and marks any pending flags as moderated.
262
+ # This makes the entry playable.
263
+ #
264
+ # @param [String] entry_id The Kaltura entry to approve.
265
+ #
266
+ # @return [nil] Returns nothing.
267
+ #
268
+ # @raise [Kaltura::APIError] raises "ENTRY_ID_NOT_FOUND" if the entry_id isn't found in addition to default errors.
269
+ ##
92
270
  def approve(entry_id)
93
271
  kparams = {}
94
272
  client.add_param(kparams, 'entryId', entry_id)
95
273
  perform_request('baseEntry','approve',kparams,false)
96
274
  end
97
275
 
276
+ ##
277
+ # Lists all pending moderation flags for the specified entry.
278
+ #
279
+ # @param [String] entry_id The Kaltura entry.
280
+ # @param [Kaltura::FilterPager] pager An optional pager to use for a large list of pending moderation flags.
281
+ #
282
+ # @return [Kaltura::Response::ModerationFlagListResponse] Wrapper for Kaltura::BaseResponse.
283
+ #
284
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
285
+ ##
98
286
  def list_flags(entry_id, pager=nil)
99
287
  kparams = {}
100
288
  client.add_param(kparams, 'entryId', entry_id)
101
289
  client.add_param(kparams, 'pager', pager)
102
290
  perform_request('baseEntry','listFlags',kparams,false)
103
291
  end
104
-
292
+
293
+ ##
294
+ # Anonymously ranks an entry.
295
+ # There is no validation done on duplicate rankings.
296
+ #
297
+ # @param [String] entry_id The Kaltura entry to rank.
298
+ # @param [Integer] rank The rank to assign.
299
+ #
300
+ # @return [nil] Returns nothing.
301
+ #
302
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
303
+ ##
105
304
  def anonymous_rank(entry_id, rank)
106
305
  kparams = {}
107
306
  client.add_param(kparams, 'entryId', entry_id)
@@ -109,6 +308,18 @@ module Kaltura
109
308
  perform_request('baseEntry','anonymousRank',kparams,false)
110
309
  end
111
310
 
311
+ ##
312
+ # Retrieves the context data from a Kaltura entry. This is not documented in the API.
313
+ # I'd be cautious about actually using this method.
314
+ #
315
+ # @param [String] entry_id The Kaltura entry.
316
+ # @param [Kaltura::EntryContextDataParams] context_data_params The only field not inherited from Kaltura::ObjectBase
317
+ # is referrer, so I imagine that is what you should set.
318
+ #
319
+ # @return [Kaltura::EntryConextDataResult] Returns some context info, including is the entry restricted by country or session.
320
+ #
321
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
322
+ ##
112
323
  def get_context_data(entry_id, context_data_params)
113
324
  kparams = {}
114
325
  client.add_param(kparams, 'entryId', entry_id)
@@ -1,12 +1,34 @@
1
1
  module Kaltura
2
2
  module Service
3
+ ##
4
+ # Base Service is a method extraction refactoring performed on the Service module for the Velir
5
+ # branch of the kaltura-ruby library. Previously perform_request existed in each method of each
6
+ # service.
7
+ #
8
+ # @author Patrick Robertson
9
+ ##
3
10
  class BaseService
4
11
  attr_accessor :client
5
12
 
6
13
  def initialize(client)
7
14
  @client = client
8
15
  end
9
-
16
+
17
+ ##
18
+ # Enqueues the service class, action, and paramters onto the client object and then
19
+ # informs the client object to perform pop an action off the queue.
20
+ #
21
+ # @param [String] service_class The particular class within the Service module.
22
+ # This translates to a paramter of service=service_class on the http request.
23
+ # @param [String] service_action The action method performed by the service_class.
24
+ # This translates to a parameter of action=service_action on the http request.
25
+ # @param [Boolean] allow_multirequest I've never seen this implemented. It's around
26
+ # just in case though.
27
+ #
28
+ # @return [Object] Returns the result of the request.
29
+ #
30
+ # @raise [Kaltura::APIError] Raises the Kaltura error of the request.
31
+ ##
10
32
  def perform_request(service_class,service_action,paramters,allow_multirequest=true)
11
33
  if allow_multirequest == false && client.is_multirequest
12
34
  return nil
@@ -1,7 +1,39 @@
1
1
  module Kaltura
2
2
  module Service
3
+ ##
4
+ # The Bulk upload service is used to upload and manage bulk uploads using CSV files.
5
+ # This service is available through the KMC and typically would be a one-off,
6
+ # though you could choose to use it with a web application.
7
+ #
8
+ # @example Create a new bulk upload job:
9
+ # csv_file = File.open('/path/to/csv_file/')
10
+ # client.bulk_upload_service.add('12141313',csv_file)
11
+ #
12
+ # @example Retrieve a bulk upload status:
13
+ # status = client.bulk_upload_service.get('124').status
14
+ #
15
+ # @example List all bulk upload jobs:
16
+ # pager = Kaltura::FilterPager.new
17
+ # pager.page_size = 100000000
18
+ # client.bulk_upload_service.list(pager)
19
+ ##
3
20
  class BulkUploadService < BaseService
4
-
21
+
22
+ ##
23
+ # Adds a new bulk upload batch job.
24
+ # The conversion profile ID can be either specified in the API or in the CSV file itself.
25
+ # The attribute in the CSV overrides the API ID. The partner's default conversion profile
26
+ # will be used if no ID is provided.
27
+ #
28
+ # @param [Integer] conversion_profile_id This is the conversion profile to create flavors for each entry from.
29
+ # If there is a conversion profile defined in the file, this paramter will be overriden.
30
+ # @param [File] csv_file_data The CSV file used to batch upload.
31
+ #
32
+ # @return [Kaltura::BulkUpload] A Bulk upload object contains useful information regarding the batch upload status.
33
+ # It would be advised you store the ID of this object somewhere for later retrieval.
34
+ #
35
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
36
+ ##
5
37
  def add(conversion_profile_id, csv_file_data)
6
38
  kparams = {}
7
39
  client.add_param(kparams, 'conversionProfileId', conversion_profile_id)
@@ -9,12 +41,30 @@ module Kaltura
9
41
  perform_request('bulkUpload','add',kparams,false)
10
42
  end
11
43
 
44
+ ##
45
+ # Retrieves a BulkUpload object.
46
+ #
47
+ # @param [Integer] id The ID of the BulkUpload object.
48
+ #
49
+ # @return [Kaltura::BulkUpload] The BulkUpload object requested.
50
+ #
51
+ # @raise [Kaltura::APIError] Raises default Kaltura errors.
52
+ ##
12
53
  def get(id)
13
54
  kparams = {}
14
55
  client.add_param(kparams, 'id', id)
15
56
  perform_request('bulkUpload','get',kparams,false)
16
57
  end
17
58
 
59
+ ##
60
+ # Lists bulk upload batch jobs given a pager index and size.
61
+ #
62
+ # @param [Kaltura::FilterPager] pager Default Kaltura pager object.
63
+ #
64
+ # @return [Kaltura::Response::BulkUploadListResponse] Wrapper for BaseResponse.
65
+ #
66
+ # @return [Kaltura::APIError] Raises default Kaltura errors.
67
+ ##
18
68
  def list(pager=nil)
19
69
  kparams = {}
20
70
  client.add_param(kparams, 'pager', pager)