sproutvideo-rb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +194 -0
- data/Rakefile +52 -0
- data/lib/sproutvideo.rb +10 -0
- data/lib/sproutvideo/playlist.rb +29 -0
- data/lib/sproutvideo/resource.rb +60 -0
- data/lib/sproutvideo/response.rb +23 -0
- data/lib/sproutvideo/sproutvideo.rb +18 -0
- data/lib/sproutvideo/tag.rb +29 -0
- data/lib/sproutvideo/version.rb +3 -0
- data/lib/sproutvideo/video.rb +29 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/sproutvideo/playlist_spec.rb +106 -0
- data/spec/sproutvideo/resource_spec.rb +4 -0
- data/spec/sproutvideo/response_spec.rb +42 -0
- data/spec/sproutvideo/sproutvideo_spec.rb +30 -0
- data/spec/sproutvideo/tag_spec.rb +106 -0
- data/spec/sproutvideo/video_spec.rb +122 -0
- data/spec/sproutvideo_spec.rb +7 -0
- data/sproutvideo-rb.gemspec +79 -0
- metadata +193 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
httpclient (2.2.4)
|
7
|
+
jeweler (1.8.3)
|
8
|
+
bundler (~> 1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
rdoc
|
12
|
+
json (1.6.5)
|
13
|
+
multi_json (1.0.4)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
rcov (1.0.0)
|
16
|
+
rdoc (3.12)
|
17
|
+
json (~> 1.4)
|
18
|
+
rspec (2.8.0)
|
19
|
+
rspec-core (~> 2.8.0)
|
20
|
+
rspec-expectations (~> 2.8.0)
|
21
|
+
rspec-mocks (~> 2.8.0)
|
22
|
+
rspec-core (2.8.0)
|
23
|
+
rspec-expectations (2.8.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.8.0)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.0.0)
|
32
|
+
httpclient
|
33
|
+
jeweler (~> 1.8.3)
|
34
|
+
multi_json
|
35
|
+
rcov
|
36
|
+
rdoc (~> 3.12)
|
37
|
+
rspec (~> 2.8.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 SproutVideo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
#SproutVideo
|
2
|
+
|
3
|
+
# Getting Started
|
4
|
+
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
|
+
|
6
|
+
```ruby
|
7
|
+
SproutVideo.api_key #'abcd1234'
|
8
|
+
```
|
9
|
+
|
10
|
+
Alternatively, you can use an environment variable:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
ENV['SPROUTVIDEO_API_KEY'] #'abcd1234'
|
14
|
+
```
|
15
|
+
|
16
|
+
# Videos
|
17
|
+
The following methods are available: `list`, `create`, `details`, `update`, `delete`.
|
18
|
+
|
19
|
+
##list
|
20
|
+
By default the videos listing is paginated with 25 videos per page and sorted by upload date in ascending order. You can pass two parameters to control the paging: page and per_page. You can also pass in the id of a tag to just return the videos tagged with that tag.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
Sproutvideo::Video.list
|
24
|
+
Sproutvideo::Video.list(:per_page => 10)
|
25
|
+
Sproutvideo::Video.list(:per_page => 10, :page => 2)
|
26
|
+
Sproutvideo::Video.list(:tag_id => 'abc')
|
27
|
+
```
|
28
|
+
|
29
|
+
##details
|
30
|
+
The string passed to details is the ID of a SproutVideo video.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Sproutvideo::Video.details('abc123')
|
34
|
+
```
|
35
|
+
|
36
|
+
##create
|
37
|
+
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.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
Sproutvideo::Video.create('/path/to/video.mp4')
|
41
|
+
```
|
42
|
+
|
43
|
+
You can set the title as well as many other parameters by passing them as a hash
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Sproutvideo::Video.create('/path/to/video.mp4', {
|
47
|
+
:title => 'My Awesome Video',
|
48
|
+
:description => 'This video is great',
|
49
|
+
:privacy => 2})
|
50
|
+
```
|
51
|
+
|
52
|
+
You can also apply any number of tags to the new upload by passing their ids along:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
Sproutvideo::Video.create('/path/to/video.mp4', {
|
56
|
+
:tags => ['ec61', 'abc123']})
|
57
|
+
```
|
58
|
+
|
59
|
+
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
|
+
|
61
|
+
```ruby
|
62
|
+
Sproutvideo::Video.create('/path/to/video.mp4',{
|
63
|
+
:notification_url => 'http://example.com/webhook_url'})
|
64
|
+
```
|
65
|
+
|
66
|
+
##update
|
67
|
+
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
|
+
|
69
|
+
```ruby
|
70
|
+
Sproutvideo::Video.update('abc123', {:title => 'Updated Title'})
|
71
|
+
```
|
72
|
+
|
73
|
+
## Tags
|
74
|
+
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
|
+
|
76
|
+
```ruby
|
77
|
+
Sproutvideo::Video.update('abc123', {
|
78
|
+
:tags => ["abc", "123", "def"]})
|
79
|
+
```
|
80
|
+
|
81
|
+
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
|
+
|
83
|
+
```ruby
|
84
|
+
Sproutvideo::Video.update("abc123", {
|
85
|
+
:tags => ["abc","def"]})
|
86
|
+
```
|
87
|
+
|
88
|
+
You can remove all of the tags from a video by just passing an empty array as the tags parameter.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
Sproutvideo::Video.update('abc123', {:tags => []})
|
92
|
+
```
|
93
|
+
|
94
|
+
##delete
|
95
|
+
Pass in the id of the video you wish to delete.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
Sproutvideo::Video.delete('abc123')
|
99
|
+
```
|
100
|
+
# Tags
|
101
|
+
The following methods are available: `list`, `create`, `details`, `update`, `delete`.
|
102
|
+
|
103
|
+
##list
|
104
|
+
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.
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
Sproutvideo::Tag.list
|
108
|
+
Sproutvideo::Tag.list(:per_page => 10)
|
109
|
+
Sproutvideo::Tag.list(:per_page => 10, :page => 2)
|
110
|
+
```
|
111
|
+
|
112
|
+
##create
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Sproutvideo::Tag.create(:name => 'new tag')
|
116
|
+
```
|
117
|
+
|
118
|
+
##update
|
119
|
+
```ruby
|
120
|
+
Sproutvideo::Tag.update('abc123', :name => 'updated tag name')
|
121
|
+
```
|
122
|
+
|
123
|
+
##delete
|
124
|
+
```ruby
|
125
|
+
Sproutvideo::Tag.delete('abc123')
|
126
|
+
```
|
127
|
+
|
128
|
+
# Playlists
|
129
|
+
The following methods are available: `list`, `create`, `details`, `update`, `delete`.
|
130
|
+
##list
|
131
|
+
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.
|
132
|
+
```ruby
|
133
|
+
Sproutvideo::Playlist.list
|
134
|
+
Sproutvideo::Playlist.list(:per_page => 10)
|
135
|
+
Sproutvideo::Playlist.list(:per_page => 10, :page => 2)
|
136
|
+
```
|
137
|
+
|
138
|
+
##create
|
139
|
+
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.
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
Sproutvideo::Playlist.create(
|
143
|
+
:title => 'New Playlist',
|
144
|
+
:privacy => 2,
|
145
|
+
:videos => ['abc123','def456','ghi789'])
|
146
|
+
```
|
147
|
+
##update
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
Sproutvideo::Tag.update('abc123',
|
151
|
+
:title => 'Update Playlist Title')
|
152
|
+
|
153
|
+
## videos
|
154
|
+
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
|
+
|
156
|
+
```ruby
|
157
|
+
Sproutvideo::Playlist.update('abc123', {
|
158
|
+
:videos => ["abc", "123", "def"]})
|
159
|
+
```
|
160
|
+
|
161
|
+
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
|
+
|
163
|
+
```ruby
|
164
|
+
Sproutvideo::Playlist.update("abc123", {
|
165
|
+
:videos => ["abc","def"]})
|
166
|
+
```
|
167
|
+
|
168
|
+
You can remove all of the videos from a playlist by just passing an empty array as the videos parameter.
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
Sproutvideo::Playlist.update('abc123', {:videos => []})
|
172
|
+
```
|
173
|
+
|
174
|
+
##delete
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
Sproutvideo::Playlist.delete('abc123')
|
178
|
+
```
|
179
|
+
|
180
|
+
# Contributing to sproutvideo-rb
|
181
|
+
|
182
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
183
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
184
|
+
* Fork the project.
|
185
|
+
* Start a feature/bugfix branch.
|
186
|
+
* Commit and push until you are happy with your contribution.
|
187
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
188
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
189
|
+
|
190
|
+
# Copyright
|
191
|
+
|
192
|
+
Copyright (c) 2012 SproutVideo. See LICENSE.txt for
|
193
|
+
further details.
|
194
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
require 'lib/sproutvideo/version.rb'
|
6
|
+
|
7
|
+
begin
|
8
|
+
Bundler.setup(:default, :development)
|
9
|
+
rescue Bundler::BundlerError => e
|
10
|
+
$stderr.puts e.message
|
11
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
12
|
+
exit e.status_code
|
13
|
+
end
|
14
|
+
require 'rake'
|
15
|
+
|
16
|
+
require 'jeweler'
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
19
|
+
gem.name = "sproutvideo-rb"
|
20
|
+
gem.homepage = "http://github.com/sproutvideo/sproutvideo-rb"
|
21
|
+
gem.license = "MIT"
|
22
|
+
gem.summary = %Q{SproutVideo API Client}
|
23
|
+
gem.description = %Q{SproutVideo API Client}
|
24
|
+
gem.email = "support@sproutvideo.com"
|
25
|
+
gem.authors = ["SproutVideo"]
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
gem.version = Sproutvideo::VERSION
|
28
|
+
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
|
+
|
31
|
+
require 'rspec/core'
|
32
|
+
require 'rspec/core/rake_task'
|
33
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
34
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
38
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
39
|
+
spec.rcov = true
|
40
|
+
end
|
41
|
+
|
42
|
+
task :default => :spec
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "sproutvideo-rb #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/lib/sproutvideo.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
require 'httpclient'
|
3
|
+
|
4
|
+
require 'sproutvideo/version.rb'
|
5
|
+
require 'sproutvideo/sproutvideo.rb'
|
6
|
+
require 'sproutvideo/response.rb'
|
7
|
+
require 'sproutvideo/resource.rb'
|
8
|
+
require 'sproutvideo/video.rb'
|
9
|
+
require 'sproutvideo/tag.rb'
|
10
|
+
require 'sproutvideo/playlist.rb'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Playlist < Resource
|
3
|
+
|
4
|
+
def self.create(options={})
|
5
|
+
post("/playlists", 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("/playlists", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details(playlist_id, options={})
|
18
|
+
get("/playlists/#{playlist_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(playlist_id, options={})
|
22
|
+
put("/playlists/#{playlist_id}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.destroy(playlist_id, options={})
|
26
|
+
delete("/playlists/#{playlist_id}", options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Resource
|
3
|
+
def self.api_key
|
4
|
+
Sproutvideo.api_key
|
5
|
+
end
|
6
|
+
def self.base_url
|
7
|
+
Sproutvideo.base_url
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.post(path, options={})
|
11
|
+
body = MultiJson.encode(options.dup)
|
12
|
+
resp = HTTPClient.new.post(
|
13
|
+
"#{base_url}#{path}",
|
14
|
+
body,
|
15
|
+
{'SproutVideo-Api-Key' => api_key})
|
16
|
+
Response.new(resp)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.upload(path, file_path, options={})
|
20
|
+
resp = nil
|
21
|
+
File.open(file_path) do |file|
|
22
|
+
body = {:source_video => file}.merge(options.dup)
|
23
|
+
client = HTTPClient.new
|
24
|
+
client.send_timeout = 18000
|
25
|
+
resp = client.post(
|
26
|
+
"#{base_url}#{path}",
|
27
|
+
body,
|
28
|
+
{'SproutVideo-Api-Key' => api_key})
|
29
|
+
end
|
30
|
+
|
31
|
+
Response.new(resp)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.get(path, options={})
|
35
|
+
options = options.dup
|
36
|
+
resp = HTTPClient.new.get(
|
37
|
+
"#{base_url}#{path}",
|
38
|
+
options,
|
39
|
+
{'SproutVideo-Api-Key' => api_key})
|
40
|
+
Response.new(resp)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.put(path, options={})
|
44
|
+
body = MultiJson.encode(options.dup)
|
45
|
+
resp = HTTPClient.new.put(
|
46
|
+
"#{base_url}#{path}",
|
47
|
+
body,
|
48
|
+
{'SproutVideo-Api-Key' => api_key})
|
49
|
+
Response.new(resp)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.delete(path, options={})
|
53
|
+
resp = HTTPClient.new.delete(
|
54
|
+
"#{base_url}#{path}",
|
55
|
+
{},
|
56
|
+
{'SproutVideo-Api-Key' => api_key})
|
57
|
+
Response.new(resp)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Response
|
3
|
+
attr_accessor :status, :body, :raw_body
|
4
|
+
|
5
|
+
def initialize(msg)
|
6
|
+
self.status = msg.status
|
7
|
+
self.raw_body = msg.body
|
8
|
+
self.body = MultiJson.decode(self.raw_body, :symbolize_keys => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def success?
|
12
|
+
status.to_i > 199 && status.to_i < 300
|
13
|
+
end
|
14
|
+
|
15
|
+
def errors
|
16
|
+
if body.is_a?(Hash)
|
17
|
+
Array(body[:error]).compact
|
18
|
+
else
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
|
3
|
+
class << self
|
4
|
+
attr_accessor :api_key, :base_url
|
5
|
+
end
|
6
|
+
|
7
|
+
self.api_key = nil
|
8
|
+
self.base_url = 'https://api.sproutvideo.com/v1'
|
9
|
+
|
10
|
+
def self.api_key
|
11
|
+
@api_key || ENV['SPROUTVIDEO_API_KEY']
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.base_url(env=nil)
|
15
|
+
@base_url
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Tag < Resource
|
3
|
+
|
4
|
+
def self.create(options={})
|
5
|
+
post("/tags", 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("/tags", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details(tag_id, options={})
|
18
|
+
get("/tags/#{tag_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(tag_id, options={})
|
22
|
+
put("/tags/#{tag_id}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.destroy(tag_id, options={})
|
26
|
+
delete("/tags/#{tag_id}", options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Sproutvideo
|
2
|
+
class Video < Resource
|
3
|
+
|
4
|
+
def self.create(file_path='', options={})
|
5
|
+
upload("/videos", file_path, 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("/videos", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details(video_id, options={})
|
18
|
+
get("/videos/#{video_id}", options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(video_id, options={})
|
22
|
+
put("/videos/#{video_id}", options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.destroy(video_id, options={})
|
26
|
+
delete("/videos/#{video_id}", options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'sproutvideo'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::Playlist 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}/playlists"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should POST the correct url and return a response" do
|
18
|
+
data = {:name => 'new playlist'}
|
19
|
+
@http_mock.should_receive(:post).with(
|
20
|
+
@url,
|
21
|
+
MultiJson.encode(data),
|
22
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
23
|
+
Sproutvideo::Playlist.create(data).class.should == Sproutvideo::Response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#list" do
|
28
|
+
before(:each) do
|
29
|
+
@url = "#{Sproutvideo.base_url}/playlists"
|
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::Playlist.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::Playlist.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::Playlist.list(:page => 2, :per_page => 5)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#details" do
|
59
|
+
before(:each) do
|
60
|
+
@playlist_id = 1
|
61
|
+
@url = "#{Sproutvideo.base_url}/playlists/#{@playlist_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::Playlist.details(@playlist_id).class.should == Sproutvideo::Response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#update" do
|
74
|
+
before(:each) do
|
75
|
+
@playlist_id = 1
|
76
|
+
@url = "#{Sproutvideo.base_url}/playlists/#{@playlist_id}"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should PUT the correct url and return a response" do
|
80
|
+
data = {:name => 'new name'}
|
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::Playlist.update(@playlist_id, data).class.should == Sproutvideo::Response
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#delete" do
|
92
|
+
before(:each) do
|
93
|
+
@playlist_id = 1
|
94
|
+
@url = "#{Sproutvideo.base_url}/playlists/#{@playlist_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::Playlist.destroy(@playlist_id).class.should == Sproutvideo::Response
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::Response do
|
3
|
+
describe "#success?" do
|
4
|
+
it "should return true when status is between 200 and 299" do
|
5
|
+
msg = mock(:status => 200, :body => "{}")
|
6
|
+
Sproutvideo::Response.new(msg).success?.should == true
|
7
|
+
msg.stub!(:status).and_return(299)
|
8
|
+
Sproutvideo::Response.new(msg).success?.should == true
|
9
|
+
msg.stub!(:status).and_return(250)
|
10
|
+
Sproutvideo::Response.new(msg).success?.should == true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return false when status is less than 200 or greater than 299" do
|
14
|
+
msg = mock(:status => 300, :body => "{}")
|
15
|
+
Sproutvideo::Response.new(msg).success?.should == false
|
16
|
+
msg.stub!(:status => 199)
|
17
|
+
Sproutvideo::Response.new(msg).success?.should == false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#errors" do
|
22
|
+
it "should return an empty array when the result has no errors" do
|
23
|
+
msg = mock(:status => 200, :body => "{}")
|
24
|
+
Sproutvideo::Response.new(msg).errors.should == []
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should return a compacted array of errors if the body has errors" do
|
28
|
+
msg = mock(:status => 200, :body => '{"error":"Unauthorized"}')
|
29
|
+
Sproutvideo::Response.new(msg).errors.should == ['Unauthorized']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#body" do
|
34
|
+
it "should decode the body" do
|
35
|
+
body = {:foo => 'bar'}
|
36
|
+
msg = mock(:status => 200, :body => MultiJson.encode(body))
|
37
|
+
Sproutvideo::Response.new(msg).body.should == body
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo do
|
3
|
+
|
4
|
+
it "should have the default base_url if not defined" do
|
5
|
+
Sproutvideo.base_url.should == "https://api.sproutvideo.com/v1"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should accept a new api_key" do
|
9
|
+
Sproutvideo.api_key = '1234'
|
10
|
+
Sproutvideo.api_key.should == '1234'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should accept a new base_url" do
|
14
|
+
Sproutvideo.base_url = 'https://api.sproutvideo.com/v2'
|
15
|
+
Sproutvideo.base_url.should == 'https://api.sproutvideo.com/v2'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should grab the api_key from the ENV if it exists" do
|
19
|
+
ENV['SPROUTVIDEO_API_KEY'] = '1234'
|
20
|
+
Sproutvideo.api_key.should == '1234'
|
21
|
+
ENV.delete('SPROUTVIDEO_API_KEY')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should take user-supplied api key over ENV-supplied key" do
|
25
|
+
Sproutvideo.api_key = "123"
|
26
|
+
ENV['SPROUTVIDEO_API_KEY'] = '1234'
|
27
|
+
Sproutvideo.api_key.should == '123'
|
28
|
+
ENV.delete('SPROUTVIDEO_API_KEY')
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::Tag 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}/tags"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should POST the correct url and return a response" do
|
18
|
+
data = {:name => 'new tag'}
|
19
|
+
@http_mock.should_receive(:post).with(
|
20
|
+
@url,
|
21
|
+
MultiJson.encode(data),
|
22
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
23
|
+
Sproutvideo::Tag.create(data).class.should == Sproutvideo::Response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#list" do
|
28
|
+
before(:each) do
|
29
|
+
@url = "#{Sproutvideo.base_url}/tags"
|
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::Tag.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::Tag.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::Tag.list(:page => 2, :per_page => 5)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#details" do
|
59
|
+
before(:each) do
|
60
|
+
@tag_id = 1
|
61
|
+
@url = "#{Sproutvideo.base_url}/tags/#{@tag_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::Tag.details(@tag_id).class.should == Sproutvideo::Response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#update" do
|
74
|
+
before(:each) do
|
75
|
+
@tag_id = 1
|
76
|
+
@url = "#{Sproutvideo.base_url}/tags/#{@tag_id}"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should PUT the correct url and return a response" do
|
80
|
+
data = {:name => 'new name'}
|
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::Tag.update(@tag_id, data).class.should == Sproutvideo::Response
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#delete" do
|
92
|
+
before(:each) do
|
93
|
+
@tag_id = 1
|
94
|
+
@url = "#{Sproutvideo.base_url}/tags/#{@tag_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::Tag.destroy(@tag_id).class.should == Sproutvideo::Response
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
describe Sproutvideo::Video 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
|
+
it "should POST the correct url and return a response" do
|
14
|
+
#create temp file
|
15
|
+
File.open("upload_test", "w+") do |f|
|
16
|
+
f.syswrite("upload!")
|
17
|
+
end
|
18
|
+
|
19
|
+
file = File.open('upload_test')
|
20
|
+
|
21
|
+
File.stub!(:open).with('upload_test').and_yield(file)
|
22
|
+
|
23
|
+
@http_mock.should_receive(:post).with(
|
24
|
+
"#{Sproutvideo.base_url}/videos",
|
25
|
+
{:source_video => file, :title => 'test title'},
|
26
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
27
|
+
|
28
|
+
|
29
|
+
Sproutvideo::Video.create('upload_test', {:title => 'test title'}).class.should == Sproutvideo::Response
|
30
|
+
|
31
|
+
FileUtils.rm('upload_test')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#list" do
|
36
|
+
before(:each) do
|
37
|
+
@url = "#{Sproutvideo.base_url}/videos"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should GET the correct url and return a response" do
|
41
|
+
|
42
|
+
@http_mock.should_receive(:get).with(
|
43
|
+
@url,
|
44
|
+
{:page => 1, :per_page => 25},
|
45
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
46
|
+
Sproutvideo::Video.list.class.should == Sproutvideo::Response
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should merge params" do
|
50
|
+
@http_mock.should_receive(:get).with(
|
51
|
+
@url,
|
52
|
+
{:page => 1, :per_page => 25, :foo => 'bar'},
|
53
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
54
|
+
Sproutvideo::Video.list(:foo => 'bar')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should use pagination params" do
|
58
|
+
@http_mock.should_receive(:get).with(
|
59
|
+
@url,
|
60
|
+
{:page => 2, :per_page => 5},
|
61
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
62
|
+
Sproutvideo::Video.list(:page => 2, :per_page => 5)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should request videos for a tag if tag_id is passed in" do
|
66
|
+
@http_mock.should_receive(:get).with(
|
67
|
+
@url,
|
68
|
+
{:page => 1, :per_page => 25, :tag_id => 'asdf'},
|
69
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
70
|
+
Sproutvideo::Video.list(:tag_id => 'asdf')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#details" do
|
75
|
+
before(:each) do
|
76
|
+
@video_id = 1
|
77
|
+
@url = "#{Sproutvideo.base_url}/videos/#{@video_id}"
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should get the correct url and return a response" do
|
81
|
+
@http_mock.should_receive(:get).with(
|
82
|
+
@url,
|
83
|
+
{},
|
84
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
85
|
+
Sproutvideo::Video.details(@video_id).class.should == Sproutvideo::Response
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "#update" do
|
90
|
+
before(:each) do
|
91
|
+
@video_id = 1
|
92
|
+
@url = "#{Sproutvideo.base_url}/videos/#{@video_id}"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should PUT the correct url and return a response" do
|
96
|
+
data = {:title => 'new title'}
|
97
|
+
|
98
|
+
@http_mock.should_receive(:put).with(
|
99
|
+
@url,
|
100
|
+
MultiJson.encode(data),
|
101
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
102
|
+
Sproutvideo::Video.update(@video_id, data).class.should == Sproutvideo::Response
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#delete" do
|
108
|
+
before(:each) do
|
109
|
+
@video_id = 1
|
110
|
+
@url = "#{Sproutvideo.base_url}/videos/#{@video_id}"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should DELETE the correct url and return a response" do
|
114
|
+
@http_mock.should_receive(:delete).with(
|
115
|
+
@url,
|
116
|
+
{},
|
117
|
+
{'SproutVideo-Api-Key' => @api_key}).and_return(@msg)
|
118
|
+
Sproutvideo::Video.destroy(@video_id).class.should == Sproutvideo::Response
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sproutvideo-rb}
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["SproutVideo"]
|
12
|
+
s.date = %q{2012-03-20}
|
13
|
+
s.description = %q{SproutVideo API Client}
|
14
|
+
s.email = %q{support@sproutvideo.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.markdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"lib/sproutvideo.rb",
|
26
|
+
"lib/sproutvideo/playlist.rb",
|
27
|
+
"lib/sproutvideo/resource.rb",
|
28
|
+
"lib/sproutvideo/response.rb",
|
29
|
+
"lib/sproutvideo/sproutvideo.rb",
|
30
|
+
"lib/sproutvideo/tag.rb",
|
31
|
+
"lib/sproutvideo/version.rb",
|
32
|
+
"lib/sproutvideo/video.rb",
|
33
|
+
"spec/spec_helper.rb",
|
34
|
+
"spec/sproutvideo/playlist_spec.rb",
|
35
|
+
"spec/sproutvideo/resource_spec.rb",
|
36
|
+
"spec/sproutvideo/response_spec.rb",
|
37
|
+
"spec/sproutvideo/sproutvideo_spec.rb",
|
38
|
+
"spec/sproutvideo/tag_spec.rb",
|
39
|
+
"spec/sproutvideo/video_spec.rb",
|
40
|
+
"spec/sproutvideo_spec.rb",
|
41
|
+
"sproutvideo-rb.gemspec"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/sproutvideo/sproutvideo-rb}
|
44
|
+
s.licenses = ["MIT"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.5.3}
|
47
|
+
s.summary = %q{SproutVideo API Client}
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_runtime_dependency(%q<httpclient>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
56
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
57
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
59
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<httpclient>, [">= 0"])
|
62
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
64
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
65
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
66
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
67
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<httpclient>, [">= 0"])
|
71
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
72
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
73
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
74
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
76
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
metadata
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sproutvideo-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- SproutVideo
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-03-20 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
name: httpclient
|
33
|
+
version_requirements: *id001
|
34
|
+
prerelease: false
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :runtime
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
name: multi_json
|
47
|
+
version_requirements: *id002
|
48
|
+
prerelease: false
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
type: :development
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 47
|
57
|
+
segments:
|
58
|
+
- 2
|
59
|
+
- 8
|
60
|
+
- 0
|
61
|
+
version: 2.8.0
|
62
|
+
name: rspec
|
63
|
+
version_requirements: *id003
|
64
|
+
prerelease: false
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
type: :development
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 31
|
73
|
+
segments:
|
74
|
+
- 3
|
75
|
+
- 12
|
76
|
+
version: "3.12"
|
77
|
+
name: rdoc
|
78
|
+
version_requirements: *id004
|
79
|
+
prerelease: false
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
type: :development
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 23
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 0
|
91
|
+
- 0
|
92
|
+
version: 1.0.0
|
93
|
+
name: bundler
|
94
|
+
version_requirements: *id005
|
95
|
+
prerelease: false
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
type: :development
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 49
|
104
|
+
segments:
|
105
|
+
- 1
|
106
|
+
- 8
|
107
|
+
- 3
|
108
|
+
version: 1.8.3
|
109
|
+
name: jeweler
|
110
|
+
version_requirements: *id006
|
111
|
+
prerelease: false
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
type: :development
|
114
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
name: rcov
|
124
|
+
version_requirements: *id007
|
125
|
+
prerelease: false
|
126
|
+
description: SproutVideo API Client
|
127
|
+
email: support@sproutvideo.com
|
128
|
+
executables: []
|
129
|
+
|
130
|
+
extensions: []
|
131
|
+
|
132
|
+
extra_rdoc_files:
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.markdown
|
135
|
+
files:
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.markdown
|
140
|
+
- Rakefile
|
141
|
+
- lib/sproutvideo.rb
|
142
|
+
- lib/sproutvideo/playlist.rb
|
143
|
+
- lib/sproutvideo/resource.rb
|
144
|
+
- lib/sproutvideo/response.rb
|
145
|
+
- lib/sproutvideo/sproutvideo.rb
|
146
|
+
- lib/sproutvideo/tag.rb
|
147
|
+
- lib/sproutvideo/version.rb
|
148
|
+
- lib/sproutvideo/video.rb
|
149
|
+
- spec/spec_helper.rb
|
150
|
+
- spec/sproutvideo/playlist_spec.rb
|
151
|
+
- spec/sproutvideo/resource_spec.rb
|
152
|
+
- spec/sproutvideo/response_spec.rb
|
153
|
+
- spec/sproutvideo/sproutvideo_spec.rb
|
154
|
+
- spec/sproutvideo/tag_spec.rb
|
155
|
+
- spec/sproutvideo/video_spec.rb
|
156
|
+
- spec/sproutvideo_spec.rb
|
157
|
+
- sproutvideo-rb.gemspec
|
158
|
+
has_rdoc: true
|
159
|
+
homepage: http://github.com/sproutvideo/sproutvideo-rb
|
160
|
+
licenses:
|
161
|
+
- MIT
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
|
165
|
+
require_paths:
|
166
|
+
- lib
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
none: false
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
hash: 3
|
173
|
+
segments:
|
174
|
+
- 0
|
175
|
+
version: "0"
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
184
|
+
version: "0"
|
185
|
+
requirements: []
|
186
|
+
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 1.5.3
|
189
|
+
signing_key:
|
190
|
+
specification_version: 3
|
191
|
+
summary: SproutVideo API Client
|
192
|
+
test_files: []
|
193
|
+
|