brightcove-api 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # 1.0.7 (2011-03-21)
2
+
3
+ * Allow for hash to be ordered when using the create_video call under Ruby 1.8.7
4
+
1
5
  # 1.0.6 (2011-02-16)
2
6
 
3
7
  * `set_timeout` can be used to set an HTTP timeout in seconds.
data/Gemfile CHANGED
@@ -14,3 +14,4 @@ end
14
14
  gem 'httparty', "~> 0.6.1"
15
15
  gem 'json', "~> 1.4.6"
16
16
  gem 'rest-client', "~> 1.6.1"
17
+ gem 'orderedhash', "~> 0.0.6"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
@@ -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.6"
8
+ s.version = "1.0.7"
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-02-16}
12
+ s.date = %q{2011-03-21}
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 = [
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.add_runtime_dependency(%q<httparty>, ["~> 0.6.1"])
51
51
  s.add_runtime_dependency(%q<json>, ["~> 1.4.6"])
52
52
  s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.1"])
53
+ s.add_runtime_dependency(%q<orderedhash>, ["~> 0.0.6"])
53
54
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
54
55
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
55
56
  s.add_development_dependency(%q<rcov>, ["~> 0.9.9"])
@@ -57,6 +58,7 @@ Gem::Specification.new do |s|
57
58
  s.add_dependency(%q<httparty>, ["~> 0.6.1"])
58
59
  s.add_dependency(%q<json>, ["~> 1.4.6"])
59
60
  s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
61
+ s.add_dependency(%q<orderedhash>, ["~> 0.0.6"])
60
62
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
63
  s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
62
64
  s.add_dependency(%q<rcov>, ["~> 0.9.9"])
@@ -65,6 +67,7 @@ Gem::Specification.new do |s|
65
67
  s.add_dependency(%q<httparty>, ["~> 0.6.1"])
66
68
  s.add_dependency(%q<json>, ["~> 1.4.6"])
67
69
  s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
70
+ s.add_dependency(%q<orderedhash>, ["~> 0.0.6"])
68
71
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
69
72
  s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
70
73
  s.add_dependency(%q<rcov>, ["~> 0.9.9"])
@@ -1,12 +1,13 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
3
  require 'rest-client'
4
+ require 'orderedhash'
4
5
 
5
6
  module Brightcove
6
7
  class API
7
8
  include HTTParty
8
9
 
9
- VERSION = '1.0.6'.freeze
10
+ VERSION = '1.0.7'.freeze
10
11
 
11
12
  DEFAULT_HEADERS = {
12
13
  'User-Agent' => "brightcove-api gem #{VERSION}"
@@ -49,10 +50,9 @@ module Brightcove
49
50
  def get(api_method, options = {})
50
51
  options.merge!({:command => api_method})
51
52
  options.merge!({:token => @token})
52
-
53
53
  query = {}
54
54
  query.merge!({:query => options})
55
-
55
+
56
56
  self.class.get(@read_api_url, query)
57
57
  end
58
58
 
@@ -73,11 +73,19 @@ module Brightcove
73
73
  body = {}
74
74
  body.merge!({:method => api_method})
75
75
  body.merge!({:params => parameters})
76
+
77
+ # Brightcove requires that the JSON-RPC call absolutely
78
+ # be the first part of a multi-part POST like create_video.
79
+ if RUBY_VERSION >= '1.9'
80
+ payload = {}
81
+ else
82
+ payload = OrderedHash.new
83
+ end
84
+
85
+ payload[:json] = body.to_json
86
+ payload[:file] = File.new(file, 'rb')
76
87
 
77
- response = RestClient.post(@write_api_url, {
78
- :json => body.to_json,
79
- :file => File.new(file, 'rb')
80
- }, :content_type => :json, :accept => :json, :multipart => true)
88
+ response = RestClient.post(@write_api_url, payload, :content_type => :json, :accept => :json, :multipart => true)
81
89
 
82
90
  JSON.parse(response)
83
91
  end
@@ -12,7 +12,7 @@ class TestBrightcoveApi < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_api_version
15
- assert_equal '1.0.6', Brightcove::API::VERSION
15
+ assert_equal '1.0.7', Brightcove::API::VERSION
16
16
  end
17
17
 
18
18
  def test_can_set_read_api_url
@@ -88,7 +88,7 @@ class TestBrightcoveApi < Test::Unit::TestCase
88
88
  :content_type => "application/json")
89
89
 
90
90
  brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
91
- brightcove_response = brightcove.post_file('delete_video',
91
+ brightcove_response = brightcove.post_file('create_video',
92
92
  File.join(File.dirname(__FILE__), 'fakeweb', 'movie.mov'),
93
93
  :video => {:shortDescription => "Short Description", :name => "Video"})
94
94
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcove-api
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 6
9
- version: 1.0.6
9
+ - 7
10
+ version: 1.0.7
10
11
  platform: ruby
11
12
  authors:
12
13
  - David Czarnecki
@@ -14,99 +15,121 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-02-16 00:00:00 -05:00
18
+ date: 2011-03-21 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ prerelease: false
21
24
  name: httparty
22
- requirement: &id001 !ruby/object:Gem::Requirement
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
26
  none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
30
+ hash: 5
27
31
  segments:
28
32
  - 0
29
33
  - 6
30
34
  - 1
31
35
  version: 0.6.1
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
32
38
  type: :runtime
33
39
  prerelease: false
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
40
  name: json
37
- requirement: &id002 !ruby/object:Gem::Requirement
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
42
  none: false
39
43
  requirements:
40
44
  - - ~>
41
45
  - !ruby/object:Gem::Version
46
+ hash: 11
42
47
  segments:
43
48
  - 1
44
49
  - 4
45
50
  - 6
46
51
  version: 1.4.6
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
47
54
  type: :runtime
48
55
  prerelease: false
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
56
  name: rest-client
52
- requirement: &id003 !ruby/object:Gem::Requirement
57
+ version_requirements: &id003 !ruby/object:Gem::Requirement
53
58
  none: false
54
59
  requirements:
55
60
  - - ~>
56
61
  - !ruby/object:Gem::Version
62
+ hash: 13
57
63
  segments:
58
64
  - 1
59
65
  - 6
60
66
  - 1
61
67
  version: 1.6.1
68
+ requirement: *id003
69
+ - !ruby/object:Gem::Dependency
62
70
  type: :runtime
63
71
  prerelease: false
64
- version_requirements: *id003
72
+ name: orderedhash
73
+ version_requirements: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ hash: 19
79
+ segments:
80
+ - 0
81
+ - 0
82
+ - 6
83
+ version: 0.0.6
84
+ requirement: *id004
65
85
  - !ruby/object:Gem::Dependency
86
+ type: :development
87
+ prerelease: false
66
88
  name: bundler
67
- requirement: &id004 !ruby/object:Gem::Requirement
89
+ version_requirements: &id005 !ruby/object:Gem::Requirement
68
90
  none: false
69
91
  requirements:
70
92
  - - ~>
71
93
  - !ruby/object:Gem::Version
94
+ hash: 23
72
95
  segments:
73
96
  - 1
74
97
  - 0
75
98
  - 0
76
99
  version: 1.0.0
100
+ requirement: *id005
101
+ - !ruby/object:Gem::Dependency
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
104
  name: jeweler
82
- requirement: &id005 !ruby/object:Gem::Requirement
105
+ version_requirements: &id006 !ruby/object:Gem::Requirement
83
106
  none: false
84
107
  requirements:
85
108
  - - ~>
86
109
  - !ruby/object:Gem::Version
110
+ hash: 1
87
111
  segments:
88
112
  - 1
89
113
  - 5
90
114
  - 1
91
115
  version: 1.5.1
116
+ requirement: *id006
117
+ - !ruby/object:Gem::Dependency
92
118
  type: :development
93
119
  prerelease: false
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
120
  name: rcov
97
- requirement: &id006 !ruby/object:Gem::Requirement
121
+ version_requirements: &id007 !ruby/object:Gem::Requirement
98
122
  none: false
99
123
  requirements:
100
124
  - - ~>
101
125
  - !ruby/object:Gem::Version
126
+ hash: 41
102
127
  segments:
103
128
  - 0
104
129
  - 9
105
130
  - 9
106
131
  version: 0.9.9
107
- type: :development
108
- prerelease: false
109
- version_requirements: *id006
132
+ requirement: *id007
110
133
  description: Ruby gem for interacting with the Brightcove media API. http://docs.brightcove.com/en/media/
111
134
  email: dczarnecki@agoragames.com
112
135
  executables: []
@@ -145,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
168
  requirements:
146
169
  - - ">="
147
170
  - !ruby/object:Gem::Version
148
- hash: 2943453376308896196
171
+ hash: 3
149
172
  segments:
150
173
  - 0
151
174
  version: "0"
@@ -154,6 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
177
  requirements:
155
178
  - - ">="
156
179
  - !ruby/object:Gem::Version
180
+ hash: 3
157
181
  segments:
158
182
  - 0
159
183
  version: "0"