kovid 0.4.7 β†’ 0.4.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb6de6563f95f22115b3e04efc65267d59fa949a5e68dee22063c9a58438ebc0
4
- data.tar.gz: 87e2bf23684c8ca538fd68ae23d77e7daeff2b3fdba7a249442628e671a69675
3
+ metadata.gz: bb4f2a55aae94609d2348161b6228065372705e980e4d3e35209a5e1d259371f
4
+ data.tar.gz: 45d8b57b5270fd21831cdb6153914a32a4c8d1dfbca65b922ca84b4443286ee9
5
5
  SHA512:
6
- metadata.gz: ff8f7e1afca67e4218d7d4491d86a34bc54cdcd49993aa515aaa0186d53a73f882ab2e6eabfcda0747ac0a0e5baefe95773982e6b786aeedb77f70f7ec696183
7
- data.tar.gz: fcb797d8367ddf05ef080f3272522fd2b52761fab6a1e3b02ba8367230ff9eeb05b7f0bcbe03887a3cb6d6fdc6c10f7d7f94343a5baa329f2ea9a2956cf335fa
6
+ metadata.gz: 75aa05406a1e3aa47a2f50dd92828c60f559a029e23d6dd155993d8a58c229b0bb90639378b7f5551410cfe9835c6e2bf4f0ea69dc039ab8b69b78f34272a5e1
7
+ data.tar.gz: a3aef9a944a811784c2c1b9503d3f958f76e130ce9698020ed74bcaad9383bcaee76a57fadf0671c4a0fc71a28bd5e6be1f3a14bd9547857159da5b9c48f8627
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.4.6)
4
+ kovid (0.4.7)
5
5
  ascii_charts (~> 0.9.1)
6
6
  rainbow (~> 3.0)
7
7
  terminal-table (~> 1.8)
data/README.md CHANGED
@@ -29,35 +29,20 @@ You can run `kovid --help` to see the full list of available commands.
29
29
  * `kovid check COUNTRY` OR `kovid country COUNTRY`.
30
30
  * `kovid check COUNTRY -f` OR `kovid check COUNTRY --full`.
31
31
 
32
- 🦁🦁🦁
32
+ You can get continental information with the following commands:
33
33
 
34
- You can fetch aggregated data on Africa (55 states):
35
34
  * `kovid africa`.
36
-
37
- 🏰🏰🏰
38
-
39
- You can fetch aggregated Europe (all 44 countries combined) data:
40
35
  * `kovid europe`.
41
-
42
- πŸ‡ͺπŸ‡ΊπŸ‡ͺπŸ‡ΊπŸ‡ͺπŸ‡Ί
43
-
44
- You can fetch aggregated EU (all 27 countries combined) data:
45
- * `kovid eu`.
46
-
47
- 🌎🌎🌎
48
-
49
- You can fetch aggregated South America (all 15 countries combined) data:
50
- * `kovid sa`.
36
+ * `kovid eu`. (The European Union)
37
+ * `kovid sa`. (South America)
38
+ * `kovid asia`.
39
+ * `kovid world`. (Worldwide Statistics)
51
40
 
52
41
  πŸ‡ΊπŸ‡ΈπŸ‡ΊπŸ‡ΈπŸ‡ΊπŸ‡Έ
53
42
 
54
43
  You can fetch US state-specific data:
55
44
  * `kovid state STATE` OR `kovid state "STATE NAME"`.
56
45
 
57
- ##### πŸ”œ Upcoming Fetch Features πŸ‘·β€β™€οΈ
58
-
59
- * `kovid asia` Aggrated stats on Asia
60
-
61
46
  ___
62
47
  😷 **Comparing**
63
48
  * `kovid compare FOO BAR` (sorts by cases DESC).
@@ -74,8 +59,6 @@ ___
74
59
  * `kovid history COUNTRY` (full history).
75
60
  * `kovid history COUNTRY N` (history in the last N days).
76
61
  ___
77
- 😷 **Total figures**
78
- * `kovid world` (summary of reported incidents globally).
79
62
 
80
63
  **NOTE:** If you find it irritating to have to type `kovid state STATE`, `covid state STATE` works as well.
81
64
 
@@ -13,6 +13,7 @@ module Kovid
13
13
  def eu_aggregate
14
14
  Kovid::Request.eu_aggregate
15
15
  end
16
+
16
17
  def europe_aggregate
17
18
  Kovid::Request.europe_aggregate
18
19
  end
@@ -25,6 +26,10 @@ module Kovid
25
26
  Kovid::Request.south_america_aggregate
26
27
  end
27
28
 
29
+ def asia_aggregate
30
+ Kovid::Request.asia_aggregate
31
+ end
32
+
28
33
  def country(name)
29
34
  Kovid::Request.by_country(name)
30
35
  end
