kovid 0.3.8 → 0.3.9
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/Gemfile.lock +1 -1
- data/README.md +8 -8
- data/kovid.gemspec +0 -3
- data/lib/kovid/request.rb +3 -3
- data/lib/kovid/tablelize.rb +20 -5
- data/lib/kovid/version.rb +1 -1
- metadata +1 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c963533d7157df2e17e5f4fb35f50ff0366e37c5d61f7678bcf8ab51544d218
|
4
|
+
data.tar.gz: 8b2eceeffdac618d363316a0447ef676a17dc3e7e5971b01b2749ff487baef57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2de3a8b27276df0f21ba75cc645dd60d889e59763919e52be2b31acab88f684b755b69bcd8344d6c46133c1fbfdb387aececb270c067e7cf25112cf89bb0d5
|
7
|
+
data.tar.gz: 8c107b6878b0b41fc4460c84e2a9aab8f07cf48a0e25b90946d62aaca92d1cfa68c9430a51d960735577d07f590e7ed52da6a403831536dd2bfa149922501977
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,49 +56,49 @@ To fetch basic data on a country run:
|
|
56
56
|
|
57
57
|
`kovid check ghana`. If the location contains spaces: `kovid check "Diamond Princess"`
|
58
58
|
|
59
|
-

|
60
60
|
|
61
61
|
For full table info on a country:
|
62
62
|
|
63
63
|
`kovid check italy -f` OR `kovid check italy --full`
|
64
64
|
|
65
|
-

|
66
66
|
|
67
67
|
To compare country stats:
|
68
68
|
|
69
69
|
`kovid compare germany poland`
|
70
70
|
|
71
|
-

|
72
72
|
|
73
73
|
To compare a countries stats with a full table:
|
74
74
|
|
75
75
|
`kovid compare poland italy usa china -f` OR `kovid compare poland italy usa china --full`
|
76
76
|
|
77
|
-

|
78
78
|
|
79
79
|
To fetch state-specific data run:
|
80
80
|
|
81
81
|
`kovid state colorado` OR `kovid state "north carolina"`
|
82
82
|
|
83
|
-

|
84
84
|
|
85
85
|
To fetch EU data run:
|
86
86
|
|
87
87
|
`kovid eu`
|
88
88
|
|
89
|
-

|
90
90
|
|
91
91
|
You can check historical statistics by running
|
92
92
|
|
93
93
|
`kovid history italy 7` eg:
|
94
94
|
|
95
|
-

|
96
96
|
|
97
97
|
To check for total figures:
|
98
98
|
|
99
99
|
`kovid cases`
|
100
100
|
|
101
|
-

|
102
102
|
|
103
103
|
## Information Source
|
104
104
|
> https://www.worldometers.info/coronavirus/ via [NovelCOVID/API](https://github.com/novelcovid/api)
|
data/kovid.gemspec
CHANGED
@@ -23,9 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "typhoeus", "~> 1.3"
|
24
24
|
spec.add_dependency "rainbow", "~> 3.0"
|
25
25
|
|
26
|
-
spec.add_development_dependency "pry"
|
27
|
-
spec.add_development_dependency "cucumber"
|
28
|
-
spec.add_development_dependency "aruba"
|
29
26
|
spec.add_development_dependency "simplecov"
|
30
27
|
|
31
28
|
# Specify which files should be added to the gem when it is released.
|
data/lib/kovid/request.rb
CHANGED
@@ -15,13 +15,13 @@ module Kovid
|
|
15
15
|
def eu_aggregate
|
16
16
|
countries_array = JSON.parse(Typhoeus.get(UriBuilder.new('/countries').url, cache_ttl: 900).response_body)
|
17
17
|
|
18
|
-
|
18
|
+
🇪🇺 = countries_array.select do |hash|
|
19
19
|
EU_ISOS.include?(hash['countryInfo']['iso2']) || hash['country'] == 'Czechia'
|
20
20
|
# Check API later to see if ISO-Alpha-2 code has been added for Czechia
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
eu_data =
|
23
|
+
👤, *👥 = 🇪🇺
|
24
|
+
eu_data = 👤.merge(*👥) do |key, left, right|
|
25
25
|
left + right unless %w[country countryInfo].include?(key)
|
26
26
|
end .compact
|
27
27
|
|
data/lib/kovid/tablelize.rb
CHANGED
@@ -19,6 +19,16 @@ module Kovid
|
|
19
19
|
'Deaths'.paint_red
|
20
20
|
].freeze
|
21
21
|
|
22
|
+
EU_AGGREGATE_HEADINGS = [
|
23
|
+
'Cases'.paint_white,
|
24
|
+
'Cases Today'.paint_white,
|
25
|
+
'Deaths'.paint_red,
|
26
|
+
'Deaths Today'.paint_red,
|
27
|
+
'Recovered'.paint_green,
|
28
|
+
'Active'.paint_yellow,
|
29
|
+
'Critical'.paint_red
|
30
|
+
]
|
31
|
+
|
22
32
|
FOOTER_LINE = ['------------', '------------', '------------'].freeze
|
23
33
|
COUNTRY_LETTERS = 'A'.upto('Z').with_index(127_462).to_h.freeze
|
24
34
|
|
@@ -179,13 +189,18 @@ module Kovid
|
|
179
189
|
end
|
180
190
|
|
181
191
|
def eu_aggregate(eu_data)
|
182
|
-
headings = ['Cases'.paint_white, 'Cases Today'.paint_white, 'Deaths'.paint_red, 'Deaths Today'.paint_red, 'Recovered'.paint_green, 'Active'.paint_yellow, 'Critical'.paint_red]
|
183
|
-
|
184
192
|
rows = []
|
193
|
+
rows << [
|
194
|
+
comma_delimit(eu_data['cases']),
|
195
|
+
check_if_positve(eu_data['todayCases']),
|
196
|
+
comma_delimit(eu_data['deaths']),
|
197
|
+
check_if_positve(eu_data['todayDeaths']),
|
198
|
+
comma_delimit(eu_data['recovered']),
|
199
|
+
comma_delimit(eu_data['active']),
|
200
|
+
comma_delimit(eu_data['critical'])
|
201
|
+
]
|
185
202
|
|
186
|
-
|
187
|
-
|
188
|
-
Terminal::Table.new(title: 'Aggregated EU Data'.upcase, headings: headings, rows: rows)
|
203
|
+
Terminal::Table.new(title: 'Aggregated EU Data'.upcase, headings: EU_AGGREGATE_HEADINGS, rows: rows)
|
189
204
|
end
|
190
205
|
|
191
206
|
private
|
data/lib/kovid/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kovid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Hayford
|
@@ -66,48 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: cucumber
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: aruba
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
70
|
name: simplecov
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|