brightcove-api 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzYzZDVkNDA5MmE4YmE0MDlmNDEyYTdiMWI5ZTg4NmIxYTQ0OWJhNg==
5
+ data.tar.gz: !binary |-
6
+ MjIyYjE0NzU4MjA3ZGE3MWI1MWI4NmJmNzYzYzM0YjI4Mzg2ZmYyYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDJkZGE5MGZlYWExNzczYTk4ZTAyYjFkMzJkNTcwNTg3MGZiOTNjYTRjMDRi
10
+ NjQ1YzMyZTk5MTM1YmMzODg3OTViMjgxYjZiNTYyZmE0NjU2YWRhMmVhMDNh
11
+ ODBjNjhmOGM2MTcwZjgzMDFmMTlmODQzODg2ZDIzNWIwMWFiODM=
12
+ data.tar.gz: !binary |-
13
+ NjcxYTZmYTI2OTZmNDUxNWJmODA0YmIwZGZmNWJjYzM4NzhkYTk2NTU1OWU5
14
+ Mzk0YTVjMTM4NTJmMzcwMTU3OTMyYTI3NWU5NGQ0YTdmNzg5ZmQ3MWQzMTdj
15
+ NThlOWY2OWI0MmE3N2FmNmU0ODEyMjE1MGVjOWIxODA2ZWNhZmM=
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ coverage
9
9
  rdoc
10
10
  pkg
11
11
  Gemfile.lock
