sproutvideo-rb 1.4.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ad6ec3d979542688f34704208ee14efe6277ab39
4
- data.tar.gz: d4f44469b318a69eff65a48095182a0d693ff6f6
2
+ SHA256:
3
+ metadata.gz: 8e13ddf68bf70448163cde8c0045b976926a0ed9927ce24b77fe33cd895f146f
4
+ data.tar.gz: 985a727c9bc400dbe0844496648d659d03c40d44816ee67aecd0c9d088e9b1f3
5
5
  SHA512:
6
- metadata.gz: c646c646866c5b578e2ed0bb75c1dde52f1c93c93e5dd072630e55554eebb9619cb38196f02113fb5d9e09266570049169113f5dd7bbecf17f348dc34f13a3a5
7
- data.tar.gz: fb781161700df5e73725efd22b3fd4539fffc4700ee1c3525946e7fa688ac2a7b9745df0c7da8987ec088537b7240eaa71133ff1436a09de008e75e9e6d0faf0
6
+ metadata.gz: b31337a738156031080f321fb5642ee55cefea66b3f1db8248d905599d88bbd0e0206e3bfa57df67960f184729ee0fa5e1187aa34b2996e9fcba6e19bfbe98ae
7
+ data.tar.gz: '050186fd9d93ac3f392297e7ed3ad106126a1b99a713dddd4b135654b36324e7672383edc268ae35f56452742b2a824654ad3ae06d0382007e69f444cdab1b60'
data/Gemfile CHANGED
@@ -1,11 +1,9 @@
1
1
  source "http://rubygems.org"
2
-
3
2
  gem "rest-client"
3
+ gem 'json', '~> 2.3.0'
4
4
  gem "multi_json"
5
5
 
6
6
  group :development do
7
7
  gem "rspec", "~> 2.8.0"
8
- gem "rdoc", "~> 3.12"
9
- gem "bundler"
10
- gem "jeweler", "~> 1.8.3"
8
+ gem "rdoc", "~> 6.3.1"
11
9
  end
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
- git (1.2.5)
6
- jeweler (1.8.3)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- rdoc
11
- json (1.6.5)
12
- mime-types (1.19)
13
- multi_json (1.0.4)
14
- rake (0.9.2.2)
15
- rdoc (3.12)
16
- json (~> 1.4)
17
- rest-client (1.6.1)
18
- mime-types (>= 1.16)
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
- bundler
33
- jeweler (~> 1.8.3)
38
+ json (~> 2.3.0)
34
39
  multi_json
