uiza 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6291f5eec9bd640ebb5d2af235daef51c95e802cd945a47a16451875bdc87b8a
4
- data.tar.gz: 24bd9829ba6d4a84e3751ca20a9220f23146d8360336a14ef8f7667b1cf606ee
3
+ metadata.gz: 158e8b3d2efc6f408f8e3e482c0722360f77a6ee06ddb182a9ba6bdeeb666a53
4
+ data.tar.gz: 939dd7855b1b5704a138efd0ad13ec09a10b64450ce9af38d4c70bdc9b775c0b
5
5
  SHA512:
6
- metadata.gz: 93830db8658317d313400bb9983f778303f9b68b3f76e6176d2fdd651cc2708c8720491852cf9187f464fc92aacbd6b3ce49ea3cc46bd96c356c2d43dc6e5452
7
- data.tar.gz: f35d7392cd0f1262d144923d262c4bc1237f3c41ffe235c45d257970e47cba17c18a19cd2a08882687d01f2257f1b3ce9bbf71f9e1df325938771f868a0d19f6
6
+ metadata.gz: 5f61f56ace2e1243ecfdd4c35df2d54b8feb02a6907cca5dcbecaa7d32558d04fcb5ee9b0b2cbb2b7f7a083e4e921f46988de06b68498817c5b37213b6e7d034
7
+ data.tar.gz: 625e6193a0e8bafb1b8605512a36409e9ce00952a7f1054c44b4c4e4f5e2ffa6ffbc2917ed4d5135b5289ee146fbdecca5a9960f68b52d67ba54303a6b0587a7
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1 - 2019-02-23
4
+ [#72](https://github.com/uizaio/api-wrapper-ruby/pull/72) Reslease Sprint 3
5
+ 1. Add Live
6
+
7
+ 2. Add Callback
8
+
9
+ ## 1.0.0 - 2019-02-25
10
+ Publish gem to https://rubygems.org
11
+
3
12
  ## 0.1.0 - 2019-02-21
4
13
  [#53](https://github.com/uizaio/api-wrapper-ruby/pull/53) Release Sprint 2
5
14
  1. Add APIOperation
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "rubocop"
4
+ gem "simplecov"
4
5
  gem "webmock"
5
6
 
6
7
  gemspec
@@ -12,8 +12,10 @@ GEM
12
12
  crack (0.4.3)
13
13
  safe_yaml (~> 1.0.0)
14
14
  diff-lcs (1.3)
15
+ docile (1.3.1)
15
16
  hashdiff (0.3.8)
16
17
  jaro_winkler (1.5.2)
18
+ json (2.2.0)
17
19
  parallel (1.13.0)
18
20
  parser (2.6.0.0)
19
21
  ast (~> 2.4.0)
@@ -44,6 +46,11 @@ GEM
44
46
  unicode-display_width (~> 1.4.0)
45
47
  ruby-progressbar (1.10.0)
46
48
  safe_yaml (1.0.4)
49
+ simplecov (0.16.1)
50
+ docile (~> 1.1)
51
+ json (>= 1.8, < 3)
52
+ simplecov-html (~> 0.10.0)
53
+ simplecov-html (0.10.2)
47
54
  unicode-display_width (1.4.1)
48
55
  webmock (3.5.1)
49
56
  addressable (>= 2.3.6)
@@ -58,6 +65,7 @@ DEPENDENCIES
58
65
  rake (~> 10.0)
59
66
  rspec (~> 3.0)
60
67
  rubocop
68
+ simplecov
61
69
  uiza!
62
70
  webmock
63
71
 
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ The MIT License
2
2
 
3
- Copyright (c) 2019 Uiza (https://uiza.io/)
3
+ Copyright (c) 2010-2018 Uiza Pte. Ltd. https://www.uiza.io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -136,11 +136,49 @@ These APIs used to create and manage live streaming event.
136
136
 
137
137
  See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/LIVE_STREAMING.md).
138
138
 
139
+ ```ruby
140
+ require "json"
141
+
142
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
143
+ Uiza.authorization = "your-authorization"
144
+
145
+ begin
146
+ live = Uiza::Live.retrieve "your-live-id"
147
+ puts live.id
148
+ puts live.name
149
+ rescue Uiza::Error::UizaError => e
150
+ puts "description_link: #{e.description_link}"
151
+ puts "code: #{e.code}"
152
+ puts "message: #{e.message}"
153
+ rescue StandardError => e
154
+ puts "message: #{e.message}"
155
+ end
156
+ ```
157
+
139
158
  ## Callback
140
159
  Callback used to retrieve an information for Uiza to your server, so you can have a trigger notice about an entity is upload completed and .
141
160
 
142
161
  See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/CALLBACK.md).
143
162
 
163
+ ```ruby
164
+ require "json"
165
+
166
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
167
+ Uiza.authorization = "your-authorization"
168
+
169
+ begin
170
+ callback = Uiza::Live.retrieve "your-callback-id"
171
+ puts callback.id
172
+ puts callback.url
173
+ rescue Uiza::Error::UizaError => e
174
+ puts "description_link: #{e.description_link}"
175
+ puts "code: #{e.code}"
176
+ puts "message: #{e.message}"
177
+ rescue StandardError => e
178
+ puts "message: #{e.message}"
179
+ end
180
+ ```
181
+
144
182
  ## Analytic
145
183
  Monitor the four key dimensions of video QoS: playback failures, startup time, rebuffering, and video quality.
146
184
  These 15 metrics help you track playback performance, so your team can know exactly what’s going on.
@@ -161,19 +199,24 @@ Codes in the `5xx` range indicate an error with Uiza's servers.
161
199
  See details [here](https://github.com/uizaio/api-wrapper-ruby/blob/develop/doc/ERRORS_CODE.md).
162
200
 
163
201
  ## Development
164
-
165
202
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
166
203
 
167
204
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
168
205
 
169
- ## Contributing
206
+ ## Testing
207
+ Run below command to run rspec for project.
208
+ ```ruby
209
+ bundle exec rspec spec
210
+ ```
211
+
212
+ Open `coverage/index.html` to see coversage of RSpec.
213
+ See details [here](https://github.com/colszowka/simplecov).
170
214
 
215
+ ## Contributing
171
216
  Bug reports and pull requests are welcome on GitHub at https://github.com/uizaio/api-wrapper-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
172
217
 
173
218
  ## License
174
-
175
219
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
176
220
 
177
221
  ## Code of Conduct
178
-
179
222
  Everyone interacting in the Uiza project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/uizaio/api-wrapper-ruby/blob/master/CODE_OF_CONDUCT.md).
@@ -2,3 +2,160 @@
2
2
  Callback used to retrieve an information for Uiza to your server, so you can have a trigger notice about an entity is upload completed and .
3
3
 
4
4
  See details [here](https://docs.uiza.io/#callback).
5
+
6
+ ## Create a callback
7
+ This API will allow you setup a callback to your server when an entity is completed for upload or public
8
+
9
+ See details [here](https://docs.uiza.io/#create-a-callback).
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
+ url: "https://callback-url.uiza.co",
19
+ method: "POST"
20
+ }
21
+
22
+ begin
23
+ callback = Uiza::Callback.create params
24
+ puts callback.id
25
+ puts callback.url
26
+ rescue Uiza::Error::UizaError => e
27
+ puts "description_link: #{e.description_link}"
28
+ puts "code: #{e.code}"
29
+ puts "message: #{e.message}"
30
+ rescue StandardError => e
31
+ puts "message: #{e.message}"
32
+ end
33
+ ```
34
+
35
+ Example Response
36
+ ```ruby
37
+ {
38
+ "id": "0a6bf245-1cce-494f-a193-b5a44aa05558",
39
+ "url": "https://callback-url.uiza.co",
40
+ "headersData": null,
41
+ "jsonData": null,
42
+ "method": "POST",
43
+ "status": 1,
44
+ "createdAt": "2018-06-23T01:27:08.000Z",
45
+ "updatedAt": "2018-06-23T01:27:08.000Z"
46
+ }
47
+ ```
48
+
49
+ ## Retrieve a callback
50
+ Retrieves the details of an existing callback.
51
+
52
+ See details [here](https://docs.uiza.io/#retrieve-a-callback).
53
+
54
+ ```ruby
55
+ require "uiza"
56
+
57
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
58
+ Uiza.authorization = "your-authorization"
59
+
60
+ begin
61
+ callback = Uiza::Callback.retrieve "your-callback-id"
62
+ puts callback.id
63
+ puts callback.url
64
+ rescue Uiza::Error::UizaError => e
65
+ puts "description_link: #{e.description_link}"
66
+ puts "code: #{e.code}"
67
+ puts "message: #{e.message}"
68
+ rescue StandardError => e
69
+ puts "message: #{e.message}"
70
+ end
71
+ ```
72
+
73
+ Example Response
74
+ ```ruby
75
+ {
76
+ "id": "0a6bf245-1cce-494f-a193-b5a44aa05558",
77
+ "url": "https://callback-url.uiza.co",
78
+ "headersData": null,
79
+ "jsonData": {
80
+ "text": "example callback"
81
+ },
82
+ "method": "POST",
83
+ "status": 1,
84
+ "createdAt": "2018-06-23T01:27:08.000Z",
85
+ "updatedAt": "2018-06-23T01:27:08.000Z"
86
+ }
87
+ ```
88
+
89
+ ## Update a callback
90
+ This API will allow you setup a callback to your server when an entity is completed for upload or public
91
+
92
+ See details [here](https://docs.uiza.io/#update-a-callback).
93
+
94
+ ```ruby
95
+ require "uiza"
96
+
97
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
98
+ Uiza.authorization = "your-authorization"
99
+
100
+ params = {
101
+ id: "your-callback-id",
102
+ url: "https://callback-url.uiza.co",
103
+ method: "GET"
104
+ }
105
+
106
+ begin
107
+ callback = Uiza::Callback.update params
108
+ puts callback.id
109
+ puts callback.url
110
+ rescue Uiza::Error::UizaError => e
111
+ puts "description_link: #{e.description_link}"
112
+ puts "code: #{e.code}"
113
+ puts "message: #{e.message}"
114
+ rescue StandardError => e
115
+ puts "message: #{e.message}"
116
+ end
117
+ ```
118
+
119
+ Example Response
120
+ ```ruby
121
+ {
122
+ "id": "your-callback-id",
123
+ "url": "https://callback-url.uiza.co",
124
+ "headersData": null,
125
+ "jsonData": null,
126
+ "method": "GET",
127
+ "status": 1,
128
+ "createdAt": "2018-06-23T01:27:08.000Z",
129
+ "updatedAt": "2018-06-23T01:27:08.000Z"
130
+ }
131
+ ```
132
+
133
+ ## Delete a callback
134
+ Delete an existing callback.
135
+
136
+ See details [here](https://docs.uiza.io/#delete-a-callback).
137
+
138
+ ```ruby
139
+ require "uiza"
140
+
141
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
142
+ Uiza.authorization = "your-authorization"
143
+
144
+ begin
145
+ callback = Uiza::Callback.delete "your-callback-id"
146
+ puts callback.id
147
+ rescue Uiza::Error::UizaError => e
148
+ puts "description_link: #{e.description_link}"
149
+ puts "code: #{e.code}"
150
+ puts "message: #{e.message}"
151
+ rescue StandardError => e
152
+ puts "message: #{e.message}"
153
+ end
154
+ ```
155
+
156
+ Example Response
157
+ ```ruby
158
+ {
159
+ "id": "your-callback-id"
160
+ }
161
+ ```
@@ -4,3 +4,428 @@ These APIs used to create and manage live streaming event.
4
4
  * When have an Event , you can start it : it's named as `Feed`.
5
5
 
6
6
  See details [here](https://docs.uiza.io/#live-streaming).
7
+
8
+ ## Create a live event
9
+ These APIs use to create a live streaming and manage the live streaming input (output).
10
+ A live stream can be set up and start later or start right after set up.
11
+ Live Channel Minutes counts when the event starts.
12
+
13
+ See details [here](https://docs.uiza.io/#create-a-live-event).
14
+
15
+ ```ruby
16
+ require "uiza"
17
+
18
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
19
+ Uiza.authorization = "your-authorization"
20
+
21
+ params = {
22
+ name: "test event",
23
+ mode: "push",
24
+ encode: 1,
25
+ dvr: 1,
26
+ description: "This is for test event",
27
+ poster: "https://example.com/poster.jpeg",
28
+ thumbnail: "https://example.com/poster.jpeg",
29
+ linkStream: [
30
+ "https://playlist.m3u8"
31
+ ],
32
+ resourceMode: "single"
33
+ }
34
+
35
+ begin
36
+ live = Uiza::Live.create params
37
+ puts live.id
38
+ puts live.name
39
+ rescue Uiza::Error::UizaError => e
40
+ puts "description_link: #{e.description_link}"
41
+ puts "code: #{e.code}"
42
+ puts "message: #{e.message}"
43
+ rescue StandardError => e
44
+ puts "message: #{e.message}"
45
+ end
46
+ ```
47
+
48
+ Example Response
49
+ ```ruby
50
+ {
51
+ "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de",
52
+ "name": "checking 01",
53
+ "description": "checking",
54
+ "mode": "pull",
55
+ "resourceMode": "single",
56
+ "encode": 0,
57
+ "channelName": "checking-01",
58
+ "lastPresetId": null,
59
+ "lastFeedId": null,
60
+ "poster": "https://example.com/poster.jpeg",
61
+ "thumbnail": "https://example.com/thumbnail.jpeg",
62
+ "linkPublishSocial": null,
63
+ "linkStream": "[\"https://www.youtube.com/watch?v=pQzaHPoNX1I\"]",
64
+ "lastPullInfo": null,
65
+ "lastPushInfo": null,
66
+ "lastProcess": null,
67
+ "eventType": null,
68
+ "createdAt": "2018-06-21T14:33:36.000Z",
69
+ "updatedAt": "2018-06-21T14:33:36.000Z"
70
+ }
71
+ ```
72
+
73
+ ## Retrieve a live event
74
+ Retrieves the details of an existing event.
75
+ You need only provide the unique identifier of event that was returned upon Live event creation.
76
+
77
+ See details [here](https://docs.uiza.io/#retrieve-a-live-event).
78
+
79
+ ```ruby
80
+ require "uiza"
81
+
82
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
83
+ Uiza.authorization = "your-authorization"
84
+
85
+ begin
86
+ live = Uiza::Live.retrieve "your-live-id"
87
+ puts live.id
88
+ puts live.name
89
+ rescue Uiza::Error::UizaError => e
90
+ puts "description_link: #{e.description_link}"
91
+ puts "code: #{e.code}"
92
+ puts "message: #{e.message}"
93
+ rescue StandardError => e
94
+ puts "message: #{e.message}"
95
+ end
96
+ ```
97
+
98
+ Example Response
99
+ ```ruby
100
+ {
101
+ "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de",
102
+ "name": "checking 01",
103
+ "description": "checking",
104
+ "mode": "pull",
105
+ "resourceMode": "single",
106
+ "encode": 0,
107
+ "channelName": "checking-01",
108
+ "lastPresetId": null,
109
+ "lastFeedId": null,
110
+ "poster": "https://example.com/poster.jpeg",
111
+ "thumbnail": "https://example.com/thumbnail.jpeg",
112
+ "linkPublishSocial": null,
113
+ "linkStream": "[\"https://www.youtube.com/watch?v=pQzaHPoNX1I\"]",
114
+ "lastPullInfo": null,
115
+ "lastPushInfo": null,
116
+ "lastProcess": null,
117
+ "eventType": null,
118
+ "createdAt": "2018-06-21T14:33:36.000Z",
119
+ "updatedAt": "2018-06-21T14:33:36.000Z"
120
+ }
121
+ ```
122
+
123
+ ## Update a live event
124
+ Update the specific Live event by edit values of parameters.
125
+
126
+ See details [here](https://docs.uiza.io/#update-a-live-event).
127
+
128
+ ```ruby
129
+ require "uiza"
130
+
131
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
132
+ Uiza.authorization = "your-authorization"
133
+
134
+ params = {
135
+ id: "your-live-id",
136
+ name: "live test",
137
+ mode: "pull",
138
+ encode: 0,
139
+ dvr: 1
140
+ resourceMode: "single"
141
+ }
142
+
143
+ begin
144
+ live = Uiza::Live.update params
145
+ puts live.id
146
+ puts live.name
147
+ rescue Uiza::Error::UizaError => e
148
+ puts "description_link: #{e.description_link}"
149
+ puts "code: #{e.code}"
150
+ puts "message: #{e.message}"
151
+ rescue StandardError => e
152
+ puts "message: #{e.message}"
153
+ end
154
+ ```
155
+
156
+ Example Response
157
+ ```ruby
158
+ {
159
+ "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de",
160
+ "name": "checking 01",
161
+ "description": "checking",
162
+ "mode": "pull",
163
+ "resourceMode": "single",
164
+ "encode": 0,
165
+ "channelName": "checking-01",
166
+ "lastPresetId": null,
167
+ "lastFeedId": null,
168
+ "poster": "https://example.com/poster.jpeg",
169
+ "thumbnail": "https://example.com/thumbnail.jpeg",
170
+ "linkPublishSocial": null,
171
+ "linkStream": "[\"https://www.youtube.com/watch?v=pQzaHPoNX1I\"]",
172
+ "lastPullInfo": null,
173
+ "lastPushInfo": null,
174
+ "lastProcess": null,
175
+ "eventType": null,
176
+ "createdAt": "2018-06-21T14:33:36.000Z",
177
+ "updatedAt": "2018-06-21T14:33:36.000Z"
178
+ }
179
+ ```
180
+
181
+ ## Start a live feed
182
+ These API use to start a live event that has been create success.
183
+ The Live channel minute start count whenever the event start success
184
+
185
+ See details [here](https://docs.uiza.io/#start-a-live-feed).
186
+
187
+ ```ruby
188
+ require "uiza"
189
+
190
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
191
+ Uiza.authorization = "your-authorization"
192
+
193
+ begin
194
+ live = Uiza::Live.start_feed "your-live-id"
195
+ puts live.id
196
+ puts live.name
197
+ rescue Uiza::Error::UizaError => e
198
+ puts "description_link: #{e.description_link}"
199
+ puts "code: #{e.code}"
200
+ puts "message: #{e.message}"
201
+ rescue StandardError => e
202
+ puts "message: #{e.message}"
203
+ end
204
+ ```
205
+
206
+ Example Response
207
+ ```ruby
208
+ {
209
+ "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de",
210
+ "name": "checking 01",
211
+ "description": "checking",
212
+ "mode": "pull",
213
+ "resourceMode": "single",
214
+ "encode": 0,
215
+ "channelName": "checking-01",
216
+ "lastPresetId": null,
217
+ "lastFeedId": null,
218
+ "poster": "https://example.com/poster.jpeg",
219
+ "thumbnail": "https://example.com/thumbnail.jpeg",
220
+ "linkPublishSocial": null,
221
+ "linkStream": "[\"https://www.youtube.com/watch?v=pQzaHPoNX1I\"]",
222
+ "lastPullInfo": null,
223
+ "lastPushInfo": null,
224
+ "lastProcess": null,
225
+ "eventType": null,
226
+ "createdAt": "2018-06-21T14:33:36.000Z",
227
+ "updatedAt": "2018-06-21T14:33:36.000Z"
228
+ }
229
+ ```
230
+
231
+ ## Get view of live feed
232
+ This API use to get a live view status . This view only show when event has been started and being processing.
233
+
234
+ See details [here](https://docs.uiza.io/#get-view-of-live-feed).
235
+
236
+ ```ruby
237
+ require "uiza"
238
+
239
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
240
+ Uiza.authorization = "your-authorization"
241
+
242
+ begin
243
+ response = Uiza::Live.get_view "your-live-id"
244
+ puts response.stream_name
245
+ puts response.watchnow
246
+ puts response.day
247
+ rescue Uiza::Error::UizaError => e
248
+ puts "description_link: #{e.description_link}"
249
+ puts "code: #{e.code}"
250
+ puts "message: #{e.message}"
251
+ rescue StandardError => e
252
+ puts "message: #{e.message}"
253
+ end
254
+ ```
255
+
256
+ Example Response
257
+ ```
258
+ {
259
+ "stream_name": "peppa-pig-english-episodes",
260
+ "watchnow": 1,
261
+ "day": 1533271205999
262
+ }
263
+ ```
264
+
265
+ ## Stop a live feed
266
+ Stop live event
267
+
268
+ See details [here](https://docs.uiza.io/#stop-a-live-feed).
269
+
270
+ ```ruby
271
+ require "uiza"
272
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
273
+ Uiza.authorization = "your-authorization"
274
+
275
+ begin
276
+ live = Uiza::Live.stop_feed "your-live-id"
277
+ puts live.id
278
+ puts live.name
279
+ rescue Uiza::Error::UizaError => e
280
+ puts "description_link: #{e.description_link}"
281
+ puts "code: #{e.code}"
282
+ puts "message: #{e.message}"
283
+ rescue StandardError => e
284
+ puts "message: #{e.message}"
285
+ end
286
+ ```
287
+
288
+ Example Response
289
+ ```ruby
290
+ {
291
+ "id": "8b83886e-9cc3-4eab-9258-ebb16c0c73de",
292
+ "name": "checking 01",
293
+ "description": "checking",
294
+ "mode": "pull",
295
+ "resourceMode": "single",
296
+ "encode": 0,
297
+ "channelName": "checking-01",
298
+ "lastPresetId": null,
299
+ "lastFeedId": null,
300
+ "poster": "https://example.com/poster.jpeg",
301
+ "thumbnail": "https://example.com/thumbnail.jpeg",
302
+ "linkPublishSocial": null,
303
+ "linkStream": "[\"https://www.youtube.com/watch?v=pQzaHPoNX1I\"]",
304
+ "lastPullInfo": null,
305
+ "lastPushInfo": null,
306
+ "lastProcess": null,
307
+ "eventType": null,
308
+ "createdAt": "2018-06-21T14:33:36.000Z",
309
+ "updatedAt": "2018-06-21T14:33:36.000Z"
310
+ }
311
+ ```
312
+
313
+ ## List all recorded files
314
+ Retrieves list of recorded file after streamed (only available when your live event has turned on Record feature)
315
+
316
+ See details [here](https://docs.uiza.io/#list-all-recorded-files).
317
+
318
+ ```ruby
319
+ require "uiza"
320
+
321
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
322
+ Uiza.authorization = "your-authorization"
323
+
324
+ begin
325
+ live = Uiza::Live.list_recorded limit: 2
326
+ puts live.first.id
327
+ puts live.first.entityId
328
+ rescue Uiza::Error::UizaError => e
329
+ puts "description_link: #{e.description_link}"
330
+ puts "code: #{e.code}"
331
+ puts "message: #{e.message}"
332
+ rescue StandardError => e
333
+ puts "message: #{e.message}"
334
+ end
335
+ ```
336
+
337
+ Example Response
338
+ ```ruby
339
+ {
340
+ "id": "040df935-61c4-46f7-a41f-0a899ebaa2cc",
341
+ "entityId": "ee122e85-553f-4621-bc77-1396191d5846",
342
+ "channelName": "dcb8686f-d0f8-4a0f-8b92-22db339eb315",
343
+ "feedId": "3e3b75df-e6fa-471c-b386-8f44b8a34b6c",
344
+ "eventType": "pull",
345
+ "startTime": "2018-12-13T16:28:29.000Z",
346
+ "endTime": "2018-12-13T18:28:29.000Z",
347
+ "length": "7200",
348
+ "fileSize": "9276182",
349
+ "extraInfo": null,
350
+ "endpointConfig": "s3-uiza-dvr",
351
+ "createdAt": "2018-12-13T19:28:43.000Z",
352
+ "updatedAt": "2018-12-13T19:28:43.000Z",
353
+ "entityName": "Christmas 2018 Holidays Special | Best Christmas Songs & Cartoons for Kids & Babies on Baby First TV"
354
+ },
355
+ {
356
+ "id": "3fec45e9-932b-4efe-b97f-dc3053acaa05",
357
+ "entityId": "47e804bc-d4e5-4442-8f1f-20341a156a70",
358
+ "channelName": "e9034eac-4905-4f9a-8e79-c0bd67e49dd5",
359
+ "feedId": "12830696-87e3-4209-a877-954f8f008964",
360
+ "eventType": "pull",
361
+ "startTime": "2018-12-13T14:14:14.000Z",
362
+ "endTime": "2018-12-13T16:14:14.000Z",
363
+ "length": "7200",
364
+ "fileSize": "439858038",
365
+ "extraInfo": null,
366
+ "endpointConfig": "s3-uiza-dvr",
367
+ "createdAt": "2018-12-13T17:30:42.000Z",
368
+ "updatedAt": "2018-12-13T17:30:42.000Z",
369
+ "entityName": "WATCH: SpaceX to Launch Falcon 9 Rocket #Spaceflight CRS16 @1:16pm EST"
370
+ }
371
+ ```
372
+
373
+ ## Delete a record file
374
+ Delete a recorded file
375
+
376
+ See details [here](https://docs.uiza.io/#delete-a-record-file).
377
+
378
+ ```ruby
379
+ require "uiza"
380
+
381
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
382
+ Uiza.authorization = "your-authorization"
383
+
384
+ begin
385
+ live = Uiza::Live.delete "your-record-id" #Identifier of record (get from list record)
386
+ puts live.id
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
+ "id": "040df935-61c4-46f7-a41f-0a899ebaa2cc"
400
+ }
401
+ ```
402
+
403
+ ## Convert into VOD
404
+ Convert recorded file into VOD entity. After converted, your file can be stream via Uiza's CDN.
405
+
406
+ See details [here](https://docs.uiza.io/#convert-into-vod).
407
+
408
+ ```ruby
409
+ require "uiza"
410
+
411
+ Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
412
+ Uiza.authorization = "your-authorization"
413
+
414
+ begin
415
+ live = Uiza::Live.convert_to_vod "your-record-id" #Identifier of record (get from list record)
416
+ puts live.id
417
+ rescue Uiza::Error::UizaError => e
418
+ puts "description_link: #{e.description_link}"
419
+ puts "code: #{e.code}"
420
+ puts "message: #{e.message}"
421
+ rescue StandardError => e
422
+ puts "message: #{e.message}"
423
+ end
424
+ ```
425
+
426
+ Example Response
427
+ ```ruby
428
+ {
429
+ "id": "03739912-d781-4d5a-aaf8-7262691a5d0c"
430
+ }
431
+ ```
@@ -4,6 +4,7 @@ require "json"
4
4
 
5
5
  require "uiza/version"
6
6
  require "uiza/uiza_client"
7
+ require "uiza/uiza_open_struct"
7
8
 
8
9
  require "uiza/error/uiza_error"
9
10
  require "uiza/error/bad_request_error"
@@ -26,6 +27,8 @@ require "uiza/api_operation/remove"
26
27
  require "uiza/entity"
27
28
  require "uiza/storage"
28
29
  require "uiza/category"
30
+ require "uiza/live"
31
+ require "uiza/callback"
29
32
 
30
33
  module Uiza
31
34
  class << self
@@ -0,0 +1,16 @@
1
+ module Uiza
2
+ class Callback
3
+ extend Uiza::APIOperation::Create
4
+ extend Uiza::APIOperation::Retrieve
5
+ extend Uiza::APIOperation::Update
6
+ extend Uiza::APIOperation::Delete
7
+
8
+ OBJECT_API_PATH = "media/entity/callback".freeze
9
+ OBJECT_API_DESCRIPTION_LINK = {
10
+ create: "https://docs.uiza.io/#create-a-callback",
11
+ retrieve: "https://docs.uiza.io/#retrieve-a-callback",
12
+ update: "https://docs.uiza.io/#update-a-callback",
13
+ delete: "https://docs.uiza.io/#delete-a-callback"
14
+ }.freeze
15
+ end
16
+ end
@@ -0,0 +1,86 @@
1
+ module Uiza
2
+ class Live
3
+ extend Uiza::APIOperation::Create
4
+ extend Uiza::APIOperation::Retrieve
5
+ extend Uiza::APIOperation::Update
6
+
7
+ OBJECT_API_PATH = "live/entity".freeze
8
+ OBJECT_API_DESCRIPTION_LINK = {
9
+ create: "https://docs.uiza.io/#create-a-live-event",
10
+ retrieve: "https://docs.uiza.io/#retrieve-a-live-event",
11
+ update: "https://docs.uiza.io/#update-a-live-event",
12
+ start_feed: "https://docs.uiza.io/#start-a-live-feed",
13
+ list_recorded: "https://docs.uiza.io/#list-all-recorded-files",
14
+ stop_feed: "https://docs.uiza.io/#stop-a-live-feed",
15
+ get_view: "https://docs.uiza.io/#get-view-of-live-feed",
16
+ delete: "https://docs.uiza.io/#delete-a-record-file",
17
+ convert_to_vod: "https://docs.uiza.io/#convert-into-vod"
18
+ }.freeze
19
+
20
+ class << self
21
+ def start_feed id
22
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/feed"
23
+ method = :post
24
+ headers = {"Authorization" => Uiza.authorization}
25
+ params = {id: id}
26
+
27
+ uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:start_feed]
28
+ response = uiza_client.execute_request
29
+
30
+ retrieve response.entityId
31
+ end
32
+
33
+ def get_view id
34
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/tracking/current-view"
35
+ method = :get
36
+ headers = {"Authorization" => Uiza.authorization}
37
+ params = {id: id}
38
+ description_link = OBJECT_API_DESCRIPTION_LINK[:get_view]
39
+
40
+ uiza_client = UizaClient.new url, method, headers, params, description_link
41
+ uiza_client.execute_request
42
+ end
43
+
44
+ def stop_feed id
45
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/feed"
46
+ method = :put
47
+ headers = {"Authorization" => Uiza.authorization}
48
+ params = {id: id}
49
+
50
+ uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:stop_feed]
51
+ response = uiza_client.execute_request
52
+
53
+ retrieve response.entityId
54
+ end
55
+
56
+ def list_recorded params = {}
57
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr"
58
+ method = :get
59
+ headers = {"Authorization" => Uiza.authorization}
60
+
61
+ uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:list_recorded]
62
+ uiza_client.execute_request
63
+ end
64
+
65
+ def delete id
66
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr"
67
+ method = :delete
68
+ headers = {"Authorization" => Uiza.authorization}
69
+ params = {id: id}
70
+
71
+ uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:delete]
72
+ uiza_client.execute_request
73
+ end
74
+
75
+ def convert_to_vod id
76
+ url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr/convert-to-vod"
77
+ method = :post
78
+ headers = {"Authorization" => Uiza.authorization}
79
+ params = {id: id}
80
+
81
+ uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:convert_to_vod]
82
+ uiza_client.execute_request
83
+ end
84
+ end
85
+ end
86
+ end
@@ -35,7 +35,17 @@ module Uiza
35
35
  check_and_raise_error code, message
36
36
 
37
37
  data = @response["data"]
38
- JSON.parse(data.to_json, object_class: OpenStruct)
38
+ response = JSON.parse(data.to_json, object_class: Uiza::UizaOpenStruct)
39
+
40
+ return response unless response
41
+
42
+ if response.is_a?(Array)
43
+ response.each(&:define_methods)
44
+ else
45
+ response.define_methods
46
+ end
47
+
48
+ response
39
49
  end
40
50
 
41
51
  private
@@ -47,26 +57,26 @@ module Uiza
47
57
 
48
58
  return if code.to_s =~ reg_2xx
49
59
 
50
- case code.to_s
51
- when "400"
52
- error = Uiza::Error::BadRequestError.new @description_link, message
53
- when "401"
54
- error = Uiza::Error::UnauthorizedError.new @description_link, message
55
- when "404"
56
- error = Uiza::Error::NotFoundError.new @description_link, message
57
- when "422"
58
- error = Uiza::Error::UnprocessableError.new @description_link, message
59
- when "500"
60
- error = Uiza::Error::InternalServerError.new @description_link, message
61
- when "503"
62
- error = Uiza::Error::ServiceUnavailableError.new @description_link, message
63
- when reg_4xx
64
- error = Uiza::Error::ClientError.new @description_link, message, code
65
- when reg_5xx
66
- error = Uiza::Error::ServerError.new @description_link, message, code
67
- else
68
- error = Uiza::Error::UizaError.new @description_link, message, code
69
- end
60
+ error = case code.to_s
61
+ when "400"
62
+ Uiza::Error::BadRequestError.new @description_link, message
63
+ when "401"
64
+ Uiza::Error::UnauthorizedError.new @description_link, message
65
+ when "404"
66
+ Uiza::Error::NotFoundError.new @description_link, message
67
+ when "422"
68
+ Uiza::Error::UnprocessableError.new @description_link, message
69
+ when "500"
70
+ Uiza::Error::InternalServerError.new @description_link, message
71
+ when "503"
72
+ Uiza::Error::ServiceUnavailableError.new @description_link, message
73
+ when reg_4xx
74
+ Uiza::Error::ClientError.new @description_link, message, code
75
+ when reg_5xx
76
+ Uiza::Error::ServerError.new @description_link, message, code
77
+ else
78
+ Uiza::Error::UizaError.new @description_link, message, code
79
+ end
70
80
 
71
81
  raise error, message
72
82
  end
@@ -0,0 +1,18 @@
1
+ module Uiza
2
+ class UizaOpenStruct < OpenStruct
3
+ def define_methods
4
+ data = to_h
5
+ data.each do |key, value|
6
+ if value.is_a?(Uiza::UizaOpenStruct)
7
+ value.define_methods
8
+ else
9
+ define_singleton_method(key) do |*args|
10
+ return super(*args) if args.any?
11
+
12
+ value
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Uiza
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "1.0.1".freeze
3
3
  end
@@ -4,7 +4,7 @@ require "uiza/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "uiza"
7
- spec.version = "1.0.0"
7
+ spec.version = Uiza::VERSION
8
8
  spec.required_ruby_version = ">= 2.0.0"
9
9
  spec.authors = ["Vo Khanh Toan"]
10
10
  spec.email = ["toanvk@uiza.io"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uiza
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vo Khanh Toan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,6 +90,7 @@ files:
90
90
  - lib/uiza/api_operation/remove.rb
91
91
  - lib/uiza/api_operation/retrieve.rb
92
92
  - lib/uiza/api_operation/update.rb
93
+ - lib/uiza/callback.rb
93
94
  - lib/uiza/category.rb
94
95
  - lib/uiza/entity.rb
95
96
  - lib/uiza/error/bad_request_error.rb
@@ -101,8 +102,10 @@ files:
101
102
  - lib/uiza/error/uiza_error.rb
102
103
  - lib/uiza/error/unauthorized_error.rb
103
104
  - lib/uiza/error/unprocessable_error.rb
105
+ - lib/uiza/live.rb
104
106
  - lib/uiza/storage.rb
105
107
  - lib/uiza/uiza_client.rb
108
+ - lib/uiza/uiza_open_struct.rb
106
109
  - lib/uiza/version.rb
107
110
  - uiza.gemspec
108
111
  homepage: https://docs.uiza.io