jreidinger/studio_api — pull request #5 by vmoravec (2012-01-24 15:30:29+00:00)
Title: File#content enhancements

I added a block to the #content method to preserve the current functionality (returning the http response directly) and to avoid loading the files into memory. When the block is used the file is being saved as a Tempfile first and then it is to be accessed from the block parameter for further manipulation.

Example:
-----------

```ruby
# setup the StudioApi::Connection
# find the file
remote_file = StudioApi::File.find 123
destination = '/home/user/files'

remote_file.content do |temp_file|
# do something with the temp_file
File.copy temp_file.path, destination_path
end
# the Tempfile is deleted at the end of the block
```
Other:
-------------

+ missing tests: the Fakeweb gem is a beast for testing the functionality of that method, some hint please so I could make some testing here