uiza_minh_phong 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +535 -0
- data/.rubocop_disable.yml +78 -0
- data/.rubocop_enable.yml +786 -0
- data/CHANGELOG.md +50 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTORS.txt +3 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +73 -0
- data/History.txt +1 -0
- data/LICENSE.txt +21 -0
- data/PULL_REQUEST_TEMPLATE.md +44 -0
- data/README.md +248 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/ANALYTIC.md +143 -0
- data/doc/CALLBACK.md +161 -0
- data/doc/CATEGORY.md +312 -0
- data/doc/EMBED_METADATA.md +4 -0
- data/doc/ENTITY.md +470 -0
- data/doc/ERRORS_CODE.md +60 -0
- data/doc/LIVE_STREAMING.md +452 -0
- data/doc/STORAGE.md +188 -0
- data/doc/USER.md +286 -0
- data/lib/uiza.rb +39 -0
- data/lib/uiza/analytic.rb +42 -0
- data/lib/uiza/api_operation/add.rb +16 -0
- data/lib/uiza/api_operation/create.rb +16 -0
- data/lib/uiza/api_operation/delete.rb +15 -0
- data/lib/uiza/api_operation/list.rb +14 -0
- data/lib/uiza/api_operation/remove.rb +15 -0
- data/lib/uiza/api_operation/retrieve.rb +15 -0
- data/lib/uiza/api_operation/update.rb +16 -0
- data/lib/uiza/callback.rb +16 -0
- data/lib/uiza/category.rb +42 -0
- data/lib/uiza/entity.rb +68 -0
- data/lib/uiza/error/bad_request_error.rb +8 -0
- data/lib/uiza/error/client_error.rb +8 -0
- data/lib/uiza/error/internal_server_error.rb +8 -0
- data/lib/uiza/error/not_found_error.rb +8 -0
- data/lib/uiza/error/server_error.rb +8 -0
- data/lib/uiza/error/service_unavailable_error.rb +8 -0
- data/lib/uiza/error/uiza_error.rb +18 -0
- data/lib/uiza/error/unauthorized_error.rb +8 -0
- data/lib/uiza/error/unprocessable_error.rb +8 -0
- data/lib/uiza/live.rb +86 -0
- data/lib/uiza/storage.rb +17 -0
- data/lib/uiza/uiza_client.rb +86 -0
- data/lib/uiza/uiza_open_struct.rb +18 -0
- data/lib/uiza/user.rb +41 -0
- data/lib/uiza/version.rb +3 -0
- data/uiza.gemspec +36 -0
- metadata +141 -0
data/doc/ENTITY.md
ADDED
@@ -0,0 +1,470 @@
|
|
1
|
+
## Entity
|
2
|
+
These below APIs used to take action with your media files (we called Entity).
|
3
|
+
|
4
|
+
See details [here](https://docs.uiza.io/#video).
|
5
|
+
|
6
|
+
## Create entity
|
7
|
+
Create entity using full URL. Direct HTTP, FTP or AWS S3 link are acceptable.
|
8
|
+
|
9
|
+
See details [here](https://docs.uiza.io/#create-entity).
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require "uiza"
|
13
|
+
|
14
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
15
|
+
Uiza.authorization = "your-authorization"
|
16
|
+
|
17
|
+
params = {
|
18
|
+
name: "Sample Video",
|
19
|
+
url: "https://example.com/video.mp4",
|
20
|
+
inputType: "http",
|
21
|
+
description: "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
22
|
+
shortDescription: "Lorem Ipsum is simply dummy text.",
|
23
|
+
poster: "https://example.com/picture001.jpeg",
|
24
|
+
thumbnail: "https://example.com/picture002.jpeg"
|
25
|
+
}
|
26
|
+
|
27
|
+
begin
|
28
|
+
entity = Uiza::Entity.create params
|
29
|
+
puts entity.id
|
30
|
+
puts entity.name
|
31
|
+
rescue Uiza::Error::UizaError => e
|
32
|
+
puts "description_link: #{e.description_link}"
|
33
|
+
puts "code: #{e.code}"
|
34
|
+
puts "message: #{e.message}"
|
35
|
+
rescue StandardError => e
|
36
|
+
puts "message: #{e.message}"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Example Response
|
41
|
+
```ruby
|
42
|
+
{
|
43
|
+
"id": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
44
|
+
"name": "Sample Video",
|
45
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry",
|
46
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
47
|
+
"view": 0,
|
48
|
+
"poster": "https://example.com/picture001",
|
49
|
+
"thumbnail": "https://example.com/picture002",
|
50
|
+
"type": "vod",
|
51
|
+
"status": 1,
|
52
|
+
"duration": "237.865215",
|
53
|
+
"publishToCdn":"success",
|
54
|
+
"embedMetadata": {
|
55
|
+
"artist": "John Doe",
|
56
|
+
"album": "Album sample",
|
57
|
+
"genre": "Pop"
|
58
|
+
},
|
59
|
+
"extendMetadata": {
|
60
|
+
"movie_category":"action",
|
61
|
+
"imdb_score":8.8,
|
62
|
+
"published_year":"2018"
|
63
|
+
},
|
64
|
+
"createdAt": "2018-06-16T18:54:15.000Z",
|
65
|
+
"updatedAt": "2018-06-16T18:54:29.000Z"
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
## Retrieve entity
|
70
|
+
Get detail of entity including all information of entity.
|
71
|
+
|
72
|
+
See details [here](https://docs.uiza.io/#retrieve-an-entity).
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
require "uiza"
|
76
|
+
|
77
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
78
|
+
Uiza.authorization = "your-authorization"
|
79
|
+
|
80
|
+
begin
|
81
|
+
entity = Uiza::Entity.retrieve "your-entity-id"
|
82
|
+
puts entity.id
|
83
|
+
puts entity.name
|
84
|
+
rescue Uiza::Error::UizaError => e
|
85
|
+
puts "description_link: #{e.description_link}"
|
86
|
+
puts "code: #{e.code}"
|
87
|
+
puts "message: #{e.message}"
|
88
|
+
rescue StandardError => e
|
89
|
+
puts "message: #{e.message}"
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
Example Response
|
94
|
+
```ruby
|
95
|
+
{
|
96
|
+
"id": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
97
|
+
"name": "Sample Video",
|
98
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
99
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
100
|
+
"view": 0,
|
101
|
+
"poster": "https://example.com/picture001",
|
102
|
+
"thumbnail": "https://example.com/picture002",
|
103
|
+
"type": "vod",
|
104
|
+
"status": 1,
|
105
|
+
"duration": "237.865215",
|
106
|
+
"publishToCdn":"success",
|
107
|
+
"embedMetadata": {
|
108
|
+
"artist": "John Doe",
|
109
|
+
"album": "Album sample",
|
110
|
+
"genre": "Pop"
|
111
|
+
},
|
112
|
+
"extendMetadata": {
|
113
|
+
"movie_category":"action",
|
114
|
+
"imdb_score":8.8,
|
115
|
+
"published_year":"2018"
|
116
|
+
},
|
117
|
+
"createdAt": "2018-06-16T18:54:15.000Z",
|
118
|
+
"updatedAt": "2018-06-16T18:54:29.000Z"
|
119
|
+
}
|
120
|
+
```
|
121
|
+
|
122
|
+
## List all entities
|
123
|
+
Get list of entities including all detail.
|
124
|
+
|
125
|
+
See details [here](https://docs.uiza.io/#list-all-entities).
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
require "uiza"
|
129
|
+
|
130
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
131
|
+
Uiza.authorization = "your-authorization"
|
132
|
+
|
133
|
+
params = {
|
134
|
+
publishToCdn: "not-ready",
|
135
|
+
metadataId: "your-folder/playlist-id"
|
136
|
+
}
|
137
|
+
|
138
|
+
begin
|
139
|
+
entities = Uiza::Entity.list params
|
140
|
+
# params is optional
|
141
|
+
# or entities = Uiza::Entity.list
|
142
|
+
puts entities.first.id
|
143
|
+
puts entities.first.name
|
144
|
+
rescue Uiza::Error::UizaError => e
|
145
|
+
puts "description_link: #{e.description_link}"
|
146
|
+
puts "code: #{e.code}"
|
147
|
+
puts "message: #{e.message}"
|
148
|
+
rescue StandardError => e
|
149
|
+
puts "message: #{e.message}"
|
150
|
+
end
|
151
|
+
```
|
152
|
+
|
153
|
+
Example Response
|
154
|
+
```ruby
|
155
|
+
[
|
156
|
+
{
|
157
|
+
"id": "42ceb1ab-18ef-4f2e-b076-14299756d182",
|
158
|
+
"name": "Sample Video 1",
|
159
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
160
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
161
|
+
"view": 0,
|
162
|
+
"poster": "https://example.com/picture001",
|
163
|
+
"thumbnail": "https://example.com/picture002",
|
164
|
+
"type": "vod",
|
165
|
+
"duration": "237.865215",
|
166
|
+
"publishToCdn":"success",
|
167
|
+
"embedMetadata": {
|
168
|
+
"artist": "John Doe",
|
169
|
+
"album": "Album sample",
|
170
|
+
"genre": "Pop"
|
171
|
+
},
|
172
|
+
"extendMetadata": {
|
173
|
+
"movie_category":"action",
|
174
|
+
"imdb_score":8.8,
|
175
|
+
"published_year":"2018"
|
176
|
+
},
|
177
|
+
"createdAt": "2018-06-22T19:20:17.000Z",
|
178
|
+
"updatedAt": "2018-06-22T19:20:17.000Z"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
"id": "64b15996-2261-4f41-a3c4-72b652323f67",
|
182
|
+
"name": "Sample Video 2",
|
183
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
184
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
185
|
+
"view": 0,
|
186
|
+
"poster": "https://example.com/picture001",
|
187
|
+
"thumbnail": "https://example.com/picture002",
|
188
|
+
"type": "vod",
|
189
|
+
"duration": "178.178105",
|
190
|
+
"publishToCdn":"success",
|
191
|
+
"embedMetadata": {
|
192
|
+
"artist": "John Doe",
|
193
|
+
"album": "Album sample",
|
194
|
+
"genre": "Pop"
|
195
|
+
},
|
196
|
+
"extendMetadata": {
|
197
|
+
"movie_category":"action",
|
198
|
+
"imdb_score":8.8,
|
199
|
+
"published_year":"2018"
|
200
|
+
},
|
201
|
+
"createdAt": "2018-06-22T19:16:22.000Z",
|
202
|
+
"updatedAt": "2018-06-22T19:16:22.000Z"
|
203
|
+
}
|
204
|
+
]
|
205
|
+
```
|
206
|
+
|
207
|
+
## Update entity
|
208
|
+
Update entity's information.
|
209
|
+
|
210
|
+
See details [here](https://docs.uiza.io/#update-an-entity).
|
211
|
+
|
212
|
+
```ruby
|
213
|
+
require "uiza"
|
214
|
+
|
215
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
216
|
+
Uiza.authorization = "your-authorization"
|
217
|
+
|
218
|
+
params = {
|
219
|
+
id: "your-entity-id",
|
220
|
+
name: "Name edited"
|
221
|
+
}
|
222
|
+
|
223
|
+
begin
|
224
|
+
entity = Uiza::Entity.update params
|
225
|
+
puts entity.id
|
226
|
+
puts entity.name
|
227
|
+
rescue Uiza::Error::UizaError => e
|
228
|
+
puts "description_link: #{e.description_link}"
|
229
|
+
puts "code: #{e.code}"
|
230
|
+
puts "message: #{e.message}"
|
231
|
+
rescue StandardError => e
|
232
|
+
puts "message: #{e.message}"
|
233
|
+
end
|
234
|
+
```
|
235
|
+
|
236
|
+
Example Response
|
237
|
+
```ruby
|
238
|
+
{
|
239
|
+
"id": "64b15996-2261-4f41-a3c4-72b652323f67",
|
240
|
+
"name": "Sample Video",
|
241
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
242
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
243
|
+
"view": 0,
|
244
|
+
"poster": "https://example.com/picture001",
|
245
|
+
"thumbnail": "https://example.com/picture002",
|
246
|
+
"type": "vod",
|
247
|
+
"duration": "178.178105",
|
248
|
+
"publishToCdn":"success",
|
249
|
+
"embedMetadata": {
|
250
|
+
"artist": "John Doe",
|
251
|
+
"album": "Album sample",
|
252
|
+
"genre": "Pop"
|
253
|
+
},
|
254
|
+
"extendMetadata": {
|
255
|
+
"movie_category":"action",
|
256
|
+
"imdb_score":8.8,
|
257
|
+
"published_year":"2018"
|
258
|
+
},
|
259
|
+
"createdAt": "2018-06-22T19:16:22.000Z",
|
260
|
+
"updatedAt": "2018-06-22T19:16:22.000Z"
|
261
|
+
}
|
262
|
+
```
|
263
|
+
|
264
|
+
## Delete entity
|
265
|
+
Delete entity.
|
266
|
+
|
267
|
+
See details [here](https://docs.uiza.io/#delete-an-entity).
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
require "uiza"
|
271
|
+
|
272
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
273
|
+
Uiza.authorization = "your-authorization"
|
274
|
+
|
275
|
+
begin
|
276
|
+
entity = Uiza::Entity.delete "your-entity-id"
|
277
|
+
puts entity.id
|
278
|
+
rescue Uiza::Error::UizaError => e
|
279
|
+
puts "description_link: #{e.description_link}"
|
280
|
+
puts "code: #{e.code}"
|
281
|
+
puts "message: #{e.message}"
|
282
|
+
rescue StandardError => e
|
283
|
+
puts "message: #{e.message}"
|
284
|
+
end
|
285
|
+
```
|
286
|
+
|
287
|
+
Example Response
|
288
|
+
```ruby
|
289
|
+
{
|
290
|
+
"id": "64b15996-2261-4f41-a3c4-72b652323f67"
|
291
|
+
}
|
292
|
+
```
|
293
|
+
|
294
|
+
## Search entity
|
295
|
+
Search entity base on keyword entered.
|
296
|
+
|
297
|
+
See details [here](https://docs.uiza.io/#search-entity).
|
298
|
+
|
299
|
+
```ruby
|
300
|
+
require "uiza"
|
301
|
+
|
302
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
303
|
+
Uiza.authorization = "your-authorization"
|
304
|
+
|
305
|
+
begin
|
306
|
+
entities = Uiza::Entity.search "your-keyword"
|
307
|
+
puts entities.first.id
|
308
|
+
puts entities.first.name
|
309
|
+
rescue Uiza::Error::UizaError => e
|
310
|
+
puts "description_link: #{e.description_link}"
|
311
|
+
puts "code: #{e.code}"
|
312
|
+
puts "message: #{e.message}"
|
313
|
+
rescue StandardError => e
|
314
|
+
puts "message: #{e.message}"
|
315
|
+
end
|
316
|
+
```
|
317
|
+
|
318
|
+
Example Response
|
319
|
+
```ruby
|
320
|
+
[
|
321
|
+
{
|
322
|
+
"id": "42ceb1ab-18ef-4f2e-b076-14299756d182",
|
323
|
+
"name": "Sample Video 1",
|
324
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
325
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
326
|
+
"view": 0,
|
327
|
+
"poster": "https://example.com/picture001",
|
328
|
+
"thumbnail": "https://example.com/picture002",
|
329
|
+
"type": "vod",
|
330
|
+
"duration": "237.865215",
|
331
|
+
"publishToCdn":"success",
|
332
|
+
"embedMetadata": {
|
333
|
+
"artist": "John Doe",
|
334
|
+
"album": "Album sample",
|
335
|
+
"genre": "Pop"
|
336
|
+
},
|
337
|
+
"extendMetadata": {
|
338
|
+
"movie_category":"action",
|
339
|
+
"imdb_score":8.8,
|
340
|
+
"published_year":"2018"
|
341
|
+
},
|
342
|
+
"createdAt": "2018-06-22T19:20:17.000Z",
|
343
|
+
"updatedAt": "2018-06-22T19:20:17.000Z"
|
344
|
+
},
|
345
|
+
{
|
346
|
+
"id": "64b15996-2261-4f41-a3c4-72b652323f67",
|
347
|
+
"name": "Sample Video 2",
|
348
|
+
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
|
349
|
+
"shortDescription": "Lorem Ipsum is simply dummy text.",
|
350
|
+
"view": 0,
|
351
|
+
"poster": "https://example.com/picture001",
|
352
|
+
"thumbnail": "https://example.com/picture002",
|
353
|
+
"type": "vod",
|
354
|
+
"duration": "178.178105",
|
355
|
+
"publishToCdn":"success",
|
356
|
+
"embedMetadata": {
|
357
|
+
"artist": "John Doe",
|
358
|
+
"album": "Album sample",
|
359
|
+
"genre": "Pop"
|
360
|
+
},
|
361
|
+
"extendMetadata": {
|
362
|
+
"movie_category":"action",
|
363
|
+
"imdb_score":8.8,
|
364
|
+
"published_year":"2018"
|
365
|
+
},
|
366
|
+
"createdAt": "2018-06-22T19:16:22.000Z",
|
367
|
+
"updatedAt": "2018-06-22T19:16:22.000Z"
|
368
|
+
}
|
369
|
+
]
|
370
|
+
```
|
371
|
+
|
372
|
+
## Publish entity to CDN
|
373
|
+
Publish entity to CDN, use for streaming.
|
374
|
+
|
375
|
+
See details [here](https://docs.uiza.io/#publish-entity-to-cdn).
|
376
|
+
|
377
|
+
```ruby
|
378
|
+
require "uiza"
|
379
|
+
|
380
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
381
|
+
Uiza.authorization = "your-authorization"
|
382
|
+
|
383
|
+
begin
|
384
|
+
response = Uiza::Entity.publish "your-entity-id"
|
385
|
+
puts response.message
|
386
|
+
puts response.entityId
|
387
|
+
rescue Uiza::Error::UizaError => e
|
388
|
+
puts "description_link: #{e.description_link}"
|
389
|
+
puts "code: #{e.code}"
|
390
|
+
puts "message: #{e.message}"
|
391
|
+
rescue StandardError => e
|
392
|
+
puts "message: #{e.message}"
|
393
|
+
end
|
394
|
+
```
|
395
|
+
|
396
|
+
Example Response
|
397
|
+
```ruby
|
398
|
+
{
|
399
|
+
"message": "Your entity started publish, check process status with this entity ID",
|
400
|
+
"entityId": "42ceb1ab-18ef-4f2e-b076-14299756d182"
|
401
|
+
}
|
402
|
+
```
|
403
|
+
|
404
|
+
## Get status publish
|
405
|
+
Publish entity to CDN, use for streaming.
|
406
|
+
|
407
|
+
See details [here](https://docs.uiza.io/#get-status-publish).
|
408
|
+
|
409
|
+
```ruby
|
410
|
+
require "uiza"
|
411
|
+
|
412
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
413
|
+
Uiza.authorization = "your-authorization"
|
414
|
+
|
415
|
+
begin
|
416
|
+
response = Uiza::Entity.get_status_publish "your-entity-id"
|
417
|
+
puts response.progress
|
418
|
+
puts response.status
|
419
|
+
rescue Uiza::Error::UizaError => e
|
420
|
+
puts "description_link: #{e.description_link}"
|
421
|
+
puts "code: #{e.code}"
|
422
|
+
puts "message: #{e.message}"
|
423
|
+
rescue StandardError => e
|
424
|
+
puts "message: #{e.message}"
|
425
|
+
end
|
426
|
+
```
|
427
|
+
|
428
|
+
Example Response
|
429
|
+
```ruby
|
430
|
+
{
|
431
|
+
"progress": 0,
|
432
|
+
"status": "processing"
|
433
|
+
}
|
434
|
+
```
|
435
|
+
|
436
|
+
## Get AWS upload key
|
437
|
+
This API will be return the bucket temporary upload storage & key for upload, so that you can push your file to Uiza’s storage and get the link for URL upload & create entity.
|
438
|
+
|
439
|
+
See details [here](https://docs.uiza.io/#get-aws-upload-key).
|
440
|
+
|
441
|
+
```ruby
|
442
|
+
require "uiza"
|
443
|
+
|
444
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
445
|
+
Uiza.authorization = "your-authorization"
|
446
|
+
|
447
|
+
begin
|
448
|
+
response = Uiza::Entity.get_aws_upload_key
|
449
|
+
puts response.bucket_name
|
450
|
+
puts response.region_name
|
451
|
+
rescue Uiza::Error::UizaError => e
|
452
|
+
puts "description_link: #{e.description_link}"
|
453
|
+
puts "code: #{e.code}"
|
454
|
+
puts "message: #{e.message}"
|
455
|
+
rescue StandardError => e
|
456
|
+
puts "message: #{e.message}"
|
457
|
+
end
|
458
|
+
```
|
459
|
+
|
460
|
+
Example Response
|
461
|
+
```ruby
|
462
|
+
{
|
463
|
+
"temp_expire_at": 1533658598,
|
464
|
+
"temp_access_id": "ASIAV*******GPHO2DTZ",
|
465
|
+
"bucket_name": "uiza****-storage-ap-southeast-1-01/upload-temp/****ff4ad74a5195f4c/",
|
466
|
+
"temp_session_token": "FQo///wEaDM3rrospITbBQ==",
|
467
|
+
"region_name": "ap-southeast-1",
|
468
|
+
"temp_access_secret": "dp****cx2mE2lZxsSq7kV++vWSL6RNatAhbqc"
|
469
|
+
}
|
470
|
+
```
|