kovid 0.4.6 β†’ 0.4.7

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: 851facd4cdf0be330b04c5e0f81c91d8a5c5fdaea314751540d224e108c4464d
4
- data.tar.gz: b36ce66c70a12df6930ca30d78ccf7628b06d6a4c70563e6382a8db584d96e6a
3
+ metadata.gz: cb6de6563f95f22115b3e04efc65267d59fa949a5e68dee22063c9a58438ebc0
4
+ data.tar.gz: 87e2bf23684c8ca538fd68ae23d77e7daeff2b3fdba7a249442628e671a69675
5
5
  SHA512:
6
- metadata.gz: 7ef46bb27fef43b9e032dfc81cb05389b22cd199a46f5d0c354794f892552aefb9bc765cc0fde64145e75961086622e29a06de057cc6acb66c192b46c9438890
7
- data.tar.gz: f0e2aad02999132f9505586886545116c915d98b90701b6a8f98410b0c27ca64c8990cfe841c75c2096c5023cc11bd0922eafa0ac0258f5e7de3f8e0dd31ede1
6
+ metadata.gz: ff8f7e1afca67e4218d7d4491d86a34bc54cdcd49993aa515aaa0186d53a73f882ab2e6eabfcda0747ac0a0e5baefe95773982e6b786aeedb77f70f7ec696183
7
+ data.tar.gz: fcb797d8367ddf05ef080f3272522fd2b52761fab6a1e3b02ba8367230ff9eeb05b7f0bcbe03887a3cb6d6fdc6c10f7d7f94343a5baa329f2ea9a2956cf335fa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.4.5)
4
+ kovid (0.4.6)
5
5
  ascii_charts (~> 0.9.1)
6
6
  rainbow (~> 3.0)
7
7
  terminal-table (~> 1.8)
data/README.md CHANGED
@@ -31,7 +31,7 @@ You can run `kovid --help` to see the full list of available commands.
31
31
 
32
32
  🦁🦁🦁
33
33
 
34
- You can fetch aggregated data on Africa:
34
+ You can fetch aggregated data on Africa (55 states):
35
35
  * `kovid africa`.
36
36
 
37
37
  🏰🏰🏰
@@ -44,6 +44,11 @@ You can fetch aggregated Europe (all 44 countries combined) data:
44
44
  You can fetch aggregated EU (all 27 countries combined) data:
45
45
  * `kovid eu`.
46
46
 
47
+ 🌎🌎🌎
48
+
49
+ You can fetch aggregated South America (all 15 countries combined) data:
50
+ * `kovid sa`.
51
+
47
52
  πŸ‡ΊπŸ‡ΈπŸ‡ΊπŸ‡ΈπŸ‡ΊπŸ‡Έ
48
53
 
49
54
  You can fetch US state-specific data:
@@ -52,7 +57,7 @@ You can fetch US state-specific data:
52
57
  ##### πŸ”œ Upcoming Fetch Features πŸ‘·β€β™€οΈ
53
58
 
54
59
  * `kovid asia` Aggrated stats on Asia
55
- * `kovid south_america` Aggrated stats on South America
60
+
56
61
  ___
57
62
  😷 **Comparing**
58
63
  * `kovid compare FOO BAR` (sorts by cases DESC).
@@ -21,6 +21,10 @@ module Kovid
21
21
  Kovid::Request.africa_aggregate
22
22
  end
23
23
 
24
+ def south_america_aggregate
25
+ Kovid::Request.south_america_aggregate
26
+ end
27
+
24
28
  def country(name)
25
29
  Kovid::Request.by_country(name)
26
30
  end
@@ -71,6 +71,12 @@ module Kovid
71
71
  data_source
72
72
  end
73
73
 
74
+ desc 'sa', 'Returns aggregated data on South America.'
75
+ def sa
76
+ puts Kovid.south_america_aggregate
77
+ data_source
78
+ end
79
+
74
80
  desc 'version', 'Returns version of kovid'
75
81
  def version
76
82
  puts Kovid::VERSION
@@ -12,6 +12,7 @@ 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
16
 
16
17
  SERVER_DOWN = 'Server overwhelmed. Please try again in a moment.'
17
18
 
@@ -40,6 +41,14 @@ module Kovid
40
41
  aggregator(AFRICA_ISOS, africa_proc)
41
42
  end
42
43
 
44
+ def south_america_aggregate
45
+ south_america_proc = proc do |data|
46
+ Kovid::Tablelize.south_america_aggregate(data)
47
+ end
48
+
49
+ aggregator(SOUTH_AMERICA_ISOS, south_america_proc)
50
+ end
51
+
43
52
  def by_country(country_name)
44
53
  response = fetch_country(country_name)
45
54
 
@@ -174,8 +183,7 @@ module Kovid
174
183
  left + right unless %w[country countryInfo].include?(key)
175
184
  end.compact
176
185
 
177
- # Kovid::Tablelize.eu_aggregate(data)
178
- meth.call(data)
186
+ meth === data
179
187
  rescue JSON::ParserError
180
188
  puts SERVER_DOWN
181
189
  end
@@ -282,6 +282,10 @@ module Kovid
282
282
  aggregated_table(africa_data, 'Africa', Kovid::Request::AFRICA_ISOS, '🌍')
283
283
  end
284
284
 
285
+ def south_america_aggregate(south_america_data)
286
+ aggregated_table(south_america_data, 'South America', Kovid::Request::SOUTH_AMERICA_ISOS, "🌎")
287
+ end
288
+
285
289
  private
286
290
 
287
291
  def comma_delimit(number)
@@ -312,9 +316,9 @@ module Kovid
312
316
 
313
317
  def aggregated_table(collated_data, continent, iso, emoji)
314
318
  title = if emoji.codepoints.size > 1
315
- emoji + 8203.chr(Encoding::UTF_8) + " Aggregated Data of #{continent} (#{iso.size} States)".upcase
319
+ emoji + 8203.chr(Encoding::UTF_8) + " Aggregated Data on #{continent} (#{iso.size} States)".upcase
316
320
  else
317
- emoji + " Aggregated Data of #{continent} (#{iso.size} States)".upcase
321
+ emoji + " Aggregated Data on #{continent} (#{iso.size} States)".upcase
318
322
  end
319
323
 
320
324
  rows = []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.4.6'
4
+ VERSION = '0.4.7'
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.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Hayford