@@ -77,6 +77,12 @@ module Kovid
77
77
  data_source
78
78
  end
79
79
 
80
+ desc 'asia', 'Returns aggregated data on Asia.'
81
+ def asia
82
+ puts Kovid.asia_aggregate
83
+ data_source
84
+ end
85
+
80
86
  desc 'version', 'Returns version of kovid'
81
87
  def version
82
88
  puts Kovid::VERSION
@@ -12,7 +12,8 @@ module Kovid
12
12
  EU_ISOS = %w[AT BE BG CY CZ DE DK EE ES FI FR GR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK].freeze
13
13
  EUROPE_ISOS = EU_ISOS + %w[GB IS NO CH MC AD SM VA BA RS ME MK AL BY UA RU MD]
14
14
  AFRICA_ISOS = %w[DZ AO BJ BW BF BI CM CV CF TD KM CD CG CI DJ EG GQ ER SZ ET GA GM GH GN GW KE LS LR LY MG MW ML MR MU MA MZ NA NE NG RW ST SN SC SL SO ZA SS SD TZ TG TN UG ZM ZW EH].freeze
15
- SOUTH_AMERICA_ISOS = ["AR" "BO", "BV", "BR", "CL", "CO", "EC", "FK", "GF", "GY", "PY", "PE", "GS", "SR", "UY", "VE"]
15
+ SOUTH_AMERICA_ISOS = ['AR' 'BO', 'BV', 'BR', 'CL', 'CO', 'EC', 'FK', 'GF', 'GY', 'PY', 'PE', 'GS', 'SR', 'UY', 'VE'].freeze
16
+ ASIA_ISOS = %w[AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE].freeze
16
17
 
17
18
  SERVER_DOWN = 'Server overwhelmed. Please try again in a moment.'
18
19
 
@@ -49,6 +50,14 @@ module Kovid
49
50
  aggregator(SOUTH_AMERICA_ISOS, south_america_proc)
50
51
  end
51
52
 
53
+ def asia_aggregate
54
+ asia_proc = proc do |data|
55
+ Kovid::Tablelize.asia_aggregate(data)
56
+ end
57
+
58
+ aggregator(ASIA_ISOS, asia_proc)
59
+ end
60
+
52
61
  def by_country(country_name)
53
62
  response = fetch_country(country_name)
54
63
 
@@ -275,7 +275,7 @@ module Kovid
275
275
  end
276
276
 
277
277
  def europe_aggregate(europe_data)
278
- aggregated_table(europe_data, 'Europe', Kovid::Request::EUROPE_ISOS, "🏰")
278
+ aggregated_table(europe_data, 'Europe', Kovid::Request::EUROPE_ISOS, '🏰')
279
279
  end
280
280
 
281
281
  def africa_aggregate(africa_data)
@@ -283,7 +283,13 @@ module Kovid
283
283
  end
284
284
 
285
285
  def south_america_aggregate(south_america_data)
286
- aggregated_table(south_america_data, 'South America', Kovid::Request::SOUTH_AMERICA_ISOS, "🌎")
286
+ aggregated_table(south_america_data,
287
+ 'South America',
288
+ Kovid::Request::SOUTH_AMERICA_ISOS, '🌎')
289
+ end
290
+
291
+ def asia_aggregate(asia_data)
292
+ aggregated_table(asia_data, 'Asia', Kovid::Request::ASIA_ISOS, '🌏')
287
293
  end
288
294
 
289
295
  private
@@ -300,7 +306,8 @@ module Kovid
300
306
  end
301
307
 
302
308
  def country_emoji(iso)
303
- COUNTRY_LETTERS.values_at(*iso.chars).pack('U*') + 8203.chr(Encoding::UTF_8)
309
+ COUNTRY_LETTERS.values_at(*iso.chars).pack('U*') + \
310
+ 8203.chr(Encoding::UTF_8)
304
311
  end
305
312
 
306
313
  def transpose(load)
@@ -316,9 +323,11 @@ module Kovid
316
323
 
317
324
  def aggregated_table(collated_data, continent, iso, emoji)
318
325
  title = if emoji.codepoints.size > 1
319
- emoji + 8203.chr(Encoding::UTF_8) + " Aggregated Data on #{continent} (#{iso.size} States)".upcase
326
+ emoji + 8203.chr(Encoding::UTF_8) + \
327
+ " Aggregated Data on #{continent} (#{iso.size} States)".upcase
320
328
  else
321
- emoji + " Aggregated Data on #{continent} (#{iso.size} States)".upcase
329
+ emoji + \
330
+ " Aggregated Data on #{continent} (#{iso.size} States)".upcase
322
331
  end
323
332
 
324
333
  rows = []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.4.7'
4
+ VERSION = '0.4.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kovid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Hayford
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-28 00:00:00.000000000 Z
11
+ date: 2020-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor