Covid19
A wrapper for the coronavirus API at https://github.com/ExpDev07/coronavirus-tracker-api.
Installation
Add this line to your application's Gemfile:
gem 'covid19'
And then execute:
bundle install
Or install it yourself as:
gem install covid19
Usage
Get the latest amount of total confirmed cases, deaths, and recoveries globally:
Covid19.latest_stats
Get case data for all locations with reported cases:
Covid19.latest_stats_split_by_country
Find case data by country code with an optional argument to include timelines:
Covid19.latest_stats_by_country_code('GB', true)
Find case data by location:
Covid19.latest_stats_by_country_id(id)
Error Handling
If there are errors trying to talk to the API the class will raise a StandardError
with the appropriate error message.
Command line tool
The gem also comes with a command line tool called covid19.
Usage: covid19
-h, --help Display this screen
-s, --split View the latestest information split by country
-c, --confirmed Order results by confirmed cases
-d, --deaths Order results by deaths
-r, --recovered Order results by recovered numbers
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Testing
For local testing make sure that you run bundle exec rspec spec
and then rake install
to install the gem locally.
For further information please refer to the contributing documentation.