35
- rdoc (~> 3.12)
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 SproutVideo
1
+ Copyright (c) 2020 SproutVideo
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -1,4 +1,4 @@
1
- #SproutVideo
1
+ # SproutVideo
2
2
  Use this gem to interact with the [SproutVideo API](http://sproutvideo.com/docs/api.html)
3
3
 
4
4
  # Getting Started
@@ -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
@@ -83,6 +83,13 @@ Sproutvideo::Video.create('/path/to/video.mp4',
83
83
  :tags => ['ec61', 'abc123'])
84
84
  ```
85
85
 
86
+ You can also create or add tags on the fly by passing in tag names:
87
+
88
+ ```ruby
89
+ Sproutvideo::Video.create('/path/to/video.mp4',
90
+ :tag_names => ['Tag One', 'Tag Two'])
91
+ ```
92
+
86
93
  You can also specify a webhook url. We'll send an HTTP POST with the video json when the video has finished processing or if there was an error during processing:
87
94
 
88
95
  ```ruby
@@ -90,14 +97,21 @@ Sproutvideo::Video.create('/path/to/video.mp4',
90
97
  :notification_url => 'http://example.com/webhook_url')
91
98
  ```
92
99
 
93
- ##update
100
+ ## update
94
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.
95
102
 
96
103
  ```ruby
97
104
  Sproutvideo::Video.update('abc123', :title => 'Updated Title')
98
105
  ```
99
106
 
100
- ## Tags
107
+ ## Replace a video
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
+
110
+ ```ruby
111
+ Sproutvideo::Video.replace('abc123', '/path/to/video.mp4')
112
+ ```
113
+
114
+ ## Dealing with tags
101
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.
102
116
 
103
117
  ```ruby
@@ -117,25 +131,25 @@ You can remove all of the tags from a video by just passing an empty array as th
117
131
  ```ruby
118
132
  Sproutvideo::Video.update('abc123', :tags => [])
119
133
  ```
120
- ##Upload poster frame
134
+ ## Upload poster frame
121
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.
122
136
 
123
137
  ```ruby
124
- SproutVideo::Video.upload_poster_frame('abc123', '/path/to/image.jpg')
138
+ Sproutvideo::Video.upload_poster_frame('abc123', '/path/to/image.jpg')
125
139
  ```
126
140
 
127
- ##destroy
141
+ ## destroy
128
142
  Pass in the id of the video you wish to delete.
129
143
 
130
144
  ```ruby
131
145
  Sproutvideo::Video.destroy('abc123')
132
146
  ```
133
147
 
134
- ##Signed Embed Codes
148
+ ## Signed Embed Codes
135
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.
136
150
  `Sproutvideo::Video.signed_embed_code(video_id, security_token, query_parameters, expiration_time, protocol)`
137
151
 
138
- ###Parameters
152
+ ### Parameters
139
153
  video_id - _String_ (_Required_)
140
154
  : The id of the video for which you're generating the signed embed code
141
155
 
@@ -151,19 +165,28 @@ expiration_time - _Integer_ (_Optional_)
151
165
  protocol - _String_ (_Optional_)
152
166
  : `http` or `https`. Defaults to `http`
153
167
 
154
- ###Examples
168
+ ### Examples
155
169
  ```ruby
156
170
  Sproutvideo::Video.signed_embed_code('abc123','def456') #sign a base embed code with no other options
157
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
158
172
  Sproutvideo::Video.signed_embed_code('abc123','def456', {}, 1368127991) #set a specific expiration time for the signed embed code. (By default the expiration time is set to 5 minutes from the time the signed embed code was generated).
159
173
  Sproutvideo::Video.signed_embed_code('abc123','def456', {}, nil, 'https') #Use https instead of http
160
174
  ```
175
+ # Upload Tokens
176
+ The following methods are available: `create`
177
+
178
+ ## Create
179
+ ```ruby
180
+ Sproutvideo::UploadToken.create
181
+ Sproutvideo::UploadToken.create(:return_url => 'http://example.com')
182
+ Sproutvideo::UploadToken.create(:return_url => 'http://example.com', :seconds_valid => 3600)
183
+ ```
161
184
 
162
185
  # Tags
163
186
  The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
164
187
 
165
- ##list
166
- 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.
188
+ ## list
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.
167
190
 
168
191
  ```ruby
169
192
  Sproutvideo::Tag.list
@@ -171,28 +194,70 @@ Sproutvideo::Tag.list(:per_page => 10)
171
194
  Sproutvideo::Tag.list(:per_page => 10, :page => 2)
172
195
  ```
173
196
 
174
- ##create
175
-
197
+ ## create
198
+
176
199
  ```ruby
177
200
  Sproutvideo::Tag.create(:name => 'new tag')
178
201
  ```
179
202
 
180
- ##update
203
+ ## update
181
204
  ```ruby
182
205
  Sproutvideo::Tag.update('abc123', :name => 'updated tag name')
183
206
  ```
184
207
 
185
- ##destroy
208
+ ## destroy
186
209
  Pass in the id of the tag you wish to delete.
187
210
 
188
211
  ```ruby
189
212
  Sproutvideo::Tag.destroy('abc123')
190
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
+ ```
191
256
 
192
257
  # Playlists
193
258
  The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
194
- ##list
195
- 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.
259
+ ## list
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.
196
261
 
197
262
  ```ruby
198
263
  Sproutvideo::Playlist.list
@@ -200,7 +265,7 @@ Sproutvideo::Playlist.list(:per_page => 10)
200
265
  Sproutvideo::Playlist.list(:per_page => 10, :page => 2)
201
266
  ```
202
267
 
203
- ##create
268
+ ## create
204
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.
205
270
 
206
271
  ```ruby
@@ -209,7 +274,7 @@ Sproutvideo::Playlist.create(
209
274
  :privacy => 2,
210
275
  :videos => ['abc123','def456','ghi789'])
211
276
  ```
212
- ##update
277
+ ## update
213
278
 
214
279
  ```ruby
215
280
  Sproutvideo::Playlist.update('abc123',
@@ -236,7 +301,7 @@ You can remove all of the videos from a playlist by just passing an empty array
236
301
  Sproutvideo::Playlist.update('abc123', :videos => [])
237
302
  ```
238
303
 
239
- ##destroy
304
+ ## destroy
240
305
  Pass in the id of the playlist you wish to delete.
241
306
 
242
307
  ```ruby
@@ -257,7 +322,7 @@ Sproutvideo::Login.list(:per_page => 10, :page => 2)
257
322
 
258
323
  ## create
259
324
  Create takes two required parameters, `email` and `password`, which will be used to allow a viewer to login to watch a video if the login has an assocaited `access_grant` for that video.
260
-
325
+
261
326
  ```ruby
262
327
  Sproutvideo::Login.create(
263
328
  :email => 'test@example.com',
@@ -276,7 +341,7 @@ Sproutvideo::Login.details('abc123')
276
341
  You can change the password for a login.
277
342
 
278
343
  ```ruby
279
- Sproutvideo::Login.update('abc123',
344
+ Sproutvideo::Login.update('abc123',
280
345
  :password => 'newpassword')
281
346
  ```
282
347
 
@@ -286,6 +351,7 @@ Pass in the id of the login you wish to delete.
286
351
  ```ruby
287
352
  Sproutvideo::Login.destroy('asdf1234')
288
353
  ```
354
+
289
355
  # Access Grants
290
356
  The following methods are available: `list`, `create`, `details`, `update`, `destroy`
291
357
 
@@ -300,12 +366,26 @@ Sproutvideo::AccessGrant.list(:per_page => 10, :page => 2)
300
366
 
301
367
  ## create
302
368
  Create takes two required parameters, `video_id` and `login_id`, which will be used to allow a viewer to login to watch a video based on the other optional parameters.
303
-
369
+
304
370
  ```ruby
305
371
  Sproutvideo::AccessGrant.create(
306
372
  :video_id => 'abc123',
307
373
  :login_id => 'abc123')
308
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
+ ```
309
389
 
310
390
  ## details
311
391
  The string passed to details is the ID of a SproutVideo login.
@@ -319,12 +399,12 @@ Sproutvideo::AccessGrant.details('abc123')
319
399
  You can change the optional parameters for an access grant.
320
400
 
321
401
  ```ruby
322
- Sproutvideo::AccessGrant.update('abc123',
402
+ Sproutvideo::AccessGrant.update('abc123',
323
403
  :allowed_plays => 20,
324
404
  :access_ends_at => DateTime.parse('8/4/2014'))
325
405
  ```
326
406
 
327
- ## destory
407
+ ## destroy
328
408
  Pass in the id of the access grant you wish to delete.
329
409
 
330
410
  ```ruby
@@ -346,7 +426,7 @@ Each method can be called on it's own for overall account data for all time like
346
426
  ```ruby
347
427
  Sproutvideo::Analytics.play_counts
348
428
  Sproutvideo::Analytics.domains
349
- SproutVideo::Analytics.geo
429
+ Sproutvideo::Analytics.geo
350
430
  Sproutvideo::Analytics.video_types
351
431
  Sproutvideo::Analytics.playback_types
352
432
  Sproutvideo::Analytics.device_types
@@ -355,41 +435,249 @@ Each method can also take an options hash containing a :video_id for retrieving
355
435
  ```ruby
356
436
  Sproutvideo::Analytics.play_counts(:video_id => 'abc123')
357
437
  Sproutvideo::Analytics.domains(:video_id => 'abc123')
358
- SproutVideo::Analytics.geo(:video_id => 'abc123')
438
+ Sproutvideo::Analytics.geo(:video_id => 'abc123')
359
439
  Sproutvideo::Analytics.video_types(:video_id => 'abc123')
360
440
  Sproutvideo::Analytics.playback_types(:video_id => 'abc123')
361
441
  Sproutvideo::Analytics.device_types(:video_id => 'abc123')
362
442
  ```
443
+ The following methods can also take an options hash containing a :live_stream_id for retrieving overall data for a specific live_stream:
444
+ ```ruby
445
+ Sproutvideo::Analytics.play_counts(:live_stream_id => 'abc123')
446
+ Sproutvideo::Analytics.domains(:live_stream_id => 'abc123')
447
+ Sproutvideo::Analytics.geo(:live_stream_id => 'abc123')
448
+ Sproutvideo::Analytics.device_types(:live_stream_id => 'abc123')
449
+ ```
363
450
  Each method can also take an optional :start_date and :end_date to specify a date range for the returned data:
364
451
  ```ruby
365
452
  Sproutvideo::Analytics.play_counts(:start_date => '2013-01-01')
366
453
  Sproutvideo::Analytics.device_types(:video_id => 'abc123', :end_date => '2012-12-31')
367
454
  ```
368
455
 
369
- Lastly, the geo method can take an optional :country to retrieve playback data by city within that country
456
+ The geo method can take an optional :country to retrieve playback data by city within that country
370
457
  ```ruby
371
458
  Sproutvideo::Analytics.geo(:video_id => 'abc123', :country => 'US')
372
459
  ```
373
460
 
374
- #Engagement
461
+ ## Misc endpoints
462
+ see api docs for more info
463
+
464
+ ```ruby
465
+ Sproutvideo::Analytics.popular_videos
466
+ ```
467
+
468
+ ```ruby
469
+ Sproutvideo::Analytics.live_stream_overview('abc123')
470
+ ```
471
+
472
+ # Engagement
375
473
  You can grab the total number of seconds of your videos that have been watched like this:
376
474
  ```ruby
377
475
  Sproutvideo::Analytics.engagement
378
476
  ```
379
477
 
478
+ and for all livestreams:
479
+ ```ruby
480
+ Sproutvideo::Analytics.live_stream_engagement
481
+ ```
482
+
380
483
  You can grab engagement for a specific video like so:
381
484
  ```ruby
382
485
  Sproutvideo::Analytics.engagement(:video_id => 'abc123')
383
486
  ```
384
487
 
488
+ or for a specific live stream:
489
+ ```ruby
490
+ Sproutvideo::Analytics.live_stream_engagement(:live_stream_id => 'abc123')
491
+ ```
492
+
493
+ You can grab playback sessions data for your videos with:
494
+ ```ruby
495
+ Sproutvideo::Analytics.engagement_sessions
496
+ ```
497
+
498
+ and for live streams with
499
+ ```ruby
500
+ Sproutvideo::Analytics.live_stream_engagement_sessions
501
+ ```
502
+
385
503
  Lastly, you can grab every single playback session for a video like this:
386
504
  ```ruby
387
505
  Sproutvideo::Analytics.engagement_sessions('abc123')
388
- Sproutvideo::Analytics.engagement_sessions('abc123', :page => 3)
389
- Sproutvideo::Analytics.engagement_sessions('abc123', :page => 3, :per_page => 40)
506
+ Sproutvideo::Analytics.engagement_sessions('abc123', page: 3)
507
+ Sproutvideo::Analytics.engagement_sessions('abc123', page: 3, :per_page => 40)
508
+ ```
509
+
510
+ and for a live stream:
511
+ ```ruby
512
+ Sproutvideo::Analytics.live_stream_engagement_sessions('abc123')
513
+ ```
514
+
515
+ You can also grab engagement sessions for a video for a specific email address like so:
516
+ ```ruby
517
+ Sproutvideo::Analytics.engagement_sessions(video_id: 'abc123', vemail: 'test@example.com')
518
+ ```
519
+
520
+ # Account
521
+ The following methods are available: `details`, `update`.
522
+
523
+ ## details
524
+ To get information about your account:
525
+
526
+ ```ruby
527
+ Sproutvideo::Account.details
528
+ ```
529
+
530
+ ## update
531
+ To update account settings:
532
+
533
+ ```ruby
534
+ Sproutvideo::Account.update({download_sd: true})
535
+ ```
536
+
537
+ # Subtitles
538
+ 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.
539
+
540
+ ## list
541
+ 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.
542
+
543
+ ```ruby
544
+ Sproutvideo::Subtitle.list(:video_id => 'abc123')
545
+ Sproutvideo::Subtitle.list(:video_id => 'abc123', :per_page => 10)
546
+ Sproutvideo::Subtitle.list(:video_id => 'abc123', :per_page => 10, :page => 2)
547
+ ```
548
+
549
+ ## create
550
+ 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.
551
+
552
+ ```ruby
553
+ Sproutvideo::Subtitle.create(
554
+ :video_id => 'abc123',
555
+ :language => 'en',
556
+ :content => 'WEBVTT FILE...')
557
+ ```
558
+
559
+ ## details
560
+ pass both the video and the subtitle id.
561
+
562
+ ```ruby
563
+ Sproutvideo::Subtitle.details(:video_id => 'abc123', id: 'fdc432')
564
+ ```
565
+
566
+ ## update
567
+
568
+ You can change the optional parameters for a subtitle.
569
+
570
+ ```ruby
571
+ Sproutvideo::Subtitle.create(
572
+ :video_id => 'abc123',
573
+ :language => 'de',
574
+ :id => 'fdc432')
575
+ ```
576
+
577
+ ## destroy
578
+ Pass in the id of the subtitle you wish to delete.
579
+
580
+ ```ruby
581
+ Sproutvideo::Subtitle.destroy(:video_id => 'abc123', id: 'fdc432')
582
+ ```
583
+
584
+ # Calls to Action
585
+ 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.
586
+
587
+ ## list
588
+ 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.
589
+
590
+ ```ruby
591
+ Sproutvideo::CallToAction.list(:video_id => 'abc123')
592
+ Sproutvideo::CallToAction.list(:video_id => 'abc123', :per_page => 10)
593
+ Sproutvideo::CallToAction.list(:video_id => 'abc123', :per_page => 10, :page => 2)
594
+ ```
595
+
596
+ ## create
597
+ 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.
598
+
599
+ ```ruby
600
+ Sproutvideo::CallToAction.create(
601
+ :video_id => 'abc123',
602
+ :text => 'join now',
603
+ :start_time => 1,
604
+ :end_time => 2,
605
+ :content => 'https://sproutvideo.com')
606
+ ```
607
+
608
+ ## details
609
+ pass both the video and the call to action id.
610
+
611
+ ```ruby
612
+ Sproutvideo::CallToAction.details(:video_id => 'abc123', id: 'fdc432')
613
+ ```
614
+
615
+ ## update
616
+
617
+ You can change the optional parameters for a call to action.
618
+
619
+ ```ruby
620
+ Sproutvideo::CallToAction.create(
621
+ :video_id => 'abc123',
622
+ :text => 'get it done!',
623
+ :id => 'fdc432')
624
+ ```
625
+
626
+ ## destroy
627
+ Pass in the id of the call to action you wish to delete.
628
+
629
+ ```ruby
630
+ Sproutvideo::CallToAction.destroy(:video_id => 'abc123', id: 'fdc432')
631
+ ```
632
+
633
+ # Live Streams
634
+ The following methods are available: `list`, `create`, `details`, `update`, `destroy`, and `end_stream`.
635
+
636
+ ## list
637
+ 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.
638
+
639
+ ```ruby
640
+ Sproutvideo::LiveStream.list
641
+ Sproutvideo::LiveStream.list(:per_page => 10, :page => 2)
642
+ ```
643
+
644
+ ## create
645
+
646
+ ```ruby
647
+ Sproutvideo::LiveStream.create(title: 'hello')
648
+ # with a poster frame
649
+ Sproutvideo::LiveStream.create(title: 'hello', custom_poster_frame: '/path/to/posterframe.jpg')
650
+ ```
651
+
652
+ ## details
653
+
654
+ ```ruby
655
+ Sproutvideo::LiveStream.details('abc123')
656
+ ```
657
+
658
+ ## update
659
+ You can change the optional parameters
660
+
661
+ ```ruby
662
+ Sproutvideo::LiveStream.update(title: 'get it done!')
663
+ # with a poster frame
664
+ Sproutvideo::LiveStream.update(title: 'hello', custom_poster_frame: '/path/to/posterframe.jpg')
390
665
  ```
666
+
667
+ ## destroy
668
+
669
+ ```ruby
670
+ Sproutvideo::LiveStream.destroy('abc123')
671
+ ```
672
+
673
+ ## end_stream
674
+
675
+ ```ruby
676
+ Sproutvideo::LiveStream.end_stream('abc123')
677
+ ```
678
+
391
679
  # Contributing to sproutvideo-rb
392
-
680
+
393
681
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
394
682
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
395
683
  * Fork the project.
@@ -400,5 +688,5 @@ Sproutvideo::Analytics.engagement_sessions('abc123', :page => 3, :per_page => 40
400
688
 
401
689
  # Copyright
402
690
 
403
- Copyright (c) 2012 SproutVideo. See LICENSE.txt for
691
+ Copyright (c) 2021 SproutVideo. See LICENSE.txt for
404
692
  further details.