kovid 0.3.8 → 0.3.9

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: 2d28ee705d66ffdbeb9b0733e67c6fc471fa00f0b691555013f9b42e280bdcb1
4
- data.tar.gz: 656f2569c495450a23214ae87b3f14d4b6a5a046f00db4e7bcb22ff6606ed9f6
3
+ metadata.gz: 3c963533d7157df2e17e5f4fb35f50ff0366e37c5d61f7678bcf8ab51544d218
4
+ data.tar.gz: 8b2eceeffdac618d363316a0447ef676a17dc3e7e5971b01b2749ff487baef57
5
5
  SHA512:
6
- metadata.gz: 36b65aa5753226416df10d4210a775aa3d67e50857e159a3bde59c7cf206f2ac0760b875dc61acb0d3d253c34e1e339278c9979d159dd02cc1df1b5b90c8dcf5
7
- data.tar.gz: 76fadffe921789cea2215aaf76eb94ca80c895f5eff917f41cc26277422f4b4558b81518bcbaf91caebb32dd93be7a1702688e01e7316f8c652d47cd7a3225b1
6
+ metadata.gz: 5f2de3a8b27276df0f21ba75cc645dd60d889e59763919e52be2b31acab88f684b755b69bcd8344d6c46133c1fbfdb387aececb270c067e7cf25112cf89bb0d5
7
+ data.tar.gz: 8c107b6878b0b41fc4460c84e2a9aab8f07cf48a0e25b90946d62aaca92d1cfa68c9430a51d960735577d07f590e7ed52da6a403831536dd2bfa149922501977
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.3.7)
4
+ kovid (0.3.8)
5
5
  rainbow (~> 3.0)
6
6
  terminal-table (~> 1.8)
7
7
  thor (~> 1.0)
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
- ![kovid](https://i.gyazo.com/ab779c3fc838ac279bae5b9d6d10d617.png "Covid data.")
59
+ ![kovid](https://i.gyazo.com/ee88b41c05da3be0295dd3a158e7ba70.png "Covid data.")
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
- ![kovid](https://i.gyazo.com/789fa6795d06f529a9b5f37cb51fb516.png "Covid data.")
65
+ ![kovid](https://i.gyazo.com/7e5afce548d8a01b9bdf3f8bdb529cd1.png "Covid data.")
66
66
 
67
67
  To compare country stats:
68
68
 
69
69
  `kovid compare germany poland`
70
70
 
71
- ![kovid](https://i.gyazo.com/be3bcba3d2943c60618b59ae82a3c586.png "Covid data.")
71
+ ![kovid](https://i.gyazo.com/876b19988da4cd7b375cde3e23376ba7.png "Covid data.")
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
- ![kovid](https://i.gyazo.com/79ad61c33114a0bee0a9e2ab94a3d46e.png "Covid data.")
77
+ ![kovid](https://i.gyazo.com/8b57865ae9b28f5afa895ebc49a2de31.png "Covid data.")
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
- ![kovid](https://i.gyazo.com/d00b1c5bbb6251cbd517f801c856ba66.png "Covid data.")
83
+ ![kovid](https://i.gyazo.com/51509c3986f56bbc25068e0d541d9bdd.png "Covid data.")
84
84
 
85
85
  To fetch EU data run:
86
86
 
87
87
  `kovid eu`
88
88
 
89
- ![kovid](https://i.gyazo.com/51d2adcb8e9feb0a0fbe38ff9cf4c550.png "Covid data.")
89
+ ![kovid](https://i.gyazo.com/0a78afae2a5b9d2beb9f2c61dc1d3ac7.png "Covid data.")
90
90
 
91
91
  You can check historical statistics by running
92
92
 
93
93
  `kovid history italy 7` eg:
94
94
 
95
- ![kovid](https://i.gyazo.com/e4872b5047eeaebbd354847a943de268.png "Covid data.")
95
+ ![kovid](https://i.gyazo.com/bc18fdaf99cacf2c921086f189d542b4.png "Covid data.")
96
96
 
97
97
  To check for total figures:
98
98
 
99
99
  `kovid cases`
100
100
 
101
- ![kovid](https://i.gyazo.com/323f0f10d444e2ee629d05a90488adba.png "Covid data.")
101
+ ![kovid](https://i.gyazo.com/e01f4769a2b9e31ce50cec212e55810c.png "Covid data.")
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
- eu_array = countries_array.select do |hash|
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
- first, *rest = eu_array
24
- eu_data = first.merge(*rest) do |key, left, right|
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
 
@@ -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
- rows << [comma_delimit(eu_data['cases']), check_if_positve(eu_data['todayCases']), comma_delimit(eu_data['deaths']), check_if_positve(eu_data['todayDeaths']), comma_delimit(eu_data['recovered']), comma_delimit(eu_data['active']), comma_delimit(eu_data['critical'])]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.3.8'
4
+ VERSION = '0.3.9'
5
5
  end
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.8
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