sproutvideo-rb 1.6.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +2 -4
- data/Gemfile.lock +25 -17
- data/LICENSE.txt +1 -1
- data/README.markdown +275 -29
- data/lib/sproutvideo/access_grant.rb +4 -0
- data/lib/sproutvideo/analytics.rb +62 -38
- data/lib/sproutvideo/call_to_action.rb +39 -0
- data/lib/sproutvideo/folder.rb +28 -0
- data/lib/sproutvideo/live_stream.rb +43 -0
- data/lib/sproutvideo/resource.rb +10 -14
- data/lib/sproutvideo/subtitle.rb +39 -0
- data/lib/sproutvideo/version.rb +1 -1
- data/lib/sproutvideo/video.rb +4 -5
- data/lib/sproutvideo.rb +16 -12
- data/spec/sproutvideo/access_grant_spec.rb +14 -3
- data/spec/sproutvideo/analytics_spec.rb +128 -14
- data/spec/sproutvideo/call_to_action_spec.rb +98 -0
- data/spec/sproutvideo/folder_spec.rb +107 -0
- data/spec/sproutvideo/live_stream_spec.rb +152 -0
- data/spec/sproutvideo/login_spec.rb +1 -1
- data/spec/sproutvideo/playlist_spec.rb +1 -1
- data/spec/sproutvideo/subtitle_spec.rb +98 -0
- data/spec/sproutvideo/tag_spec.rb +1 -1
- data/spec/sproutvideo/video_spec.rb +4 -4
- data/sproutvideo-rb.gemspec +19 -21
- metadata +43 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 47db233bcc6fd3d734a1ad76d712d7c164237262d362b19964c18e94672531b9
|
4
|
+
data.tar.gz: b97f26548146f07cde07fb06cdf24b4e0493136242315b4c5936d9926772ac0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13a29044a7761786a0fe03fab8cbb52559397b833fee87bba12fbb80adf0878726e103f2635d2165c68a3564eefb02ef7820b6d54f6b2a72579c59f168df5faa
|
7
|
+
data.tar.gz: 5628e387c711581b685a27262a4d7e8e802e348db65e1433eaa2c245ab7c3f2f99e9df7ca9fbf8cd1fb3d7b7ce0faf4824f67afb8a53b2cebc489b2f818472cb
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,20 +2,23 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.3)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
rest-client (1.
|
18
|
-
|
5
|
+
domain_name (0.5.20190701)
|
6
|
+
unf (>= 0.0.5, < 1.0.0)
|
7
|
+
http-accept (1.7.0)
|
8
|
+
http-cookie (1.0.3)
|
9
|
+
domain_name (~> 0.5)
|
10
|
+
json (2.3.0)
|
11
|
+
mime-types (3.3.1)
|
12
|
+
mime-types-data (~> 3.2015)
|
13
|
+
mime-types-data (3.2020.0512)
|
14
|
+
multi_json (1.14.1)
|
15
|
+
netrc (0.11.0)
|
16
|
+
rdoc (6.3.1)
|
17
|
+
rest-client (2.1.0)
|
18
|
+
http-accept (>= 1.7.0, < 2.0)
|
19
|
+
http-cookie (>= 1.0.2, < 2.0)
|
20
|
+
mime-types (>= 1.16, < 4.0)
|
21
|
+
netrc (~> 0.8)
|
19
22
|
rspec (2.8.0)
|
20
23
|
rspec-core (~> 2.8.0)
|
21
24
|
rspec-expectations (~> 2.8.0)
|
@@ -24,14 +27,19 @@ GEM
|
|
24
27
|
rspec-expectations (2.8.0)
|
25
28
|
diff-lcs (~> 1.1.2)
|
26
29
|
rspec-mocks (2.8.0)
|
30
|
+
unf (0.1.4)
|
31
|
+
unf_ext
|
32
|
+
unf_ext (0.0.7.7)
|
27
33
|
|
28
34
|
PLATFORMS
|
29
35
|
ruby
|
30
36
|
|
31
37
|
DEPENDENCIES
|
32
|
-
|
33
|
-
jeweler (~> 1.8.3)
|
38
|
+
json (~> 2.3.0)
|
34
39
|
multi_json
|
35
|
-
rdoc (~> 3.
|
40
|
+
rdoc (~> 6.3.1)
|
36
41
|
rest-client
|
37
42
|
rspec (~> 2.8.0)
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.17.3
|
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
@@ -22,7 +22,7 @@ ENV['SPROUTVIDEO_API_KEY'] = 'abcd1234'
|
|
22
22
|
# Videos
|
23
23
|
The following methods are available: `list`, `create`, `details`, `update`, `upload_poster_frame`,`destroy`.
|
24
24
|
|
25
|
-
##list
|
25
|
+
## list
|
26
26
|
By default the videos listing is paginated with 25 videos per page and sorted by upload date in ascending order.
|
27
27
|
You can pass two parameters to control the paging: `page` and `per_page`.
|
28
28
|
|
@@ -53,14 +53,14 @@ Sproutvideo::Video.list(:state => "processing")
|
|
53
53
|
Values of `privacy` is listed at [Video Privacy](http://sproutvideo.com/docs/api.html#VideoPrivacy) section.
|
54
54
|
Values of `state` is listed at [Video States](http://sproutvideo.com/docs/api.html#VideoStates) section.
|
55
55
|
|
56
|
-
##details
|
56
|
+
## details
|
57
57
|
The string passed to details is the ID of a SproutVideo video.
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
Sproutvideo::Video.details('abc123')
|
61
61
|
```
|
62
62
|
|
63
|
-
##create
|
63
|
+
## create
|
64
64
|
The most basic upload you can perform is to just pass the path to the video file to the method. The title of the video will default to the name of the file.
|
65
65
|
|
66
66
|
```ruby
|
@@ -97,21 +97,21 @@ Sproutvideo::Video.create('/path/to/video.mp4',
|
|
97
97
|
:notification_url => 'http://example.com/webhook_url')
|
98
98
|
```
|
99
99
|
|
100
|
-
##update
|
100
|
+
## update
|
101
101
|
The first parameter is the id of the video you wish to edit. The second parameter is a hash of attributes to update on the video.
|
102
102
|
|
103
103
|
```ruby
|
104
104
|
Sproutvideo::Video.update('abc123', :title => 'Updated Title')
|
105
105
|
```
|
106
106
|
|
107
|
-
##
|
107
|
+
## Replace a video
|
108
108
|
The first parameter is the id of the video you wish to replace. The second parameter is the local path to the video file.
|
109
109
|
|
110
110
|
```ruby
|
111
111
|
Sproutvideo::Video.replace('abc123', '/path/to/video.mp4')
|
112
112
|
```
|
113
113
|
|
114
|
-
|
114
|
+
## Dealing with tags
|
115
115
|
To add a tag to a video, make sure to include all of the tags currently associated with the video. For instance if the video already has tags with the ids "abc" and "123" and you want to add a tag with the id "def" do pass "abc", "123" and "def" to the update method.
|
116
116
|
|
117
117
|
```ruby
|
@@ -131,25 +131,25 @@ You can remove all of the tags from a video by just passing an empty array as th
|
|
131
131
|
```ruby
|
132
132
|
Sproutvideo::Video.update('abc123', :tags => [])
|
133
133
|
```
|
134
|
-
##Upload poster frame
|
134
|
+
## Upload poster frame
|
135
135
|
You can upload a custom poster frame for a video by calling the upload_poster_frame method. The first parameter is the id of the video for wish you'd like the poster frame to be associated and the second parameter is the path to the image file.
|
136
136
|
|
137
137
|
```ruby
|
138
|
-
|
138
|
+
Sproutvideo::Video.upload_poster_frame('abc123', '/path/to/image.jpg')
|
139
139
|
```
|
140
140
|
|
141
|
-
##destroy
|
141
|
+
## destroy
|
142
142
|
Pass in the id of the video you wish to delete.
|
143
143
|
|
144
144
|
```ruby
|
145
145
|
Sproutvideo::Video.destroy('abc123')
|
146
146
|
```
|
147
147
|
|
148
|
-
##Signed Embed Codes
|
148
|
+
## Signed Embed Codes
|
149
149
|
You can use this convenience method to sign an embed code. It will return the embed code URL which can be used to build an iframe embed code.
|
150
150
|
`Sproutvideo::Video.signed_embed_code(video_id, security_token, query_parameters, expiration_time, protocol)`
|
151
151
|
|
152
|
-
###Parameters
|
152
|
+
### Parameters
|
153
153
|
video_id - _String_ (_Required_)
|
154
154
|
: The id of the video for which you're generating the signed embed code
|
155
155
|
|
@@ -165,7 +165,7 @@ expiration_time - _Integer_ (_Optional_)
|
|
165
165
|
protocol - _String_ (_Optional_)
|
166
166
|
: `http` or `https`. Defaults to `http`
|
167
167
|
|
168
|
-
###Examples
|
168
|
+
### Examples
|
169
169
|
```ruby
|
170
170
|
Sproutvideo::Video.signed_embed_code('abc123','def456') #sign a base embed code with no other options
|
171
171
|
Sproutvideo::Video.signed_embed_code('abc123','def456', {'type' => 'hd'}) #set parameters for the embed code such as changing the default video type to HD
|
@@ -180,11 +180,12 @@ The following methods are available: `create`
|
|
180
180
|
Sproutvideo::UploadToken.create
|
181
181
|
Sproutvideo::UploadToken.create(:return_url => 'http://example.com')
|
182
182
|
Sproutvideo::UploadToken.create(:return_url => 'http://example.com', :seconds_valid => 3600)
|
183
|
+
```
|
183
184
|
|
184
185
|
# Tags
|
185
186
|
The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
|
186
187
|
|
187
|
-
##list
|
188
|
+
## list
|
188
189
|
By default the tag listing is paginated with 25 tags per page and sorted by created at date in ascending order. You can pass two parameters to control the paging: page and per_page.
|
189
190
|
|
190
191
|
```ruby
|
@@ -193,27 +194,69 @@ Sproutvideo::Tag.list(:per_page => 10)
|
|
193
194
|
Sproutvideo::Tag.list(:per_page => 10, :page => 2)
|
194
195
|
```
|
195
196
|
|
196
|
-
##create
|
197
|
+
## create
|
197
198
|
|
198
199
|
```ruby
|
199
200
|
Sproutvideo::Tag.create(:name => 'new tag')
|
200
201
|
```
|
201
202
|
|
202
|
-
##update
|
203
|
+
## update
|
203
204
|
```ruby
|
204
205
|
Sproutvideo::Tag.update('abc123', :name => 'updated tag name')
|
205
206
|
```
|
206
207
|
|
207
|
-
##destroy
|
208
|
+
## destroy
|
208
209
|
Pass in the id of the tag you wish to delete.
|
209
210
|
|
210
211
|
```ruby
|
211
212
|
Sproutvideo::Tag.destroy('abc123')
|
212
213
|
```
|
214
|
+
# Folders
|
215
|
+
The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
|
216
|
+
## list
|
217
|
+
By default, the folder listing is paginated with 25 folders per page and sorted by `created_at` date in ascending order. You can pass tow parameters to control the paging: `page` and `per_page`. If you do not pass in a `parent_id` only the folders within the root folder will be returned. To get the folders in a specific folder, make sure to pass in that folder's id using the `parent_id` parameter.
|
218
|
+
```ruby
|
219
|
+
Sproutvideo::Folder.list
|
220
|
+
Sproutvideo::Folder.last(:per_page => 10)
|
221
|
+
Sproutvideo::Folder.last(:per_page => 10, :page => 2)
|
222
|
+
Sproutvideo::Folder.last(:parent_id => 'def456')
|
223
|
+
```
|
224
|
+
|
225
|
+
## create
|
226
|
+
Creating a folder without a `parent_id` will place that folder in the root folder. Passing in a `parent_id` will place the newly created folder in the folder specified by `parent_id`.
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
# folder is created in the root folder.
|
230
|
+
Sproutvideo::Folder.create(:name => 'New Folder')
|
231
|
+
|
232
|
+
# folder is created as a child of the folder specified by the id 'def456'
|
233
|
+
Sproutvideo::Folder.create(:name => 'New Folder', :parent_id => 'def456')
|
234
|
+
```
|
235
|
+
|
236
|
+
## details
|
237
|
+
```ruby
|
238
|
+
Sproutvideo::Folder.details('def456')
|
239
|
+
```
|
240
|
+
|
241
|
+
## update
|
242
|
+
```ruby
|
243
|
+
Sproutvideo::Folder.update('def456', :name => 'New Folder Name')
|
244
|
+
```
|
245
|
+
|
246
|
+
## delete
|
247
|
+
By default, when deleting a folder, all of the contents of that folder (videos and folders), will be moved the root folder to prevent unintended data loss. If you wish to actually delete all of the content of a folder, make sure to pass in `delete_all` as true.
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
# delete the folder and move it's contents to the root folder
|
251
|
+
Sproutvideo::Folder.destroy('def456')
|
252
|
+
|
253
|
+
# delete the folder and everything in it.
|
254
|
+
Sproutvideo::Folder.destroy('def456', :delete_all => true)
|
255
|
+
```
|
213
256
|
|
214
257
|
# Playlists
|
215
258
|
The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
|
216
|
-
##list
|
259
|
+
## list
|
217
260
|
By default the playlist listing is paginated with 25 playlists per page and sorted by created at date in ascending order. You can pass two parameters to control the paging: page and per_page.
|
218
261
|
|
219
262
|
```ruby
|
@@ -222,7 +265,7 @@ Sproutvideo::Playlist.list(:per_page => 10)
|
|
222
265
|
Sproutvideo::Playlist.list(:per_page => 10, :page => 2)
|
223
266
|
```
|
224
267
|
|
225
|
-
##create
|
268
|
+
## create
|
226
269
|
You can add videos to a playlist when creating it by passing in the videos you'd like to add in the videos parameter in the order you'd like them to appear.
|
227
270
|
|
228
271
|
```ruby
|
@@ -231,7 +274,7 @@ Sproutvideo::Playlist.create(
|
|
231
274
|
:privacy => 2,
|
232
275
|
:videos => ['abc123','def456','ghi789'])
|
233
276
|
```
|
234
|
-
##update
|
277
|
+
## update
|
235
278
|
|
236
279
|
```ruby
|
237
280
|
Sproutvideo::Playlist.update('abc123',
|
@@ -258,7 +301,7 @@ You can remove all of the videos from a playlist by just passing an empty array
|
|
258
301
|
Sproutvideo::Playlist.update('abc123', :videos => [])
|
259
302
|
```
|
260
303
|
|
261
|
-
##destroy
|
304
|
+
## destroy
|
262
305
|
Pass in the id of the playlist you wish to delete.
|
263
306
|
|
264
307
|
```ruby
|
@@ -308,6 +351,7 @@ Pass in the id of the login you wish to delete.
|
|
308
351
|
```ruby
|
309
352
|
Sproutvideo::Login.destroy('asdf1234')
|
310
353
|
```
|
354
|
+
|
311
355
|
# Access Grants
|
312
356
|
The following methods are available: `list`, `create`, `details`, `update`, `destroy`
|
313
357
|
|
@@ -328,6 +372,20 @@ Sproutvideo::AccessGrant.create(
|
|
328
372
|
:video_id => 'abc123',
|
329
373
|
:login_id => 'abc123')
|
330
374
|
```
|
375
|
+
## bulk_create
|
376
|
+
bulk_create takes an array of access grant objects and creates them in a single API call to efficiently create access grants in bulk and reduce the number of API calls needed.
|
377
|
+
|
378
|
+
```ruby
|
379
|
+
Sproutvideo::AccessGrant.bulk_create([
|
380
|
+
{
|
381
|
+
:video_id => 'abc123',
|
382
|
+
:login_id => 'abc123'
|
383
|
+
},{
|
384
|
+
:video_id => 'def456',
|
385
|
+
:login_id => 'def456'
|
386
|
+
}
|
387
|
+
])
|
388
|
+
```
|
331
389
|
|
332
390
|
## details
|
333
391
|
The string passed to details is the ID of a SproutVideo login.
|
@@ -346,7 +404,7 @@ Sproutvideo::AccessGrant.update('abc123',
|
|
346
404
|
:access_ends_at => DateTime.parse('8/4/2014'))
|
347
405
|
```
|
348
406
|
|
349
|
-
##
|
407
|
+
## destroy
|
350
408
|
Pass in the id of the access grant you wish to delete.
|
351
409
|
|
352
410
|
```ruby
|
@@ -367,8 +425,9 @@ Check the API documentation for more information about the data returned by thes
|
|
367
425
|
Each method can be called on it's own for overall account data for all time like this:
|
368
426
|
```ruby
|
369
427
|
Sproutvideo::Analytics.play_counts
|
428
|
+
Sproutvideo::Analytics.download_counts
|
370
429
|
Sproutvideo::Analytics.domains
|
371
|
-
|
430
|
+
Sproutvideo::Analytics.geo
|
372
431
|
Sproutvideo::Analytics.video_types
|
373
432
|
Sproutvideo::Analytics.playback_types
|
374
433
|
Sproutvideo::Analytics.device_types
|
@@ -376,44 +435,89 @@ Sproutvideo::Analytics.device_types
|
|
376
435
|
Each method can also take an options hash containing a :video_id for retrieving overall data for a specific video:
|
377
436
|
```ruby
|
378
437
|
Sproutvideo::Analytics.play_counts(:video_id => 'abc123')
|
438
|
+
Sproutvideo::Analytics.download_counts(:video_id => 'abc123')
|
379
439
|
Sproutvideo::Analytics.domains(:video_id => 'abc123')
|
380
|
-
|
440
|
+
Sproutvideo::Analytics.geo(:video_id => 'abc123')
|
381
441
|
Sproutvideo::Analytics.video_types(:video_id => 'abc123')
|
382
442
|
Sproutvideo::Analytics.playback_types(:video_id => 'abc123')
|
383
443
|
Sproutvideo::Analytics.device_types(:video_id => 'abc123')
|
384
444
|
```
|
445
|
+
The following methods can also take an options hash containing a :live_stream_id for retrieving overall data for a specific live_stream:
|
446
|
+
```ruby
|
447
|
+
Sproutvideo::Analytics.play_counts(:live_stream_id => 'abc123')
|
448
|
+
Sproutvideo::Analytics.domains(:live_stream_id => 'abc123')
|
449
|
+
Sproutvideo::Analytics.geo(:live_stream_id => 'abc123')
|
450
|
+
Sproutvideo::Analytics.device_types(:live_stream_id => 'abc123')
|
451
|
+
```
|
385
452
|
Each method can also take an optional :start_date and :end_date to specify a date range for the returned data:
|
386
453
|
```ruby
|
387
454
|
Sproutvideo::Analytics.play_counts(:start_date => '2013-01-01')
|
388
455
|
Sproutvideo::Analytics.device_types(:video_id => 'abc123', :end_date => '2012-12-31')
|
389
456
|
```
|
390
457
|
|
391
|
-
|
458
|
+
The geo method can take an optional :country to retrieve playback data by city within that country
|
392
459
|
```ruby
|
393
460
|
Sproutvideo::Analytics.geo(:video_id => 'abc123', :country => 'US')
|
394
461
|
```
|
395
462
|
|
396
|
-
|
463
|
+
## Misc endpoints
|
464
|
+
see api docs for more info
|
465
|
+
|
466
|
+
```ruby
|
467
|
+
Sproutvideo::Analytics.popular_videos
|
468
|
+
SproutVideo::Analytics.popular_downloads
|
469
|
+
```
|
470
|
+
|
471
|
+
```ruby
|
472
|
+
Sproutvideo::Analytics.live_stream_overview('abc123')
|
473
|
+
```
|
474
|
+
|
475
|
+
# Engagement
|
397
476
|
You can grab the total number of seconds of your videos that have been watched like this:
|
398
477
|
```ruby
|
399
478
|
Sproutvideo::Analytics.engagement
|
400
479
|
```
|
401
480
|
|
481
|
+
and for all livestreams:
|
482
|
+
```ruby
|
483
|
+
Sproutvideo::Analytics.live_stream_engagement
|
484
|
+
```
|
485
|
+
|
402
486
|
You can grab engagement for a specific video like so:
|
403
487
|
```ruby
|
404
488
|
Sproutvideo::Analytics.engagement(:video_id => 'abc123')
|
405
489
|
```
|
406
490
|
|
491
|
+
or for a specific live stream:
|
492
|
+
```ruby
|
493
|
+
Sproutvideo::Analytics.live_stream_engagement(:live_stream_id => 'abc123')
|
494
|
+
```
|
495
|
+
|
496
|
+
You can grab playback sessions data for your videos with:
|
497
|
+
```ruby
|
498
|
+
Sproutvideo::Analytics.engagement_sessions
|
499
|
+
```
|
500
|
+
|
501
|
+
and for live streams with
|
502
|
+
```ruby
|
503
|
+
Sproutvideo::Analytics.live_stream_engagement_sessions
|
504
|
+
```
|
505
|
+
|
407
506
|
Lastly, you can grab every single playback session for a video like this:
|
408
507
|
```ruby
|
409
508
|
Sproutvideo::Analytics.engagement_sessions('abc123')
|
410
|
-
Sproutvideo::Analytics.engagement_sessions('abc123', :
|
411
|
-
Sproutvideo::Analytics.engagement_sessions('abc123', :
|
509
|
+
Sproutvideo::Analytics.engagement_sessions('abc123', page: 3)
|
510
|
+
Sproutvideo::Analytics.engagement_sessions('abc123', page: 3, :per_page => 40)
|
511
|
+
```
|
512
|
+
|
513
|
+
and for a live stream:
|
514
|
+
```ruby
|
515
|
+
Sproutvideo::Analytics.live_stream_engagement_sessions('abc123')
|
412
516
|
```
|
413
517
|
|
414
518
|
You can also grab engagement sessions for a video for a specific email address like so:
|
415
519
|
```ruby
|
416
|
-
Sproutvideo::Analytics.engagement_sessions('abc123', :
|
520
|
+
Sproutvideo::Analytics.engagement_sessions(video_id: 'abc123', vemail: 'test@example.com')
|
417
521
|
```
|
418
522
|
|
419
523
|
# Account
|
@@ -433,6 +537,148 @@ To update account settings:
|
|
433
537
|
Sproutvideo::Account.update({download_sd: true})
|
434
538
|
```
|
435
539
|
|
540
|
+
# Subtitles
|
541
|
+
The following methods are available: `list`, `create`, `details`, `update`, `destroy`. All requests for a subtitle must be given a `video_id` option indicating the video that you want to access or update the subtitles of.
|
542
|
+
|
543
|
+
## list
|
544
|
+
By default the subtitle listing is paginated with 25 tags per page and sorted by created at date in ascending order. You can pass two parameters to control the paging: page and per_page.
|
545
|
+
|
546
|
+
```ruby
|
547
|
+
Sproutvideo::Subtitle.list(:video_id => 'abc123')
|
548
|
+
Sproutvideo::Subtitle.list(:video_id => 'abc123', :per_page => 10)
|
549
|
+
Sproutvideo::Subtitle.list(:video_id => 'abc123', :per_page => 10, :page => 2)
|
550
|
+
```
|
551
|
+
|
552
|
+
## create
|
553
|
+
Create takes three required parameters, `video_id`, `language`, and `content`, which will be to add the newly created subtitle file and associate it with the provided video id.
|
554
|
+
|
555
|
+
```ruby
|
556
|
+
Sproutvideo::Subtitle.create(
|
557
|
+
:video_id => 'abc123',
|
558
|
+
:language => 'en',
|
559
|
+
:content => 'WEBVTT FILE...')
|
560
|
+
```
|
561
|
+
|
562
|
+
## details
|
563
|
+
pass both the video and the subtitle id.
|
564
|
+
|
565
|
+
```ruby
|
566
|
+
Sproutvideo::Subtitle.details(:video_id => 'abc123', id: 'fdc432')
|
567
|
+
```
|
568
|
+
|
569
|
+
## update
|
570
|
+
|
571
|
+
You can change the optional parameters for a subtitle.
|
572
|
+
|
573
|
+
```ruby
|
574
|
+
Sproutvideo::Subtitle.create(
|
575
|
+
:video_id => 'abc123',
|
576
|
+
:language => 'de',
|
577
|
+
:id => 'fdc432')
|
578
|
+
```
|
579
|
+
|
580
|
+
## destroy
|
581
|
+
Pass in the id of the subtitle you wish to delete.
|
582
|
+
|
583
|
+
```ruby
|
584
|
+
Sproutvideo::Subtitle.destroy(:video_id => 'abc123', id: 'fdc432')
|
585
|
+
```
|
586
|
+
|
587
|
+
# Calls to Action
|
588
|
+
The following methods are available: `list`, `create`, `details`, `update`, `destroy`. All requests for a call to action must be given a `video_id` option indicating the video that you want to access or update the calls to action of.
|
589
|
+
|
590
|
+
## list
|
591
|
+
By default the call to action listing is paginated with 25 tags per page and sorted by created at date in ascending order. You can pass two parameters to control the paging: page and per_page.
|
592
|
+
|
593
|
+
```ruby
|
594
|
+
Sproutvideo::CallToAction.list(:video_id => 'abc123')
|
595
|
+
Sproutvideo::CallToAction.list(:video_id => 'abc123', :per_page => 10)
|
596
|
+
Sproutvideo::CallToAction.list(:video_id => 'abc123', :per_page => 10, :page => 2)
|
597
|
+
```
|
598
|
+
|
599
|
+
## create
|
600
|
+
Create takes five required parameters, `video_id`, `text`, `url`, `start_time`, and `end_time`, which will be to add the newly created subtitle file and associate it with the provided video id.
|
601
|
+
|
602
|
+
```ruby
|
603
|
+
Sproutvideo::CallToAction.create(
|
604
|
+
:video_id => 'abc123',
|
605
|
+
:text => 'join now',
|
606
|
+
:start_time => 1,
|
607
|
+
:end_time => 2,
|
608
|
+
:content => 'https://sproutvideo.com')
|
609
|
+
```
|
610
|
+
|
611
|
+
## details
|
612
|
+
pass both the video and the call to action id.
|
613
|
+
|
614
|
+
```ruby
|
615
|
+
Sproutvideo::CallToAction.details(:video_id => 'abc123', id: 'fdc432')
|
616
|
+
```
|
617
|
+
|
618
|
+
## update
|
619
|
+
|
620
|
+
You can change the optional parameters for a call to action.
|
621
|
+
|
622
|
+
```ruby
|
623
|
+
Sproutvideo::CallToAction.create(
|
624
|
+
:video_id => 'abc123',
|
625
|
+
:text => 'get it done!',
|
626
|
+
:id => 'fdc432')
|
627
|
+
```
|
628
|
+
|
629
|
+
## destroy
|
630
|
+
Pass in the id of the call to action you wish to delete.
|
631
|
+
|
632
|
+
```ruby
|
633
|
+
Sproutvideo::CallToAction.destroy(:video_id => 'abc123', id: 'fdc432')
|
634
|
+
```
|
635
|
+
|
636
|
+
# Live Streams
|
637
|
+
The following methods are available: `list`, `create`, `details`, `update`, `destroy`, and `end_stream`.
|
638
|
+
|
639
|
+
## list
|
640
|
+
By default the call to action listing is paginated with 25 tags per page and sorted by created at date in ascending order. You can pass two parameters to control the paging: page and per_page.
|
641
|
+
|
642
|
+
```ruby
|
643
|
+
Sproutvideo::LiveStream.list
|
644
|
+
Sproutvideo::LiveStream.list(:per_page => 10, :page => 2)
|
645
|
+
```
|
646
|
+
|
647
|
+
## create
|
648
|
+
|
649
|
+
```ruby
|
650
|
+
Sproutvideo::LiveStream.create(title: 'hello')
|
651
|
+
# with a poster frame
|
652
|
+
Sproutvideo::LiveStream.create(title: 'hello', custom_poster_frame: '/path/to/posterframe.jpg')
|
653
|
+
```
|
654
|
+
|
655
|
+
## details
|
656
|
+
|
657
|
+
```ruby
|
658
|
+
Sproutvideo::LiveStream.details('abc123')
|
659
|
+
```
|
660
|
+
|
661
|
+
## update
|
662
|
+
You can change the optional parameters
|
663
|
+
|
664
|
+
```ruby
|
665
|
+
Sproutvideo::LiveStream.update(title: 'get it done!')
|
666
|
+
# with a poster frame
|
667
|
+
Sproutvideo::LiveStream.update(title: 'hello', custom_poster_frame: '/path/to/posterframe.jpg')
|
668
|
+
```
|
669
|
+
|
670
|
+
## destroy
|
671
|
+
|
672
|
+
```ruby
|
673
|
+
Sproutvideo::LiveStream.destroy('abc123')
|
674
|
+
```
|
675
|
+
|
676
|
+
## end_stream
|
677
|
+
|
678
|
+
```ruby
|
679
|
+
Sproutvideo::LiveStream.end_stream('abc123')
|
680
|
+
```
|
681
|
+
|
436
682
|
# Contributing to sproutvideo-rb
|
437
683
|
|
438
684
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
@@ -445,5 +691,5 @@ Sproutvideo::Account.update({download_sd: true})
|
|
445
691
|
|
446
692
|
# Copyright
|
447
693
|
|
448
|
-
Copyright (c)
|
694
|
+
Copyright (c) 2021 SproutVideo. See LICENSE.txt for
|
449
695
|
further details.
|