propertybase/executrix — pull request #19 by theSteveMitchell (2014-08-05 02:53:56+00:00)
Title: Streaming query results

This PR totally lacks tests, and needs a refactor, but I'm looking for suggestions before I finish.

Added the use of Net::HttpResponse's read_body method to stream results as they are read from the socket. This greatly improves speed and memory use, since we don't have to wait for the entire payload, and then pass the entire result collection around in memory. This also changes the structure of calling query to better fit the paradigm:
```ruby
> bulk = Executrix::Api.new(...)
> batch = bulk.query("Account", "select Id from Account") #=> blocks until batch/job completes.
=># batch.results do |results|
puts results.count
end
5000
5000
37
```

thoughts?