covid 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42e5bb77ffa1422f903aba1bcacdfc13c840c55d64e9556eb436d017d5c4c155
4
- data.tar.gz: b7cf65678daf795e5f745ef0432afaf1387c85568d5887b7740c5be1cc13916a
3
+ metadata.gz: baefc8adc79c0a32b90e3dac50e81d9a988609cd9a8c7ba838e6e0a649a9108d
4
+ data.tar.gz: adcb56b8b51553ef34528d91db4a2905eed5de7d17dc16cfdf5769fc9dff3a7a
5
5
  SHA512:
6
- metadata.gz: 3c7748580b7713b8f1e96f9c600f67bfc376e8ebca12f0cd72bcb556407432ebc23c0870bef69febe93600e37ae89003ccb68908209b6ed080edc4b4f3690650
7
- data.tar.gz: 5fa5c3a6518b8ef2922ebdc40ee296668e69addd34498405dae0a7d7d108270524d4e7371aabba47eac7f25e07ccf7ba3632374ef643dca2cb301a51989a02b5
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- covid (0.1.3)
4
+ covid (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Covid
2
2
 
3
- JSON wrapper around [Johns Hopkins dataset](https://github.com/CSSEGISandData/COVID-19) for COVID-19.
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Covid
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.3
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-05-02 00:00:00.000000000 Z
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.0.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: []