12
+ .bundle
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.14 (2014-01-22)
4
+
5
+ * Handle IO streams provided by open-uri in post_io_streaming. [#11](https://github.com/BrightcoveOS/Ruby-MAPI-Wrapper/pull/11). Thanks @robdiciuccio.
6
+
3
7
  ## 1.0.13 (2013-04-24)
4
8
 
5
9
  * Allow an UploadIO object to be passed in to post_io_streaming Thanks @icebreaker
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 David Czarnecki
1
+ Copyright (c) 2010-2014 David Czarnecki
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -90,4 +90,4 @@ The brightcove-api gem is built and tested under Ruby 1.8.7, 1.9.2 and 1.9.3.
90
90
 
91
91
  ## Copyright
92
92
 
93
- Copyright (c) 2010-2013 David Czarnecki. See LICENSE for details.
93
+ Copyright (c) 2010-2014 David Czarnecki. See LICENSE for details.
@@ -162,7 +162,13 @@ module Brightcove
162
162
  response = nil
163
163
 
164
164
  payload[:json] = body.to_json
165
- payload[:file] = file.is_a?(UploadIO) ? file : UploadIO.new(file, content_type)
165
+
166
+ if file.is_a?(UploadIO)
167
+ payload[:file] = file
168
+ else
169
+ filename = file.respond_to?(:base_uri) ? File.basename(file.base_uri.to_s) : File.basename(file.path) rescue nil
170
+ payload[:file] = UploadIO.new(file, content_type, filename)
171
+ end
166
172
 
167
173
  request = Net::HTTP::Post::Multipart.new(url.path, payload)
168
174
 
@@ -1,5 +1,5 @@
1
1
  module Brightcove
2
2
  class API
3
- VERSION = '1.0.13'.freeze
3
+ VERSION = '1.0.14'.freeze
4
4
  end
5
5
  end
@@ -1,8 +1,9 @@
1
1
  require 'spec_helper'
2
+ require 'open-uri'
2
3
 
3
4
  describe Brightcove::API do
4
5
  it 'should be the correct version' do
5
- Brightcove::API::VERSION.should == '1.0.13'
6
+ Brightcove::API::VERSION.should == '1.0.14'
6
7
  end
7
8
 
8
9
  it 'should allow you to set new HTTP headers' do
@@ -134,4 +135,18 @@ describe Brightcove::API do
134
135
  brightcove_response['error'].should be_nil
135
136
  end
136
137
  end
138
+
139
+ it 'should allow you to create a video using #post_io_streaming with an HTTP source' do
140
+ VCR.use_cassette('post_io_streaming_http', :serialize_with => :yaml) do
141
+ brightcove = Brightcove::API.new('ZY4Ls9Hq6LCBgleGDTaFRDLWWBC8uoXQHkhGuDebKvjFPjHb3iT-4g..')
142
+ brightcove_response = open('http://archive.org/download/SummerSFSunset/SummerSFSunset_512kb.mp4') do |file|
143
+ brightcove.post_io_streaming('create_video', file, 'video/mp4',
144
+ :video => {:shortDescription => "Short Description", :name => "Video"})
145
+ end
146
+
147
+ brightcove_response.should have_key('result')
148
+ brightcove_response['result'].should == 3088439142001
149
+ brightcove_response['error'].should be_nil
150
+ end
151
+ end
137
152
  end
@@ -0,0 +1,112 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://archive.org/download/SummerSFSunset/SummerSFSunset_512kb.mp4
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 302
17
+ message: Moved Temporarily
18
+ headers:
19
+ server:
20
+ - nginx/1.1.19
21
+ date:
22
+ - Wed, 22 Jan 2014 02:08:52 GMT
23
+ content-type:
24
+ - video/mp4
25
+ transfer-encoding:
26
+ - chunked
27
+ connection:
28
+ - keep-alive
29
+ x-powered-by:
30
+ - PHP/5.3.10-1ubuntu3.2
31
+ accept-ranges:
32
+ - bytes
33
+ location:
34
+ - http://ia700500.us.archive.org/11/items/SummerSFSunset/SummerSFSunset_512kb.mp4
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ http_version: '1.1'
39
+ recorded_at: Wed, 22 Jan 2014 02:08:52 GMT
40
+ - request:
41
+ method: get
42
+ uri: http://ia700500.us.archive.org/11/items/SummerSFSunset/SummerSFSunset_512kb.mp4
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ''
46
+ headers:
47
+ accept:
48
+ - ! '*/*'
49
+ user-agent:
50
+ - Ruby
51
+ response:
52
+ status:
53
+ code: 200
54
+ message: OK
55
+ headers:
56
+ server:
57
+ - nginx/1.1.19
58
+ date:
59
+ - Wed, 22 Jan 2014 02:08:52 GMT
60
+ content-type:
61
+ - video/mp4
62
+ content-length:
63
+ - '1378120'
64
+ last-modified:
65
+ - Sun, 30 Nov 2008 02:00:01 GMT
66
+ connection:
67
+ - keep-alive
68
+ expires:
69
+ - Wed, 22 Jan 2014 08:08:52 GMT
70
+ cache-control:
71
+ - max-age=21600
72
+ accept-ranges:
73
+ - bytes
74
+ body:
75
+ encoding: ASCII-8BIT
76
+ string: ''
77
+ http_version: '1.1'
78
+ recorded_at: Wed, 22 Jan 2014 02:08:53 GMT
79
+ - request:
80
+ method: post
81
+ uri: http://api.brightcove.com/services/post
82
+ body:
83
+ encoding: US-ASCII
84
+ string: ''
85
+ headers:
86
+ accept:
87
+ - ! '*/*'
88
+ user-agent:
89
+ - Ruby
90
+ content-type:
91
+ - multipart/form-data; boundary=-----------RubyMultipartPost
92
+ content-length:
93
+ - '1378607'
94
+ response:
95
+ status:
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ content-type:
100
+ - application/json;charset=UTF-8
101
+ content-length:
102
+ - '52'
103
+ date:
104
+ - Wed, 22 Jan 2014 02:08:55 GMT
105
+ server:
106
+ - brightcove
107
+ body:
108
+ encoding: US-ASCII
109
+ string: ! '{"result": 3088439142001, "error": null, "id": null}'
110
+ http_version: '1.1'
111
+ recorded_at: Wed, 22 Jan 2014 02:08:56 GMT
112
+ recorded_with: VCR 2.8.0
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcove-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
5
- prerelease:
4
+ version: 1.0.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Czarnecki
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rest-client
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: multipart-post
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: orderedhash
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fakeweb
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: mocha
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rake
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rspec
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ! '>='
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ! '>='
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: vcr
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ! '>='
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ! '>='
172
151
  - !ruby/object:Gem::Version
@@ -198,35 +177,29 @@ files:
198
177
  - spec/vcr_cassettes/find_all_videos_mrss.json
199
178
  - spec/vcr_cassettes/post_file.yml
200
179
  - spec/vcr_cassettes/post_file_streaming.yml
180
+ - spec/vcr_cassettes/post_io_streaming_http.yml
201
181
  homepage: http://github.com/BrightcoveOS/Ruby-MAPI-Wrapper
202
182
  licenses: []
183
+ metadata: {}
203
184
  post_install_message:
204
185
  rdoc_options: []
205
186
  require_paths:
206
187
  - lib
207
188
  required_ruby_version: !ruby/object:Gem::Requirement
208
- none: false
209
189
  requirements:
210
190
  - - ! '>='
211
191
  - !ruby/object:Gem::Version
212
192
  version: '0'
213
- segments:
214
- - 0
215
- hash: 3040307960054410367
216
193
  required_rubygems_version: !ruby/object:Gem::Requirement
217
- none: false
218
194
  requirements:
219
195
  - - ! '>='
220
196
  - !ruby/object:Gem::Version
221
197
  version: '0'
222
- segments:
223
- - 0
224
- hash: 3040307960054410367
225
198
  requirements: []
226
199
  rubyforge_project: brightcove-api
227
- rubygems_version: 1.8.25
200
+ rubygems_version: 2.2.0
228
201
  signing_key:
229
- specification_version: 3
202
+ specification_version: 4
230
203
  summary: Ruby gem for interacting with the Brightcove media API
231
204
  test_files:
232
205
  - spec/assets/movie.mov
@@ -238,3 +211,4 @@ test_files:
238
211
  - spec/vcr_cassettes/find_all_videos_mrss.json
239
212
  - spec/vcr_cassettes/post_file.yml
240
213
  - spec/vcr_cassettes/post_file_streaming.yml
214
+ - spec/vcr_cassettes/post_io_streaming_http.yml