covid 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gempush.yml +21 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -1
- data/lib/covid.rb +20 -1
- data/lib/covid/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baefc8adc79c0a32b90e3dac50e81d9a988609cd9a8c7ba838e6e0a649a9108d
|
4
|
+
data.tar.gz: adcb56b8b51553ef34528d91db4a2905eed5de7d17dc16cfdf5769fc9dff3a7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b665ea1a5cddfd2941ca43b30d2537195d6858f76af7102c263dc17ff4a1e81ac7557f03a8a55170a06c3f83a6015ef30fdbc809e27b2378b63448c6a392876
|
7
|
+
data.tar.gz: 838c595e10b1a4d93dbc826290b124775715b9baeb7fe05e6d929fab8c1f653dfae4bce97568a8c8e17dc2d7abbe2c10ccc17728154ae8e81fee989834f08cf8
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
schedule:
|
7
|
+
- cron: '0 16 * * Sat'
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Smoke Test
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Set up Ruby 2.6
|
15
|
+
uses: actions/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.6.x
|
18
|
+
- name: Install dependencies
|
19
|
+
run: bundle install
|
20
|
+
- name: Run smoke test
|
21
|
+
run: rake
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Covid
|
2
2
|
|
3
|
-
|
3
|
+
Ruby wrapper around [Johns Hopkins dataset](https://github.com/CSSEGISandData/COVID-19) for COVID-19.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -26,6 +26,16 @@ $ Covid::Nineteen.deaths
|
|
26
26
|
$ Covid::Nineteen.recovered
|
27
27
|
```
|
28
28
|
|
29
|
+
Any result can be filtered by country/region and/or state/province like so:
|
30
|
+
```
|
31
|
+
$ confirmed = Covid::Nineteen.confirmed
|
32
|
+
$ confirmed.country("Australia")
|
33
|
+
$ confirmed.region("Australia")
|
34
|
+
$ confirmed.state("Victoria")
|
35
|
+
$ confirmed.province("Victoria")
|
36
|
+
$ confirmed.country("Australia").province("Victoria")
|
37
|
+
```
|
38
|
+
|
29
39
|
The data is structured as such:
|
30
40
|
```
|
31
41
|
$ pp Covid::Nineteen.confirmed
|
data/lib/covid.rb
CHANGED
@@ -7,6 +7,25 @@ require "net/http"
|
|
7
7
|
|
8
8
|
module Covid
|
9
9
|
class Error < StandardError; end
|
10
|
+
class Result < Array
|
11
|
+
def country(name)
|
12
|
+
filter("Country/Region", name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def state(name)
|
16
|
+
filter("Province/State", name)
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method :region, :country
|
20
|
+
alias_method :province, :state
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def filter(key, name)
|
25
|
+
self.class.new(select { |result| result[key] == name })
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
10
29
|
class Nineteen
|
11
30
|
BASE_URI = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/"
|
12
31
|
CONFIRMED = "time_series_covid19_confirmed_global.csv"
|
@@ -18,7 +37,7 @@ module Covid
|
|
18
37
|
end
|
19
38
|
|
20
39
|
def run
|
21
|
-
parsed_json
|
40
|
+
Result.new(parsed_json)
|
22
41
|
end
|
23
42
|
|
24
43
|
def self.confirmed
|
data/lib/covid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Thom
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,13 +52,14 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- jonathan.thom1990@gmail.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/workflows/gempush.yml"
|
62
63
|
- ".gitignore"
|
63
64
|
- ".rspec"
|
64
65
|
- ".travis.yml"
|
@@ -79,7 +80,7 @@ metadata:
|
|
79
80
|
allowed_push_host: https://rubygems.org
|
80
81
|
homepage_uri: https://github.com/jonathanwthom/covid
|
81
82
|
source_code_uri: https://github.com/jonathanwthom/covid
|
82
|
-
post_install_message:
|
83
|
+
post_install_message:
|
83
84
|
rdoc_options: []
|
84
85
|
require_paths:
|
85
86
|
- lib
|
@@ -94,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
95
|
- !ruby/object:Gem::Version
|
95
96
|
version: '0'
|
96
97
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
98
|
+
rubygems_version: 3.1.2
|
99
|
+
signing_key:
|
99
100
|
specification_version: 4
|
100
101
|
summary: JSON wrapper around Johns Hopkins COVID-19 dataset
|
101
102
|
test_files: []
|