kovid 0.4.10 → 0.4.11
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 +1 -0
- data/lib/kovid/request.rb +21 -7
- data/lib/kovid/tablelize.rb +1 -1
- data/lib/kovid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d27663428f061e75f69ae9d3110bae2a421550683a98757b7500b2813cb8f65
|
4
|
+
data.tar.gz: 27c9ce9b8697d468edf40cb869ecba3a85768559626bcdad685707938a0e00a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d11f328ec94cce0e3a13cad8668bb3a6a71a19140d4f8a1ea87d981922195370a4bd8e52562ae3a67cb16903a8f46ef70afbf218bf2a7d20180a348e0580d7
|
7
|
+
data.tar.gz: 29f3629879ea3aed120c91ae16eb1366f853ef604398f17fd05e59fb4521dcd0d77aeae5f28db4d09e96b9418be93f7a0d3aa20d7bfcd391d1788565e13f81f1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -65,6 +65,7 @@ ___
|
|
65
65
|
#### Histogram (Experimental) 🧪
|
66
66
|
|
67
67
|
`kovid histogram COUNTRY M.YY` (draws a histogram of cases in the given month `M` and years `YY`)
|
68
|
+
(If the histogram appears messy, you might want to resize your window.)
|
68
69
|
|
69
70
|
#### Commands Details
|
70
71
|
To fetch basic data on a country run:
|
data/lib/kovid/request.rb
CHANGED
@@ -84,8 +84,11 @@ module Kovid
|
|
84
84
|
|
85
85
|
def state(state)
|
86
86
|
response = fetch_state(state)
|
87
|
-
|
88
|
-
|
87
|
+
if response.nil?
|
88
|
+
not_found(state)
|
89
|
+
else
|
90
|
+
Kovid::Tablelize.full_state_table(response)
|
91
|
+
end
|
89
92
|
rescue JSON::ParserError
|
90
93
|
puts SERVER_DOWN
|
91
94
|
end
|
@@ -184,12 +187,23 @@ module Kovid
|
|
184
187
|
isos.include?(hash['countryInfo']['iso2'])
|
185
188
|
end
|
186
189
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
190
|
+
# You can't do this for Ruby veresion < 2.6.0
|
191
|
+
# #merge behaviour was changed in Ruby 2.6.0
|
192
|
+
# head, *tail = country_array
|
193
|
+
# data = head.merge(*tail) do |key, left, right|
|
194
|
+
# left ||= 0
|
195
|
+
# right ||= 0
|
196
|
+
|
197
|
+
# left + right unless %w[country countryInfo].include?(key)
|
198
|
+
# end.compact
|
199
|
+
|
200
|
+
data = country_array.inject do |base, other|
|
201
|
+
base.merge(other) do |key, left, right|
|
202
|
+
left ||= 0
|
203
|
+
right ||= 0
|
191
204
|
|
192
|
-
|
205
|
+
left + right unless %w[country countryInfo].include?(key)
|
206
|
+
end
|
193
207
|
end.compact
|
194
208
|
|
195
209
|
meth === data
|
data/lib/kovid/tablelize.rb
CHANGED
data/lib/kovid/version.rb
CHANGED