A Ruby wrapper for the dronestre.am API.
This is a work in progress. If you'd like to help, check out the current issues. Alternately, you can report further issues, or work on a new one.
Add this line to your application's Gemfile:
gem 'dronestream'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dronestream
First, require it:
require 'dronestream'
#=> true
Then, you can find strikes by a number of criteria. Version 0.2.3 allows you to chain methods together to combine data points in your query. However, each query returns an instance of the class. To get the data out in a usable format (say, for looping over), simply call to_a
on the return value of your query.
>> Dronestream::Strike.in_country('Yemen')
#=> Dronestream::Strike
>> Dronestream::Strike.in_country('Yemen').to_a
#=> [{"_id"=>"51a65578e0932c0e1eb4199f", "number"=>1, "country"=>"Yemen", "date"=>"2002-11-03T00:00:00.000Z", "town"=>"", "location"=>"Marib Province", "deaths"=>"6", "deaths_min"=>"6", "deaths_max"=>"6", "civilians"=>"0", "injuries"=>""...
>> yemini_strikes_with_civilian_casualties = Dronestream::Strike.in_country('Yemen').with_civilian_casualties
#=> Dronestream::Strike
>> yemini_strikes_with_civilian_casualties.to_a
#=> [{"_id"=>"51a6557ae0932c0e1eb41aad", "number"=>271, "country"=>"Yemen", "date"=>"2011-06-03T00:00:00.000Z", "town"=>"Zinjibar", "location"=>"Abyan Province", "deaths"=>"7", "deaths_min"=>"7", "deaths_max"=>"7", "civilians"=>"4", "injuries"=>""
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Run tests (
rake spec
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Obviously, this gem couldn't be possible without the dronestream API. So thank you to Josh Begley for the API. Thanks also to @ashedryden for turning me onto hasadronekilledanyonetoday.com by Chris Zarate, where I discovered the source.