BrightcoveOS/Ruby-MAPI-Wrapper — pull request #11 by robdiciuccio (2014-01-22 21:40:27+00:00)
Title: Handle IO streams provided by open-uri in post_io_streaming

Posting an open-uri HTTP IO object via `post_io_streaming` results in the following error:

`{"error"=>{"name"=>"FileFormatError", "code"=>306, "message"=>"Unacceptable file (extension): open-uri20140121-9399-1jxs6ke-0 for an upload to media type: 2."}, "result"=>nil, "id"=>nil}`

Sample code for reproducing this error with a remote MP4 file:

```ruby
require 'open-uri'
open('http://archive.org/download/SummerSFSunset/SummerSFSunset_512kb.mp4') do |file|
brightcove.post_io_streaming('create_video', file, 'video/mp4', :video => {:shortDescription => 'Short Description', :name => 'Video name'})
end
```

Passing the third required "filename" argument to the UploadIO constructor resolves the issue.

From the UploadIO docs:
> Can take two forms. The first accepts a filename and content type, and opens the file for reading (to be closed by finalizer).
>
> The second accepts an already-open IO, but also requires a third argument, the filename from which it was opened (particularly useful/recommended if uploading directly from a form in a framework, which often save the file to an arbitrarily named RackMultipart file in /tmp).
>
> Usage:
>
> UploadIO.new("file.txt", "text/plain")
> UploadIO.new(file_io, "text/plain", "file.txt")