sproutvideo-rb 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +29 -9
- data/lib/sproutvideo.rb +2 -1
- data/lib/sproutvideo/upload_token.rb +7 -0
- data/lib/sproutvideo/version.rb +2 -2
- data/spec/sproutvideo/upload_token_spec.rb +24 -0
- data/sproutvideo-rb.gemspec +5 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78226e4cd69a6bf86b0fdc56c44481e38ffe24e
|
4
|
+
data.tar.gz: bb93e3ce7fd8a478071b390ea1ac649207373c76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83deb58d605a7c40f012d53826efd2ba251e1eb60a5b465094d1be02421d6fcf550fac2241011aa645a2740421b9adf0afa9ae5fc5c2b33048723c6614e2f542
|
7
|
+
data.tar.gz: 09f3d3e7545e4cdb5f03a8ca0043a226b83990039fe69a5ca87b7c7d878d92004f2635f6cbcb168ed1723ea621b6a45c43dd7c8a2d22060879f0486d5de632b5
|
data/README.markdown
CHANGED
@@ -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
|
@@ -96,7 +103,6 @@ Sproutvideo::Video.create('/path/to/video.mp4',
|
|
96
103
|
```ruby
|
97
104
|
Sproutvideo::Video.update('abc123', :title => 'Updated Title')
|
98
105
|
```
|
99
|
-
|
100
106
|
## Tags
|
101
107
|
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
108
|
|
@@ -158,12 +164,20 @@ Sproutvideo::Video.signed_embed_code('abc123','def456', {'type' => 'hd'}) #set p
|
|
158
164
|
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
165
|
Sproutvideo::Video.signed_embed_code('abc123','def456', {}, nil, 'https') #Use https instead of http
|
160
166
|
```
|
167
|
+
# Upload Tokens
|
168
|
+
The following methods are available: `create`
|
169
|
+
|
170
|
+
## Create
|
171
|
+
```ruby
|
172
|
+
Sproutvideo::UploadToken.create
|
173
|
+
Sproutvideo::UploadToken.create(:return_url => 'http://example.com')
|
174
|
+
Sproutvideo::UploadToken.create(:return_url => 'http://example.com', :seconds_valid => 3600)
|
161
175
|
|
162
176
|
# Tags
|
163
177
|
The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
|
164
178
|
|
165
179
|
##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.
|
180
|
+
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
181
|
|
168
182
|
```ruby
|
169
183
|
Sproutvideo::Tag.list
|
@@ -172,7 +186,7 @@ Sproutvideo::Tag.list(:per_page => 10, :page => 2)
|
|
172
186
|
```
|
173
187
|
|
174
188
|
##create
|
175
|
-
|
189
|
+
|
176
190
|
```ruby
|
177
191
|
Sproutvideo::Tag.create(:name => 'new tag')
|
178
192
|
```
|
@@ -192,7 +206,7 @@ Sproutvideo::Tag.destroy('abc123')
|
|
192
206
|
# Playlists
|
193
207
|
The following methods are available: `list`, `create`, `details`, `update`, `destroy`.
|
194
208
|
##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.
|
209
|
+
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
210
|
|
197
211
|
```ruby
|
198
212
|
Sproutvideo::Playlist.list
|
@@ -257,7 +271,7 @@ Sproutvideo::Login.list(:per_page => 10, :page => 2)
|
|
257
271
|
|
258
272
|
## create
|
259
273
|
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
|
-
|
274
|
+
|
261
275
|
```ruby
|
262
276
|
Sproutvideo::Login.create(
|
263
277
|
:email => 'test@example.com',
|
@@ -276,7 +290,7 @@ Sproutvideo::Login.details('abc123')
|
|
276
290
|
You can change the password for a login.
|
277
291
|
|
278
292
|
```ruby
|
279
|
-
Sproutvideo::Login.update('abc123',
|
293
|
+
Sproutvideo::Login.update('abc123',
|
280
294
|
:password => 'newpassword')
|
281
295
|
```
|
282
296
|
|
@@ -300,7 +314,7 @@ Sproutvideo::AccessGrant.list(:per_page => 10, :page => 2)
|
|
300
314
|
|
301
315
|
## create
|
302
316
|
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
|
-
|
317
|
+
|
304
318
|
```ruby
|
305
319
|
Sproutvideo::AccessGrant.create(
|
306
320
|
:video_id => 'abc123',
|
@@ -319,7 +333,7 @@ Sproutvideo::AccessGrant.details('abc123')
|
|
319
333
|
You can change the optional parameters for an access grant.
|
320
334
|
|
321
335
|
```ruby
|
322
|
-
Sproutvideo::AccessGrant.update('abc123',
|
336
|
+
Sproutvideo::AccessGrant.update('abc123',
|
323
337
|
:allowed_plays => 20,
|
324
338
|
:access_ends_at => DateTime.parse('8/4/2014'))
|
325
339
|
```
|
@@ -388,8 +402,14 @@ Sproutvideo::Analytics.engagement_sessions('abc123')
|
|
388
402
|
Sproutvideo::Analytics.engagement_sessions('abc123', :page => 3)
|
389
403
|
Sproutvideo::Analytics.engagement_sessions('abc123', :page => 3, :per_page => 40)
|
390
404
|
```
|
405
|
+
|
406
|
+
You can also grab engagement sessions for a video for a specific email address like so:
|
407
|
+
```ruby
|
408
|
+
Sproutvideo::Analytics.engagement_sessions('abc123', :vemail => 'test@example.com')
|
409
|
+
```
|
410
|
+
|
391
411
|
# Contributing to sproutvideo-rb
|
392
|
-
|
412
|
+
|
393
413
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
394
414
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
395
415
|
* Fork the project.
|
data/lib/sproutvideo.rb
CHANGED
data/lib/sproutvideo/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Sproutvideo
|
2
|
-
VERSION = "1.
|
3
|
-
end
|
2
|
+
VERSION = "1.5.0"
|
3
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::UploadToken do
|
3
|
+
before(:each) do
|
4
|
+
@api_key = 'abc123'
|
5
|
+
Sproutvideo.api_key = @api_key
|
6
|
+
Sproutvideo.base_url = 'https://api.sproutvideo.com/v1'
|
7
|
+
@msg = mock(:to_s => "{}", :code => 200)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#create" do
|
11
|
+
before(:each) do
|
12
|
+
@url = "#{Sproutvideo.base_url}/upload_tokens"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should POST the correct url and return a response" do
|
16
|
+
data = {:seconds_valid => 3600}
|
17
|
+
RestClient.should_receive(:post).with(
|
18
|
+
@url,
|
19
|
+
MultiJson.encode(data),
|
20
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
21
|
+
Sproutvideo::UploadToken.create(data).class.should == Sproutvideo::Response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/sproutvideo-rb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "sproutvideo-rb"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["SproutVideo"]
|
12
|
-
s.date = "2014-
|
12
|
+
s.date = "2014-07-07"
|
13
13
|
s.description = "SproutVideo API Client"
|
14
14
|
s.email = "support@sproutvideo.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/sproutvideo/response.rb",
|
32
32
|
"lib/sproutvideo/sproutvideo.rb",
|
33
33
|
"lib/sproutvideo/tag.rb",
|
34
|
+
"lib/sproutvideo/upload_token.rb",
|
34
35
|
"lib/sproutvideo/version.rb",
|
35
36
|
"lib/sproutvideo/video.rb",
|
36
37
|
"spec/spec_helper.rb",
|
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
"spec/sproutvideo/response_spec.rb",
|
43
44
|
"spec/sproutvideo/sproutvideo_spec.rb",
|
44
45
|
"spec/sproutvideo/tag_spec.rb",
|
46
|
+
"spec/sproutvideo/upload_token_spec.rb",
|
45
47
|
"spec/sproutvideo/video_spec.rb",
|
46
48
|
"spec/sproutvideo_spec.rb",
|
47
49
|
"sproutvideo-rb.gemspec"
|
@@ -49,7 +51,7 @@ Gem::Specification.new do |s|
|
|
49
51
|
s.homepage = "http://github.com/SproutVideo/sproutvideo-rb"
|
50
52
|
s.licenses = ["MIT"]
|
51
53
|
s.require_paths = ["lib"]
|
52
|
-
s.rubygems_version = "2.0.
|
54
|
+
s.rubygems_version = "2.0.7"
|
53
55
|
s.summary = "SproutVideo API Client"
|
54
56
|
|
55
57
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sproutvideo-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SproutVideo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/sproutvideo/response.rb
|
117
117
|
- lib/sproutvideo/sproutvideo.rb
|
118
118
|
- lib/sproutvideo/tag.rb
|
119
|
+
- lib/sproutvideo/upload_token.rb
|
119
120
|
- lib/sproutvideo/version.rb
|
120
121
|
- lib/sproutvideo/video.rb
|
121
122
|
- spec/spec_helper.rb
|
@@ -127,6 +128,7 @@ files:
|
|
127
128
|
- spec/sproutvideo/response_spec.rb
|
128
129
|
- spec/sproutvideo/sproutvideo_spec.rb
|
129
130
|
- spec/sproutvideo/tag_spec.rb
|
131
|
+
- spec/sproutvideo/upload_token_spec.rb
|
130
132
|
- spec/sproutvideo/video_spec.rb
|
131
133
|
- spec/sproutvideo_spec.rb
|
132
134
|
- sproutvideo-rb.gemspec
|
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
152
|
version: '0'
|
151
153
|
requirements: []
|
152
154
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.0.
|
155
|
+
rubygems_version: 2.0.7
|
154
156
|
signing_key:
|
155
157
|
specification_version: 4
|
156
158
|
summary: SproutVideo API Client
|