Class: Kaltura::KalturaUploadTokenService
- Inherits:
-
KalturaServiceBase
- Object
- KalturaServiceBase
- Kaltura::KalturaUploadTokenService
- Defined in:
- lib/kaltura_client.rb
Instance Attribute Summary
Attributes inherited from KalturaServiceBase
Instance Method Summary collapse
-
#add(upload_token = KalturaNotImplemented) ⇒ KalturaUploadToken
Adds new upload token to upload a file.
-
#delete(upload_token_id) ⇒ Object
Deletes the upload token by upload token id.
-
#get(upload_token_id) ⇒ KalturaUploadToken
Get upload token by id.
-
#initialize(client) ⇒ KalturaUploadTokenService
constructor
A new instance of KalturaUploadTokenService.
-
#list(filter = KalturaNotImplemented, pager = KalturaNotImplemented) ⇒ KalturaUploadTokenListResponse
List upload token by filter with pager support.
-
#upload(upload_token_id, file_data, resume = false, final_chunk = true, resume_at = -1)) ⇒ KalturaUploadToken
Upload a file using the upload token id, returns an error on failure (an exception will be thrown when using one of the Kaltura clients) Chunks can be uploaded in parallel and they will be appended according to their resumeAt position.
Constructor Details
#initialize(client) ⇒ KalturaUploadTokenService
Returns a new instance of KalturaUploadTokenService.
5155 5156 5157 |
# File 'lib/kaltura_client.rb', line 5155 def initialize(client) super(client) end |
Instance Method Details
#add(upload_token = KalturaNotImplemented) ⇒ KalturaUploadToken
Adds new upload token to upload a file
5161 5162 5163 5164 5165 5166 5167 5168 5169 |
# File 'lib/kaltura_client.rb', line 5161 def add(upload_token=KalturaNotImplemented) kparams = {} client.add_param(kparams, 'uploadToken', upload_token) client.queue_service_action_call('uploadtoken', 'add', 'KalturaUploadToken', kparams) if (client.is_multirequest) return nil end return client.do_queue() end |
#delete(upload_token_id) ⇒ Object
Deletes the upload token by upload token id
5173 5174 5175 5176 5177 5178 5179 5180 5181 |
# File 'lib/kaltura_client.rb', line 5173 def delete(upload_token_id) kparams = {} client.add_param(kparams, 'uploadTokenId', upload_token_id) client.queue_service_action_call('uploadtoken', 'delete', '', kparams) if (client.is_multirequest) return nil end return client.do_queue() end |
#get(upload_token_id) ⇒ KalturaUploadToken
Get upload token by id
5185 5186 5187 5188 5189 5190 5191 5192 5193 |
# File 'lib/kaltura_client.rb', line 5185 def get(upload_token_id) kparams = {} client.add_param(kparams, 'uploadTokenId', upload_token_id) client.queue_service_action_call('uploadtoken', 'get', 'KalturaUploadToken', kparams) if (client.is_multirequest) return nil end return client.do_queue() end |
#list(filter = KalturaNotImplemented, pager = KalturaNotImplemented) ⇒ KalturaUploadTokenListResponse
List upload token by filter with pager support. When using a user session the service will be restricted to users objects only.
5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 |
# File 'lib/kaltura_client.rb', line 5198 def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented) kparams = {} client.add_param(kparams, 'filter', filter) client.add_param(kparams, 'pager', pager) client.queue_service_action_call('uploadtoken', 'list', 'KalturaUploadTokenListResponse', kparams) if (client.is_multirequest) return nil end return client.do_queue() end |
#upload(upload_token_id, file_data, resume = false, final_chunk = true, resume_at = -1)) ⇒ KalturaUploadToken
Upload a file using the upload token id, returns an error on failure (an exception will be thrown when using one of the Kaltura clients) Chunks can be uploaded in parallel and they will be appended according to their resumeAt position. A parallel upload session should have three stages: 1. A single upload with resume=false and finalChunk=false 2. Parallel upload requests each with resume=true,finalChunk=false and the expected resumetAt position. If a chunk fails to upload it can be re-uploaded. 3. After all of the chunks have been uploaded a final chunk (can be of zero size) should be uploaded with resume=true, finalChunk=true and the expected resumeAt position. In case an UPLOAD_TOKEN_CANNOT_MATCH_EXPECTED_SIZE exception has been returned (indicating not all of the chunks were appended yet) the final request can be retried.
5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 |
# File 'lib/kaltura_client.rb', line 5219 def upload(upload_token_id, file_data, resume=false, final_chunk=true, resume_at=-1) kparams = {} kfiles = {} client.add_param(kparams, 'uploadTokenId', upload_token_id) client.add_param(kfiles, 'fileData', file_data) client.add_param(kparams, 'resume', resume) client.add_param(kparams, 'finalChunk', final_chunk) client.add_param(kparams, 'resumeAt', resume_at) client.queue_service_action_call('uploadtoken', 'upload', 'KalturaUploadToken', kparams, kfiles) if (client.is_multirequest) return nil end return client.do_queue() end |