covidapi
Covid API
This is a Crystal wrapper for the COVID19 API.
Currently, it doesn't cover all the options of the API. The two main classes are GlobalHistory and CountryHistory. Values of most other API endpoints can be determined from those two.
Installation
-
Add the dependency to your
shard.yml
:dependencies: covidapi: github: HCLarsen/covidapi
-
Run
shards install
Usage
require "covidapi"
To obtain the history of global spread of the virus, use Covidapi#getGlobalHistory.
global = Covidapi.getGlobalHistory
assert_equal global.results.size #=> 63
assert_equal global.results.last_value.confirmed #=> 418678
Passing in the three letter code for a country to the #getCountryHistory method will return the historical data for that country.
canada = Covidapi.getCountryHistory("CAN")
canada.count #=> 63
canada.results.last_value.confirmed #=> 2790
Contributing
- Fork it (https://github.com/HCLarsen/covidapi/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chris Larsen - creator and maintainer
Repository
covidapi
Owner
Statistic
- 0
- 0
- 0
- 0
- 2
- about 1 year ago
- September 24, 2023
License
MIT License
Links
Synced at
Mon, 18 Nov 2024 06:05:55 GMT
Languages