brightcove-api 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/README.md +20 -4
- data/Rakefile +4 -0
- data/VERSION +1 -1
- data/brightcove-api.gemspec +6 -7
- data/lib/brightcove-api.rb +39 -31
- data/test/test_brightcove-api.rb +78 -32
- metadata +29 -74
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -15,6 +15,22 @@ Install
|
|
15
15
|
|
16
16
|
* sudo gem install brightcove-api
|
17
17
|
|
18
|
+
Searching
|
19
|
+
=========
|
20
|
+
|
21
|
+
To replicate one of the brightcove search API examples:
|
22
|
+
|
23
|
+
> find all videos that have "football" and "Chicago" in the name, short description, or long
|
24
|
+
> description, and which also have the tag "free", and also have either the tag "color" or the
|
25
|
+
> tag "technicolor"
|
26
|
+
|
27
|
+
>> brightcove = Brightcove::API.new(...)
|
28
|
+
>> response = brightcove.get('search_videos', {
|
29
|
+
:any => [ "tag:color", "tag:technicolor" ],
|
30
|
+
:all => ["football", "chicago", "tag:free"]
|
31
|
+
})
|
32
|
+
|
33
|
+
|
18
34
|
Example
|
19
35
|
=======
|
20
36
|
|
@@ -28,15 +44,15 @@ Example
|
|
28
44
|
=> {"items"=>[{"longDescription"=>nil, "name"=>"Wild Slopes '06", "lastModifiedDate"=>"1171324523307", "thumbnailURL"=>"http://brightcove.vo.llnwd.net/d2/unsecured/media/270881183/270881183_502534829_94499905676eb7cd04a558da2adcf6a34f437b88.jpg?pubId=270881183", "tags"=>["adventure", "snowboarding"], "playsTrailingWeek"=>35, "shortDescription"=>"A ski and snowboard movie that challenges the hype and dares you to see what freeskiing and snowboarding have become. Documenting the very best of this year's riding and culture.", "playsTotal"=>4458, "adKeys"=>nil, "id"=>496518766, "length"=>51251, "videoStillURL"=>"http://brightcove.vo.llnwd.net/d2/unsecured/media/270881183/270881183_502534838_f80fe64f052328cd3b2e158d7234003a23091845.jpg?pubId=270881183", "publishedDate"=>"1171324434811", "creationDate"=>"1171267200000", "linkText"=>nil, "economics"=>"FREE", "referenceId"=>"title010", "linkURL"=>nil}, {"longDescription"=>nil, "name"=>"Jellyfish", "lastModifiedDate"=>"1245181300374", "thumbnailURL"=>"http://brightcove.vo.llnwd.net/d7/unsecured/media/270881183/270881183_26530711001_jellyFish.jpg?pubId=270881183", "tags"=>["sea", "custom skins"], "playsTrailingWeek"=>46, "shortDescription"=>"Jellyfish", "playsTotal"=>4081, "adKeys"=>nil, "id"=>26512561001, "length"=>28400, "videoStillURL"=>"http://brightcove.vo.llnwd.net/d7/unsecured/media/270881183/270881183_26519430001_vs-270881183-vid26513829001-img0000.jpg?pubId=270881183", "publishedDate"=>"1245172164326", "creationDate"=>"1245172164326", "linkText"=>nil, "economics"=>"AD_SUPPORTED", "referenceId"=>nil, "linkURL"=>nil}, {"longDescription"=>"Long Description", "name"=>"Demo Title 2", "lastModifiedDate"=>"1263581295791", "thumbnailURL"=>"http://brightcove.vo.llnwd.net/d2/unsecured/media/270881183/270881183_275925069_d1f97c7f07f2a3f4de7b38eda3761f16f39d2a99.jpg?pubId=270881183", "tags"=>[], "playsTrailingWeek"=>1, "shortDescription"=>"Short Description", "playsTotal"=>3876, "adKeys"=>nil, "id"=>276024035, "length"=>418742, "videoStillURL"=>"http://brightcove.vo.llnwd.net/d2/unsecured/media/270881183/270881183_275943599_b7e2ca63c0311fa3f0b027304b41d252f12d2d66.jpg?pubId=270881183", "publishedDate"=>"1161296014264", "creationDate"=>"1161241200000", "linkText"=>"Related Link", "economics"=>"FREE", "referenceId"=>nil, "linkURL"=>"http://www.brightcove.com"}, {"longDescription"=>nil, "name"=>"Dolphins", "lastModifiedDate"=>"1263581295790", "thumbnailURL"=>"http://brightcove.vo.llnwd.net/d7/unsecured/media/270881183/270881183_26531197001_dolphins.jpg?pubId=270881183", "tags"=>["sea", "custom skins"], "playsTrailingWeek"=>30, "shortDescription"=>"Dolphins", "playsTotal"=>3870, "adKeys"=>nil, "id"=>26511963001, "length"=>12800, "videoStillURL"=>"http://brightcove.vo.llnwd.net/d7/unsecured/media/270881183/270881183_26519372001_vs-270881183-vid26510372001-img0000.jpg?pubId=270881183", "publishedDate"=>"1245171732987", "creationDate"=>"1245171732987", "linkText"=>nil, "economics"=>"AD_SUPPORTED", "referenceId"=>nil, "linkURL"=>nil}, {"longDescription"=>nil, "name"=>"Welcome to Brightcove 3", "lastModifiedDate"=>"1225134261511", "thumbnailURL"=>"http://brightcove.vo.llnwd.net/d6/unsecured/media/270881183/270881183_1858983740_brightcove3-thumb.jpg?pubId=270881183", "tags"=>[], "playsTrailingWeek"=>0, "shortDescription"=>"Tareef Kawaf, Brightcove's SVP of Engineering, welcomes you to Brightcove 3.", "playsTotal"=>3349, "adKeys"=>nil, "id"=>1858922805, "length"=>53820, "videoStillURL"=>"http://brightcove.vo.llnwd.net/d6/unsecured/media/270881183/270881183_1858994782_vid-StudioDashboards.jpg?pubId=270881183", "publishedDate"=>"1225134261508", "creationDate"=>"1224096089173", "linkText"=>nil, "economics"=>"AD_SUPPORTED", "referenceId"=>nil, "linkURL"=>nil}], "page_number"=>0, "page_size"=>5, "total_count"=>-1}
|
29
45
|
>> response = brightcove.post('delete_video', {:video_id => '595153263001'})
|
30
46
|
=> {"result"=>{}, "id"=>nil, "error"=>nil}
|
31
|
-
|
47
|
+
|
32
48
|
If you want to perform a file upload, for example, to create a video, you can use the __post_file()__ method.
|
33
49
|
|
34
50
|
>> response = brightcove.post_file('create_video', '/path/to/video.mov', :video => {:shortDescription => 'Short Description', :name => 'Video name'})
|
35
|
-
=> {"result"=>653155417001, "error=>nil, "id"=>nil}
|
36
|
-
|
51
|
+
=> {"result"=>653155417001, "error=>nil, "id"=>nil}
|
52
|
+
|
37
53
|
Note on Patches/Pull Requests
|
38
54
|
=============================
|
39
|
-
|
55
|
+
|
40
56
|
* Fork the project.
|
41
57
|
* Make your feature addition or bug fix.
|
42
58
|
* Add tests for it. This is important so I don't break it in a
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.8
|
data/brightcove-api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{brightcove-api}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Czarnecki"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-10}
|
13
13
|
s.description = %q{Ruby gem for interacting with the Brightcove media API. http://docs.brightcove.com/en/media/}
|
14
14
|
s.email = %q{dczarnecki@agoragames.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/BrightcoveOS/Ruby-MAPI-Wrapper}
|
36
36
|
s.licenses = ["MIT"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.
|
38
|
+
s.rubygems_version = %q{1.7.2}
|
39
39
|
s.summary = %q{Ruby gem for interacting with the Brightcove media API}
|
40
40
|
s.test_files = [
|
41
41
|
"test/helper.rb",
|
@@ -43,11 +43,10 @@ Gem::Specification.new do |s|
|
|
43
43
|
]
|
44
44
|
|
45
45
|
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
46
|
s.specification_version = 3
|
48
47
|
|
49
48
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_runtime_dependency(%q<httparty>, ["~> 0.
|
49
|
+
s.add_runtime_dependency(%q<httparty>, ["~> 0.7.7"])
|
51
50
|
s.add_runtime_dependency(%q<json>, ["~> 1.4.6"])
|
52
51
|
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.1"])
|
53
52
|
s.add_runtime_dependency(%q<orderedhash>, ["~> 0.0.6"])
|
@@ -55,7 +54,7 @@ Gem::Specification.new do |s|
|
|
55
54
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
56
55
|
s.add_development_dependency(%q<rcov>, ["~> 0.9.9"])
|
57
56
|
else
|
58
|
-
s.add_dependency(%q<httparty>, ["~> 0.
|
57
|
+
s.add_dependency(%q<httparty>, ["~> 0.7.7"])
|
59
58
|
s.add_dependency(%q<json>, ["~> 1.4.6"])
|
60
59
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
61
60
|
s.add_dependency(%q<orderedhash>, ["~> 0.0.6"])
|
@@ -64,7 +63,7 @@ Gem::Specification.new do |s|
|
|
64
63
|
s.add_dependency(%q<rcov>, ["~> 0.9.9"])
|
65
64
|
end
|
66
65
|
else
|
67
|
-
s.add_dependency(%q<httparty>, ["~> 0.
|
66
|
+
s.add_dependency(%q<httparty>, ["~> 0.7.7"])
|
68
67
|
s.add_dependency(%q<json>, ["~> 1.4.6"])
|
69
68
|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
|
70
69
|
s.add_dependency(%q<orderedhash>, ["~> 0.0.6"])
|
data/lib/brightcove-api.rb
CHANGED
@@ -6,74 +6,82 @@ require 'orderedhash'
|
|
6
6
|
module Brightcove
|
7
7
|
class API
|
8
8
|
include HTTParty
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
disable_rails_query_string_format
|
10
|
+
|
11
|
+
VERSION = '1.0.8'.freeze
|
12
|
+
|
12
13
|
DEFAULT_HEADERS = {
|
13
14
|
'User-Agent' => "brightcove-api gem #{VERSION}"
|
14
15
|
}
|
15
|
-
|
16
|
+
|
16
17
|
headers(DEFAULT_HEADERS)
|
17
|
-
|
18
|
+
|
18
19
|
READ_API_URL = 'http://api.brightcove.com/services/library'
|
19
20
|
WRITE_API_URL = 'http://api.brightcove.com/services/post'
|
20
|
-
|
21
|
+
|
21
22
|
attr_accessor :read_api_url
|
22
23
|
attr_accessor :write_api_url
|
23
24
|
attr_accessor :token
|
24
|
-
|
25
|
+
|
25
26
|
# Brightcove returns text/html as the Content-Type for a response even though the response is JSON.
|
26
27
|
# So, let's just parse the response as JSON
|
27
28
|
format(:json)
|
28
|
-
|
29
|
-
# Initialize with your API token
|
29
|
+
|
30
|
+
# Initialize with your API token
|
30
31
|
def initialize(token, read_api_url = READ_API_URL, write_api_url = WRITE_API_URL)
|
31
32
|
@token = token
|
32
33
|
@read_api_url = read_api_url
|
33
34
|
@write_api_url = write_api_url
|
34
35
|
end
|
35
|
-
|
36
|
+
|
36
37
|
def debug(location = $stderr)
|
37
38
|
self.class.debug_output(location)
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
def set_http_headers(http_headers = {})
|
41
42
|
http_headers.merge!(DEFAULT_HEADERS)
|
42
43
|
headers(http_headers)
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
def set_timeout(timeout)
|
46
47
|
default_timeout(timeout)
|
47
48
|
end
|
48
|
-
|
49
|
-
# Call Brightcove using a particular API method, api_method. The options hash is where you can add any parameters appropriate for the API call.
|
50
|
-
def get(api_method, options = {})
|
51
|
-
options.merge!({:command => api_method})
|
52
|
-
options.merge!({:token => @token})
|
53
|
-
query = {}
|
54
|
-
query.merge!({:query => options})
|
55
49
|
|
56
|
-
|
50
|
+
def build_query_from_options(api_method, options = {})
|
51
|
+
# normalize options to a hash
|
52
|
+
unless options.respond_to?(:merge!)
|
53
|
+
options = CGI.parse(options)
|
54
|
+
end
|
55
|
+
options.merge!({:command => api_method, :token => @token})
|
56
|
+
{ :query => options }
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
|
+
# Call Brightcove using a particular API method, api_method.
|
60
|
+
# The options parameter can be either a query string or a hash. In either case, it is where
|
61
|
+
# you can add any parameters appropriate for the API call. If a query string, it will be
|
62
|
+
# normalized to a hash via CGI.parse.
|
63
|
+
def get(api_method, options = {})
|
64
|
+
self.class.get(@read_api_url, build_query_from_options(api_method, options))
|
65
|
+
end
|
66
|
+
|
59
67
|
# Post to Brightcove using a particular API method, api_method. The parameters hash is where you add all the required parameters appropriate for the API call.
|
60
|
-
def post(api_method, parameters = {})
|
68
|
+
def post(api_method, parameters = {})
|
61
69
|
parameters.merge!({"token" => @token})
|
62
|
-
|
70
|
+
|
63
71
|
body = {}
|
64
|
-
body.merge!({:method => api_method})
|
72
|
+
body.merge!({:method => api_method})
|
65
73
|
body.merge!({:params => parameters})
|
66
|
-
|
74
|
+
|
67
75
|
self.class.post(@write_api_url, {:body => {:json => JSON.generate(body)}})
|
68
76
|
end
|
69
|
-
|
77
|
+
|
70
78
|
def post_file(api_method, file, parameters = {})
|
71
79
|
parameters.merge!({"token" => @token})
|
72
80
|
|
73
81
|
body = {}
|
74
|
-
body.merge!({:method => api_method})
|
82
|
+
body.merge!({:method => api_method})
|
75
83
|
body.merge!({:params => parameters})
|
76
|
-
|
84
|
+
|
77
85
|
# Brightcove requires that the JSON-RPC call absolutely
|
78
86
|
# be the first part of a multi-part POST like create_video.
|
79
87
|
if RUBY_VERSION >= '1.9'
|
@@ -81,12 +89,12 @@ module Brightcove
|
|
81
89
|
else
|
82
90
|
payload = OrderedHash.new
|
83
91
|
end
|
84
|
-
|
92
|
+
|
85
93
|
payload[:json] = body.to_json
|
86
94
|
payload[:file] = File.new(file, 'rb')
|
87
|
-
|
95
|
+
|
88
96
|
response = RestClient.post(@write_api_url, payload, :content_type => :json, :accept => :json, :multipart => true)
|
89
|
-
|
97
|
+
|
90
98
|
JSON.parse(response)
|
91
99
|
end
|
92
100
|
end
|
data/test/test_brightcove-api.rb
CHANGED
@@ -6,22 +6,22 @@ class TestBrightcoveApi < Test::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
FakeWeb.allow_net_connect = false
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def teardown
|
11
11
|
FakeWeb.allow_net_connect = true
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def test_api_version
|
15
|
-
assert_equal '1.0.
|
15
|
+
assert_equal '1.0.8', Brightcove::API::VERSION
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def test_can_set_read_api_url
|
19
19
|
brightcove = Brightcove::API.new('apikeytoken')
|
20
|
-
|
20
|
+
|
21
21
|
assert_equal Brightcove::API::READ_API_URL, brightcove.read_api_url
|
22
|
-
|
22
|
+
|
23
23
|
brightcove.read_api_url = 'http://some.api.com'
|
24
|
-
|
24
|
+
|
25
25
|
assert_equal 'http://some.api.com', brightcove.read_api_url
|
26
26
|
end
|
27
27
|
|
@@ -31,65 +31,111 @@ class TestBrightcoveApi < Test::Unit::TestCase
|
|
31
31
|
assert_equal Brightcove::API::WRITE_API_URL, brightcove.write_api_url
|
32
32
|
|
33
33
|
brightcove.write_api_url = 'http://some.api.com'
|
34
|
-
|
34
|
+
|
35
35
|
assert_equal 'http://some.api.com', brightcove.write_api_url
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def test_can_set_token
|
39
39
|
brightcove = Brightcove::API.new('apikeytoken')
|
40
|
-
|
40
|
+
|
41
41
|
assert_equal 'apikeytoken', brightcove.token
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
def test_can_set_http_headers
|
45
45
|
brightcove = Brightcove::API.new('apikeytoken')
|
46
46
|
brightcove.expects(:headers).at_least_once
|
47
|
-
|
47
|
+
|
48
48
|
brightcove.set_http_headers({'Accept' => 'application/json'})
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def test_can_set_timeout
|
52
52
|
brightcove = Brightcove::API.new('apikeytoken')
|
53
53
|
brightcove.expects(:default_timeout).at_least_once
|
54
|
-
|
54
|
+
|
55
55
|
brightcove.set_timeout(5)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def test_find_all_videos
|
59
|
-
FakeWeb.register_uri(:get,
|
60
|
-
'http://api.brightcove.com/services/library?page_size=5&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&command=find_all_videos',
|
61
|
-
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'find_all_videos_response.json'),
|
59
|
+
FakeWeb.register_uri(:get,
|
60
|
+
'http://api.brightcove.com/services/library?page_size=5&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.&command=find_all_videos',
|
61
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'find_all_videos_response.json'),
|
62
62
|
:content_type => "application/json")
|
63
|
-
|
63
|
+
|
64
64
|
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
65
65
|
brightcove_response = brightcove.get('find_all_videos', {:page_size => 5})
|
66
|
-
|
66
|
+
|
67
67
|
assert_equal 5, brightcove_response['items'].size
|
68
68
|
assert_equal 0, brightcove_response['page_number']
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
|
+
def test_search_with_array_params
|
72
|
+
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
73
|
+
brightcove.class.expects(:get).with(anything, has_entry(:query => {
|
74
|
+
:any => ['tag:foo', 'tag:bar'],
|
75
|
+
:command => 'search_videos',
|
76
|
+
:token => '0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.'
|
77
|
+
}))
|
78
|
+
brightcove_response = brightcove.get('search_videos', { :any => [ "tag:foo", "tag:bar" ] })
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_search_with_string_params
|
82
|
+
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
83
|
+
brightcove.class.expects(:get).with(anything, has_entry(:query => {
|
84
|
+
'any' => ['tag:bar', 'tag:foo'],
|
85
|
+
:command => 'search_videos',
|
86
|
+
:token => '0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.'
|
87
|
+
}))
|
88
|
+
brightcove_response = brightcove.get('search_videos', 'any=tag:bar&any=tag:foo' )
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_more_complicated_query
|
92
|
+
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
93
|
+
brightcove.class.expects(:get).with(anything, has_entry(:query => {
|
94
|
+
:any => ['tag:foo', 'tag:bar'],
|
95
|
+
:all => "search_text:foo",
|
96
|
+
:command => 'search_videos',
|
97
|
+
:token => '0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.'
|
98
|
+
}))
|
99
|
+
brightcove_response = brightcove.get('search_videos', { :any => [ "tag:foo", "tag:bar" ], :all => "search_text:foo" })
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_brightcove_example_query
|
103
|
+
FakeWeb.register_uri(:get,
|
104
|
+
'http://api.brightcove.com/services/library?all=chicago&all=football&all=tag%3Afree&any=tag%3Acolor&any=tag%3Atechnicolor&command=search_videos&token=0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.',
|
105
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'find_all_videos_response.json'),
|
106
|
+
:content_type => "application/json")
|
107
|
+
|
108
|
+
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
109
|
+
brightcove_response = brightcove.get('search_videos', {
|
110
|
+
:any => [ "tag:color", "tag:technicolor" ],
|
111
|
+
:all => ["football", "chicago", "tag:free"]
|
112
|
+
})
|
113
|
+
|
114
|
+
assert_equal 5, brightcove_response['items'].size
|
115
|
+
end
|
116
|
+
|
71
117
|
def test_delete_video
|
72
|
-
FakeWeb.register_uri(:post,
|
73
|
-
'http://api.brightcove.com/services/post',
|
74
|
-
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'delete_video_response.json'),
|
118
|
+
FakeWeb.register_uri(:post,
|
119
|
+
'http://api.brightcove.com/services/post',
|
120
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'delete_video_response.json'),
|
75
121
|
:content_type => "application/json")
|
76
|
-
|
122
|
+
|
77
123
|
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
78
124
|
brightcove_response = brightcove.post('delete_video', {:video_id => '595153261337'})
|
79
|
-
|
125
|
+
|
80
126
|
assert brightcove_response.has_key?('result')
|
81
127
|
assert_equal brightcove_response['error'], 'nil'
|
82
128
|
end
|
83
|
-
|
129
|
+
|
84
130
|
def test_create_video_using_post_file
|
85
|
-
FakeWeb.register_uri(:post,
|
86
|
-
'http://api.brightcove.com/services/post',
|
87
|
-
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'create_video_response.json'),
|
131
|
+
FakeWeb.register_uri(:post,
|
132
|
+
'http://api.brightcove.com/services/post',
|
133
|
+
:body => File.join(File.dirname(__FILE__), 'fakeweb', 'create_video_response.json'),
|
88
134
|
:content_type => "application/json")
|
89
135
|
|
90
136
|
brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
|
91
|
-
brightcove_response = brightcove.post_file('create_video',
|
92
|
-
File.join(File.dirname(__FILE__), 'fakeweb', 'movie.mov'),
|
137
|
+
brightcove_response = brightcove.post_file('create_video',
|
138
|
+
File.join(File.dirname(__FILE__), 'fakeweb', 'movie.mov'),
|
93
139
|
:video => {:shortDescription => "Short Description", :name => "Video"})
|
94
140
|
|
95
141
|
assert brightcove_response.has_key?('result')
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightcove-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 7
|
10
|
-
version: 1.0.7
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.8
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- David Czarnecki
|
@@ -15,121 +10,85 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
13
|
+
date: 2011-05-10 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
16
|
name: httparty
|
25
|
-
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
19
|
requirements:
|
28
20
|
- - ~>
|
29
21
|
- !ruby/object:Gem::Version
|
30
|
-
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 6
|
34
|
-
- 1
|
35
|
-
version: 0.6.1
|
36
|
-
requirement: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
22
|
+
version: 0.7.7
|
38
23
|
type: :runtime
|
39
24
|
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
40
27
|
name: json
|
41
|
-
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
29
|
none: false
|
43
30
|
requirements:
|
44
31
|
- - ~>
|
45
32
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 11
|
47
|
-
segments:
|
48
|
-
- 1
|
49
|
-
- 4
|
50
|
-
- 6
|
51
33
|
version: 1.4.6
|
52
|
-
requirement: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
34
|
type: :runtime
|
55
35
|
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
56
38
|
name: rest-client
|
57
|
-
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
40
|
none: false
|
59
41
|
requirements:
|
60
42
|
- - ~>
|
61
43
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 13
|
63
|
-
segments:
|
64
|
-
- 1
|
65
|
-
- 6
|
66
|
-
- 1
|
67
44
|
version: 1.6.1
|
68
|
-
requirement: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
45
|
type: :runtime
|
71
46
|
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
72
49
|
name: orderedhash
|
73
|
-
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
51
|
none: false
|
75
52
|
requirements:
|
76
53
|
- - ~>
|
77
54
|
- !ruby/object:Gem::Version
|
78
|
-
hash: 19
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
- 0
|
82
|
-
- 6
|
83
55
|
version: 0.0.6
|
84
|
-
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
type: :development
|
56
|
+
type: :runtime
|
87
57
|
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
88
60
|
name: bundler
|
89
|
-
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
62
|
none: false
|
91
63
|
requirements:
|
92
64
|
- - ~>
|
93
65
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 23
|
95
|
-
segments:
|
96
|
-
- 1
|
97
|
-
- 0
|
98
|
-
- 0
|
99
66
|
version: 1.0.0
|
100
|
-
requirement: *id005
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
67
|
type: :development
|
103
68
|
prerelease: false
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
104
71
|
name: jeweler
|
105
|
-
|
72
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
106
73
|
none: false
|
107
74
|
requirements:
|
108
75
|
- - ~>
|
109
76
|
- !ruby/object:Gem::Version
|
110
|
-
hash: 1
|
111
|
-
segments:
|
112
|
-
- 1
|
113
|
-
- 5
|
114
|
-
- 1
|
115
77
|
version: 1.5.1
|
116
|
-
requirement: *id006
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
78
|
type: :development
|
119
79
|
prerelease: false
|
80
|
+
version_requirements: *id006
|
81
|
+
- !ruby/object:Gem::Dependency
|
120
82
|
name: rcov
|
121
|
-
|
83
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
122
84
|
none: false
|
123
85
|
requirements:
|
124
86
|
- - ~>
|
125
87
|
- !ruby/object:Gem::Version
|
126
|
-
hash: 41
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
- 9
|
130
|
-
- 9
|
131
88
|
version: 0.9.9
|
132
|
-
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *id007
|
133
92
|
description: Ruby gem for interacting with the Brightcove media API. http://docs.brightcove.com/en/media/
|
134
93
|
email: dczarnecki@agoragames.com
|
135
94
|
executables: []
|
@@ -154,7 +113,6 @@ files:
|
|
154
113
|
- test/fakeweb/movie.mov
|
155
114
|
- test/helper.rb
|
156
115
|
- test/test_brightcove-api.rb
|
157
|
-
has_rdoc: true
|
158
116
|
homepage: http://github.com/BrightcoveOS/Ruby-MAPI-Wrapper
|
159
117
|
licenses:
|
160
118
|
- MIT
|
@@ -168,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
126
|
requirements:
|
169
127
|
- - ">="
|
170
128
|
- !ruby/object:Gem::Version
|
171
|
-
hash:
|
129
|
+
hash: 4201101218495079525
|
172
130
|
segments:
|
173
131
|
- 0
|
174
132
|
version: "0"
|
@@ -177,14 +135,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
135
|
requirements:
|
178
136
|
- - ">="
|
179
137
|
- !ruby/object:Gem::Version
|
180
|
-
hash: 3
|
181
|
-
segments:
|
182
|
-
- 0
|
183
138
|
version: "0"
|
184
139
|
requirements: []
|
185
140
|
|
186
141
|
rubyforge_project:
|
187
|
-
rubygems_version: 1.
|
142
|
+
rubygems_version: 1.7.2
|
188
143
|
signing_key:
|
189
144
|
specification_version: 3
|
190
145
|
summary: Ruby gem for interacting with the Brightcove media API
|