sproutvideo-rb 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +120 -22
- data/lib/sproutvideo.rb +3 -1
- data/lib/sproutvideo/access_grant.rb +30 -0
- data/lib/sproutvideo/login.rb +30 -0
- data/lib/sproutvideo/version.rb +1 -1
- data/spec/sproutvideo/access_grant_spec.rb +106 -0
- data/spec/sproutvideo/login_spec.rb +106 -0
- data/spec/sproutvideo/video_spec.rb +1 -1
- data/sproutvideo-rb.gemspec +9 -4
- metadata +30 -45
data/README.markdown
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
#SproutVideo
|
2
|
+
Use this gem to interact with the [SproutVideo API](http://sproutvideo.com/docs/api.html)
|
2
3
|
|
3
4
|
# Getting Started
|
5
|
+
|
6
|
+
First, you'll need to install the gem
|
7
|
+
|
8
|
+
gem install sproutvideo-rb
|
9
|
+
|
4
10
|
The first thing you'll need to interact with the SproutVideo API is your API key. You can use your API key in one of two ways. The first and easiest is to set it and forget it on the Sproutvideo module like so:
|
5
11
|
|
6
12
|
```ruby
|
7
|
-
SproutVideo.api_key
|
13
|
+
SproutVideo.api_key = 'abcd1234'
|
8
14
|
```
|
9
15
|
|
10
16
|
Alternatively, you can use an environment variable:
|
11
17
|
|
12
18
|
```ruby
|
13
|
-
ENV['SPROUTVIDEO_API_KEY']
|
19
|
+
ENV['SPROUTVIDEO_API_KEY'] = 'abcd1234'
|
14
20
|
```
|
15
21
|
|
16
22
|
# Videos
|
@@ -43,52 +49,52 @@ Sproutvideo::Video.create('/path/to/video.mp4')
|
|
43
49
|
You can set the title as well as many other parameters by passing them as a hash
|
44
50
|
|
45
51
|
```ruby
|
46
|
-
Sproutvideo::Video.create('/path/to/video.mp4',
|
52
|
+
Sproutvideo::Video.create('/path/to/video.mp4',
|
47
53
|
:title => 'My Awesome Video',
|
48
54
|
:description => 'This video is great',
|
49
|
-
:privacy => 2
|
55
|
+
:privacy => 2)
|
50
56
|
```
|
51
57
|
|
52
58
|
You can also apply any number of tags to the new upload by passing their ids along:
|
53
59
|
|
54
60
|
```ruby
|
55
|
-
Sproutvideo::Video.create('/path/to/video.mp4',
|
56
|
-
:tags => ['ec61', 'abc123']
|
61
|
+
Sproutvideo::Video.create('/path/to/video.mp4',
|
62
|
+
:tags => ['ec61', 'abc123'])
|
57
63
|
```
|
58
64
|
|
59
65
|
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:
|
60
66
|
|
61
67
|
```ruby
|
62
|
-
Sproutvideo::Video.create('/path/to/video.mp4',
|
63
|
-
:notification_url => 'http://example.com/webhook_url'
|
68
|
+
Sproutvideo::Video.create('/path/to/video.mp4',
|
69
|
+
:notification_url => 'http://example.com/webhook_url')
|
64
70
|
```
|
65
71
|
|
66
72
|
##update
|
67
73
|
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.
|
68
74
|
|
69
75
|
```ruby
|
70
|
-
Sproutvideo::Video.update('abc123',
|
76
|
+
Sproutvideo::Video.update('abc123', :title => 'Updated Title')
|
71
77
|
```
|
72
78
|
|
73
79
|
## Tags
|
74
80
|
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.
|
75
81
|
|
76
82
|
```ruby
|
77
|
-
Sproutvideo::Video.update('abc123',
|
78
|
-
:tags => ["abc", "123", "def"]
|
83
|
+
Sproutvideo::Video.update('abc123',
|
84
|
+
:tags => ["abc", "123", "def"])
|
79
85
|
```
|
80
86
|
|
81
87
|
If you want to remove a tag from a video, remove the tag from the list of tags on the video but make sure to include all of the tags you wish to keep. For instance, if you now want to remove the tag with id "123" from the example above, pass in "abc" and "def"
|
82
88
|
|
83
89
|
```ruby
|
84
|
-
Sproutvideo::Video.update("abc123",
|
85
|
-
:tags => ["abc","def"]
|
90
|
+
Sproutvideo::Video.update("abc123",
|
91
|
+
:tags => ["abc","def"])
|
86
92
|
```
|
87
93
|
|
88
94
|
You can remove all of the tags from a video by just passing an empty array as the tags parameter.
|
89
95
|
|
90
96
|
```ruby
|
91
|
-
Sproutvideo::Video.update('abc123',
|
97
|
+
Sproutvideo::Video.update('abc123', :tags => [])
|
92
98
|
```
|
93
99
|
|
94
100
|
##delete
|
@@ -121,6 +127,8 @@ Sproutvideo::Tag.update('abc123', :name => 'updated tag name')
|
|
121
127
|
```
|
122
128
|
|
123
129
|
##delete
|
130
|
+
Pass in the id of the tag you wish to delete.
|
131
|
+
|
124
132
|
```ruby
|
125
133
|
Sproutvideo::Tag.delete('abc123')
|
126
134
|
```
|
@@ -129,6 +137,7 @@ Sproutvideo::Tag.delete('abc123')
|
|
129
137
|
The following methods are available: `list`, `create`, `details`, `update`, `delete`.
|
130
138
|
##list
|
131
139
|
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.
|
140
|
+
|
132
141
|
```ruby
|
133
142
|
Sproutvideo::Playlist.list
|
134
143
|
Sproutvideo::Playlist.list(:per_page => 10)
|
@@ -147,36 +156,125 @@ Sproutvideo::Playlist.create(
|
|
147
156
|
##update
|
148
157
|
|
149
158
|
```ruby
|
150
|
-
Sproutvideo::
|
159
|
+
Sproutvideo::Playlist.update('abc123',
|
151
160
|
:title => 'Update Playlist Title')
|
152
|
-
|
153
|
-
|
161
|
+
```
|
162
|
+
### videos
|
154
163
|
To add a video to a playlist, make sure to include all of the videos currently associated with that playlist. For instance if the playlist already has videos with the ids "abc" and "123" and you want to add a video with the id "def" do pass "abc", "123" and "def" to the update method.
|
155
164
|
|
156
165
|
```ruby
|
157
|
-
Sproutvideo::Playlist.update('abc123',
|
158
|
-
:videos => ["abc", "123", "def"]
|
166
|
+
Sproutvideo::Playlist.update('abc123',
|
167
|
+
:videos => ["abc", "123", "def"])
|
159
168
|
```
|
160
169
|
|
161
170
|
If you want to remove a video from a playlist, remove the video from the list of videos in the playlist but make sure to include all of the videos you wish to keep. For instance, if you now want to remove the video with id "123" from the example above, pass in "abc" and "def"
|
162
171
|
|
163
172
|
```ruby
|
164
|
-
Sproutvideo::Playlist.update("abc123",
|
165
|
-
:videos => ["abc","def"]
|
173
|
+
Sproutvideo::Playlist.update("abc123",
|
174
|
+
:videos => ["abc","def"])
|
166
175
|
```
|
167
176
|
|
168
177
|
You can remove all of the videos from a playlist by just passing an empty array as the videos parameter.
|
169
178
|
|
170
179
|
```ruby
|
171
|
-
Sproutvideo::Playlist.update('abc123',
|
180
|
+
Sproutvideo::Playlist.update('abc123', :videos => [])
|
172
181
|
```
|
173
182
|
|
174
183
|
##delete
|
184
|
+
Pass in the id of the playlist you wish to delete.
|
175
185
|
|
176
186
|
```ruby
|
177
187
|
Sproutvideo::Playlist.delete('abc123')
|
178
188
|
```
|
179
189
|
|
190
|
+
# Logins
|
191
|
+
The following methods are available: `list`, `create`, `details`, `update`, `delete`
|
192
|
+
|
193
|
+
## list
|
194
|
+
By default the login 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.
|
195
|
+
|
196
|
+
```ruby
|
197
|
+
Sproutvideo::Login.list
|
198
|
+
Sproutvideo::Login.list(:per_page => 10)
|
199
|
+
Sproutvideo::Login.list(:per_page => 10, :page => 2)
|
200
|
+
```
|
201
|
+
|
202
|
+
## create
|
203
|
+
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.
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
Sproutvideo::Login.create(
|
207
|
+
:email => 'test@example.com',
|
208
|
+
:password => 'thisisthepassword')
|
209
|
+
```
|
210
|
+
|
211
|
+
## details
|
212
|
+
The string passed to details is the ID of a SproutVideo login.
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
Sproutvideo::Login.details('abc123')
|
216
|
+
```
|
217
|
+
|
218
|
+
## update
|
219
|
+
|
220
|
+
You can change the password for a login.
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
Sproutvideo::Login.update('abc123',
|
224
|
+
:password => 'newpassword')
|
225
|
+
```
|
226
|
+
|
227
|
+
## delete
|
228
|
+
Pass in the id of the login you wish to delete.
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
Sproutvideo::Login.delete('asdf1234')
|
232
|
+
```
|
233
|
+
# Access Grants
|
234
|
+
The following methods are available: `list`, `create`, `details`, `update`, `delete`
|
235
|
+
|
236
|
+
## list
|
237
|
+
By default the access grant 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.
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
Sproutvideo::AccessGrant.list
|
241
|
+
Sproutvideo::AccessGrant.list(:per_page => 10)
|
242
|
+
Sproutvideo::AccessGrant.list(:per_page => 10, :page => 2)
|
243
|
+
```
|
244
|
+
|
245
|
+
## create
|
246
|
+
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.
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
Sproutvideo::Login.create(
|
250
|
+
:video_id => 'abc123',
|
251
|
+
:login_id => 'abc123')
|
252
|
+
```
|
253
|
+
|
254
|
+
## details
|
255
|
+
The string passed to details is the ID of a SproutVideo login.
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
Sproutvideo::Login.details('abc123')
|
259
|
+
```
|
260
|
+
|
261
|
+
## update
|
262
|
+
|
263
|
+
You can change the optional parameters for an access grant.
|
264
|
+
|
265
|
+
```ruby
|
266
|
+
Sproutvideo::Login.update('abc123',
|
267
|
+
:allowed_plays => 20,
|
268
|
+
:access_ends_at => DateTime.parse('8/4/2014'))
|
269
|
+
```
|
270
|
+
|
271
|
+
## delete
|
272
|
+
Pass in the id of the access grant you wish to delete.
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
Sproutvideo::AccessGrant.delete('asdf1234')
|
276
|
+
```
|
277
|
+
|
180
278
|
# Contributing to sproutvideo-rb
|
181
279
|
|
182
280
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/lib/sproutvideo.rb
CHANGED
@@ -7,4 +7,6 @@ require 'sproutvideo/response.rb'
|
|
7
7
|
require 'sproutvideo/resource.rb'
|
8
8
|
require 'sproutvideo/video.rb'
|
9
9
|
require 'sproutvideo/tag.rb'
|
10
|
-
require 'sproutvideo/playlist.rb'
|
10
|
+
require 'sproutvideo/playlist.rb'
|
11
|
+
require 'sproutvideo/login.rb'
|
12
|
+
require 'sproutvideo/access_grant.rb'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class AccessGrant < Resource
|
3
|
+
|
4
|
+
def self.create(options={})
|
5
|
+
post("/access_grants", options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.list(options={})
|
9
|
+
params = {
|
10
|
+
:page => options.delete(:page) || 1,
|
11
|
+
:per_page => options.delete(:per_page) || 25
|
12
|
+
}
|
13
|
+
params = params.merge(options)
|
14
|
+
get("/access_grants", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details(access_grant_id, options={})
|
18
|
+
get("/access_grants/#{access_grant_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(access_grant_id, options={})
|
22
|
+
put("/access_grants/#{access_grant_id}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.destroy(access_grant_id, options={})
|
26
|
+
delete("/access_grants/#{access_grant_id}", options)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Login < Resource
|
3
|
+
|
4
|
+
def self.create(options={})
|
5
|
+
post("/logins", options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.list(options={})
|
9
|
+
params = {
|
10
|
+
:page => options.delete(:page) || 1,
|
11
|
+
:per_page => options.delete(:per_page) || 25
|
12
|
+
}
|
13
|
+
params = params.merge(options)
|
14
|
+
get("/logins", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details(login_id, options={})
|
18
|
+
get("/logins/#{login_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(login_id, options={})
|
22
|
+
put("/logins/#{login_id}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.destroy(login_id, options={})
|
26
|
+
delete("/logins/#{login_id}", options)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/sproutvideo/version.rb
CHANGED
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::AccessGrant 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
|
+
@http_mock = mock()
|
8
|
+
HTTPClient.stub!(:new).and_return(@http_mock)
|
9
|
+
@msg = mock(:body => "{}", :status => 200)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#create" do
|
13
|
+
before(:each) do
|
14
|
+
@url = "#{Sproutvideo.base_url}/access_grants"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should POST the correct url and return a response" do
|
18
|
+
data = {:email => 'test@example.com', :password => 'password'}
|
19
|
+
@http_mock.should_receive(:post).with(
|
20
|
+
@url,
|
21
|
+
MultiJson.encode(data),
|
22
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
23
|
+
Sproutvideo::AccessGrant.create(data).class.should == Sproutvideo::Response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#list" do
|
28
|
+
before(:each) do
|
29
|
+
@url = "#{Sproutvideo.base_url}/access_grants"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should GET the correct url and return a response" do
|
33
|
+
|
34
|
+
@http_mock.should_receive(:get).with(
|
35
|
+
@url,
|
36
|
+
{:page => 1, :per_page => 25},
|
37
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
38
|
+
Sproutvideo::AccessGrant.list.class.should == Sproutvideo::Response
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should merge params" do
|
42
|
+
@http_mock.should_receive(:get).with(
|
43
|
+
@url,
|
44
|
+
{:page => 1, :per_page => 25, :foo => 'bar'},
|
45
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
46
|
+
Sproutvideo::AccessGrant.list(:foo => 'bar')
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should use pagination params" do
|
50
|
+
@http_mock.should_receive(:get).with(
|
51
|
+
@url,
|
52
|
+
{:page => 2, :per_page => 5},
|
53
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
54
|
+
Sproutvideo::AccessGrant.list(:page => 2, :per_page => 5)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#details" do
|
59
|
+
before(:each) do
|
60
|
+
@access_grant_id = 1
|
61
|
+
@url = "#{Sproutvideo.base_url}/access_grants/#{@access_grant_id}"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should get the correct url and return a response" do
|
65
|
+
@http_mock.should_receive(:get).with(
|
66
|
+
@url,
|
67
|
+
{},
|
68
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
69
|
+
Sproutvideo::AccessGrant.details(@access_grant_id).class.should == Sproutvideo::Response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#update" do
|
74
|
+
before(:each) do
|
75
|
+
@access_grant_id = 1
|
76
|
+
@url = "#{Sproutvideo.base_url}/access_grants/#{@access_grant_id}"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should PUT the correct url and return a response" do
|
80
|
+
data = {:password => 'new password'}
|
81
|
+
|
82
|
+
@http_mock.should_receive(:put).with(
|
83
|
+
@url,
|
84
|
+
MultiJson.encode(data),
|
85
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
86
|
+
Sproutvideo::AccessGrant.update(@access_grant_id, data).class.should == Sproutvideo::Response
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#delete" do
|
92
|
+
before(:each) do
|
93
|
+
@access_grant_id = 1
|
94
|
+
@url = "#{Sproutvideo.base_url}/access_grants/#{@access_grant_id}"
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should DELETE the correct url and return a response" do
|
98
|
+
@http_mock.should_receive(:delete).with(
|
99
|
+
@url,
|
100
|
+
{},
|
101
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
102
|
+
Sproutvideo::AccessGrant.destroy(@access_grant_id).class.should == Sproutvideo::Response
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::Login 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
|
+
@http_mock = mock()
|
8
|
+
HTTPClient.stub!(:new).and_return(@http_mock)
|
9
|
+
@msg = mock(:body => "{}", :status => 200)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#create" do
|
13
|
+
before(:each) do
|
14
|
+
@url = "#{Sproutvideo.base_url}/logins"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should POST the correct url and return a response" do
|
18
|
+
data = {:email => 'test@example.com', :password => 'password'}
|
19
|
+
@http_mock.should_receive(:post).with(
|
20
|
+
@url,
|
21
|
+
MultiJson.encode(data),
|
22
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
23
|
+
Sproutvideo::Login.create(data).class.should == Sproutvideo::Response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#list" do
|
28
|
+
before(:each) do
|
29
|
+
@url = "#{Sproutvideo.base_url}/logins"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should GET the correct url and return a response" do
|
33
|
+
|
34
|
+
@http_mock.should_receive(:get).with(
|
35
|
+
@url,
|
36
|
+
{:page => 1, :per_page => 25},
|
37
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
38
|
+
Sproutvideo::Login.list.class.should == Sproutvideo::Response
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should merge params" do
|
42
|
+
@http_mock.should_receive(:get).with(
|
43
|
+
@url,
|
44
|
+
{:page => 1, :per_page => 25, :foo => 'bar'},
|
45
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
46
|
+
Sproutvideo::Login.list(:foo => 'bar')
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should use pagination params" do
|
50
|
+
@http_mock.should_receive(:get).with(
|
51
|
+
@url,
|
52
|
+
{:page => 2, :per_page => 5},
|
53
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
54
|
+
Sproutvideo::Login.list(:page => 2, :per_page => 5)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#details" do
|
59
|
+
before(:each) do
|
60
|
+
@login_id = 1
|
61
|
+
@url = "#{Sproutvideo.base_url}/logins/#{@login_id}"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should get the correct url and return a response" do
|
65
|
+
@http_mock.should_receive(:get).with(
|
66
|
+
@url,
|
67
|
+
{},
|
68
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
69
|
+
Sproutvideo::Login.details(@login_id).class.should == Sproutvideo::Response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#update" do
|
74
|
+
before(:each) do
|
75
|
+
@login_id = 1
|
76
|
+
@url = "#{Sproutvideo.base_url}/logins/#{@login_id}"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should PUT the correct url and return a response" do
|
80
|
+
data = {:password => 'new password'}
|
81
|
+
|
82
|
+
@http_mock.should_receive(:put).with(
|
83
|
+
@url,
|
84
|
+
MultiJson.encode(data),
|
85
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
86
|
+
Sproutvideo::Login.update(@login_id, data).class.should == Sproutvideo::Response
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#delete" do
|
92
|
+
before(:each) do
|
93
|
+
@login_id = 1
|
94
|
+
@url = "#{Sproutvideo.base_url}/logins/#{@login_id}"
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should DELETE the correct url and return a response" do
|
98
|
+
@http_mock.should_receive(:delete).with(
|
99
|
+
@url,
|
100
|
+
{},
|
101
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
102
|
+
Sproutvideo::Login.destroy(@login_id).class.should == Sproutvideo::Response
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -4,7 +4,7 @@ describe Sproutvideo::Video do
|
|
4
4
|
@api_key = 'abc123'
|
5
5
|
Sproutvideo.api_key = @api_key
|
6
6
|
Sproutvideo.base_url = 'https://api.sproutvideo.com/v1'
|
7
|
-
@http_mock = mock()
|
7
|
+
@http_mock = mock(:send_timeout= => 18000)
|
8
8
|
HTTPClient.stub!(:new).and_return(@http_mock)
|
9
9
|
@msg = mock(:body => "{}", :status => 200)
|
10
10
|
end
|
data/sproutvideo-rb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sproutvideo-rb}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.1.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 = %q{2012-
|
12
|
+
s.date = %q{2012-08-04}
|
13
13
|
s.description = %q{SproutVideo API Client}
|
14
14
|
s.email = %q{support@sproutvideo.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.markdown",
|
24
24
|
"Rakefile",
|
25
25
|
"lib/sproutvideo.rb",
|
26
|
+
"lib/sproutvideo/access_grant.rb",
|
27
|
+
"lib/sproutvideo/login.rb",
|
26
28
|
"lib/sproutvideo/playlist.rb",
|
27
29
|
"lib/sproutvideo/resource.rb",
|
28
30
|
"lib/sproutvideo/response.rb",
|
@@ -31,6 +33,8 @@ Gem::Specification.new do |s|
|
|
31
33
|
"lib/sproutvideo/version.rb",
|
32
34
|
"lib/sproutvideo/video.rb",
|
33
35
|
"spec/spec_helper.rb",
|
36
|
+
"spec/sproutvideo/access_grant_spec.rb",
|
37
|
+
"spec/sproutvideo/login_spec.rb",
|
34
38
|
"spec/sproutvideo/playlist_spec.rb",
|
35
39
|
"spec/sproutvideo/resource_spec.rb",
|
36
40
|
"spec/sproutvideo/response_spec.rb",
|
@@ -43,13 +47,14 @@ Gem::Specification.new do |s|
|
|
43
47
|
s.homepage = %q{http://github.com/sproutvideo/sproutvideo-rb}
|
44
48
|
s.licenses = ["MIT"]
|
45
49
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.
|
50
|
+
s.rubygems_version = %q{1.3.6}
|
47
51
|
s.summary = %q{SproutVideo API Client}
|
48
52
|
|
49
53
|
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
55
|
s.specification_version = 3
|
51
56
|
|
52
|
-
if Gem::Version.new(Gem::
|
57
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
53
58
|
s.add_runtime_dependency(%q<httpclient>, [">= 0"])
|
54
59
|
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
55
60
|
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sproutvideo-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
7
|
+
- 1
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
9
|
+
version: 1.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- SproutVideo
|
@@ -15,114 +14,100 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2012-
|
17
|
+
date: 2012-08-04 00:00:00 -04:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
21
|
+
name: httpclient
|
22
|
+
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
27
|
segments:
|
30
28
|
- 0
|
31
29
|
version: "0"
|
32
|
-
|
30
|
+
type: :runtime
|
33
31
|
version_requirements: *id001
|
34
|
-
prerelease: false
|
35
32
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
33
|
+
name: multi_json
|
34
|
+
prerelease: false
|
37
35
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
36
|
requirements:
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
39
|
segments:
|
44
40
|
- 0
|
45
41
|
version: "0"
|
46
|
-
|
42
|
+
type: :runtime
|
47
43
|
version_requirements: *id002
|
48
|
-
prerelease: false
|
49
44
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
45
|
+
name: rspec
|
46
|
+
prerelease: false
|
51
47
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
48
|
requirements:
|
54
49
|
- - ~>
|
55
50
|
- !ruby/object:Gem::Version
|
56
|
-
hash: 47
|
57
51
|
segments:
|
58
52
|
- 2
|
59
53
|
- 8
|
60
54
|
- 0
|
61
55
|
version: 2.8.0
|
62
|
-
|
56
|
+
type: :development
|
63
57
|
version_requirements: *id003
|
64
|
-
prerelease: false
|
65
58
|
- !ruby/object:Gem::Dependency
|
66
|
-
|
59
|
+
name: rdoc
|
60
|
+
prerelease: false
|
67
61
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
62
|
requirements:
|
70
63
|
- - ~>
|
71
64
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 31
|
73
65
|
segments:
|
74
66
|
- 3
|
75
67
|
- 12
|
76
68
|
version: "3.12"
|
77
|
-
|
69
|
+
type: :development
|
78
70
|
version_requirements: *id004
|
79
|
-
prerelease: false
|
80
71
|
- !ruby/object:Gem::Dependency
|
81
|
-
|
72
|
+
name: bundler
|
73
|
+
prerelease: false
|
82
74
|
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
75
|
requirements:
|
85
76
|
- - ~>
|
86
77
|
- !ruby/object:Gem::Version
|
87
|
-
hash: 23
|
88
78
|
segments:
|
89
79
|
- 1
|
90
80
|
- 0
|
91
81
|
- 0
|
92
82
|
version: 1.0.0
|
93
|
-
|
83
|
+
type: :development
|
94
84
|
version_requirements: *id005
|
95
|
-
prerelease: false
|
96
85
|
- !ruby/object:Gem::Dependency
|
97
|
-
|
86
|
+
name: jeweler
|
87
|
+
prerelease: false
|
98
88
|
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
89
|
requirements:
|
101
90
|
- - ~>
|
102
91
|
- !ruby/object:Gem::Version
|
103
|
-
hash: 49
|
104
92
|
segments:
|
105
93
|
- 1
|
106
94
|
- 8
|
107
95
|
- 3
|
108
96
|
version: 1.8.3
|
109
|
-
|
97
|
+
type: :development
|
110
98
|
version_requirements: *id006
|
111
|
-
prerelease: false
|
112
99
|
- !ruby/object:Gem::Dependency
|
113
|
-
|
100
|
+
name: rcov
|
101
|
+
prerelease: false
|
114
102
|
requirement: &id007 !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
103
|
requirements:
|
117
104
|
- - ">="
|
118
105
|
- !ruby/object:Gem::Version
|
119
|
-
hash: 3
|
120
106
|
segments:
|
121
107
|
- 0
|
122
108
|
version: "0"
|
123
|
-
|
109
|
+
type: :development
|
124
110
|
version_requirements: *id007
|
125
|
-
prerelease: false
|
126
111
|
description: SproutVideo API Client
|
127
112
|
email: support@sproutvideo.com
|
128
113
|
executables: []
|
@@ -139,6 +124,8 @@ files:
|
|
139
124
|
- README.markdown
|
140
125
|
- Rakefile
|
141
126
|
- lib/sproutvideo.rb
|
127
|
+
- lib/sproutvideo/access_grant.rb
|
128
|
+
- lib/sproutvideo/login.rb
|
142
129
|
- lib/sproutvideo/playlist.rb
|
143
130
|
- lib/sproutvideo/resource.rb
|
144
131
|
- lib/sproutvideo/response.rb
|
@@ -147,6 +134,8 @@ files:
|
|
147
134
|
- lib/sproutvideo/version.rb
|
148
135
|
- lib/sproutvideo/video.rb
|
149
136
|
- spec/spec_helper.rb
|
137
|
+
- spec/sproutvideo/access_grant_spec.rb
|
138
|
+
- spec/sproutvideo/login_spec.rb
|
150
139
|
- spec/sproutvideo/playlist_spec.rb
|
151
140
|
- spec/sproutvideo/resource_spec.rb
|
152
141
|
- spec/sproutvideo/response_spec.rb
|
@@ -165,27 +154,23 @@ rdoc_options: []
|
|
165
154
|
require_paths:
|
166
155
|
- lib
|
167
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
-
none: false
|
169
157
|
requirements:
|
170
158
|
- - ">="
|
171
159
|
- !ruby/object:Gem::Version
|
172
|
-
hash: 3
|
173
160
|
segments:
|
174
161
|
- 0
|
175
162
|
version: "0"
|
176
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
164
|
requirements:
|
179
165
|
- - ">="
|
180
166
|
- !ruby/object:Gem::Version
|
181
|
-
hash: 3
|
182
167
|
segments:
|
183
168
|
- 0
|
184
169
|
version: "0"
|
185
170
|
requirements: []
|
186
171
|
|
187
172
|
rubyforge_project:
|
188
|
-
rubygems_version: 1.
|
173
|
+
rubygems_version: 1.3.6
|
189
174
|
signing_key:
|
190
175
|
specification_version: 3
|
191
176
|
summary: SproutVideo API Client
|