kovid 0.6.10 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 490171e0140b632b2cb19c40e781194aa02fb77cd5b2dd97026d761ab6a1820e
4
- data.tar.gz: e317576c9f36bd7ba3f138e03548e6115d789182c97bcf0b2db7018f482b0663
3
+ metadata.gz: 14f3598372d551bf07a3acd856b1eaa965aa6802794d8e7020fd9a234bb14df9
4
+ data.tar.gz: 5717fd5599aa8b3a6521c2dda5ccbe4e74580df794a0613d30e4bb09071abd9e
5
5
  SHA512:
6
- metadata.gz: 6d51a7f12226e122b242f341b9e3d3ee55b5bd90132f0d78bdae5f0730f67166fb099a878c8e591c9f7d04eafebbb7ecb184394a05cd8baf12ee8b9562962449
7
- data.tar.gz: f0f310b2f6441f6c69662bcf9b6bd3287983b9d07173f60b119b719d0595ab804041415f962fffb4f7c6fff12bd847e7e31ce0a2109f7789695b5c6629533aae
6
+ metadata.gz: 355d8fcc18cc07dd0e080722aa8d45a034b5da18c0ade97d2b052fb7603f4e2463d98447ea3dc985ec5bfb8682b12b88e7e74c0b26d2a55c99bad2f1fbaf04b0
7
+ data.tar.gz: d80ec1720c3b47b6906fe4be773e696a494b2f3877dc851b60ce8b6d8d8a00653b39cda43682082bbee3afd76a2bf08f1028d18d35056332b8d7ed71513939ae
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kovid (0.6.9)
4
+ kovid (0.6.10)
5
5
  carmen (~> 1.1.3)
6
6
  rainbow (~> 3.0)
7
7
  terminal-table (~> 1.8)
@@ -68,11 +68,11 @@ module Kovid
68
68
  Kovid::Request.cases
69
69
  end
70
70
 
71
- def history(country, days=30)
71
+ def history(country, days = 30)
72
72
  Kovid::Request.history(country, days)
73
73
  end
74
74
 
75
- def history_us_state(state, days=30)
75
+ def history_us_state(state, days = 30)
76
76
  Kovid::Request.history_us_state(state, days)
77
77
  end
78
78
 
@@ -78,8 +78,8 @@ module Kovid
78
78
  desc 'history COUNTRY or history COUNTRY N or' \
79
79
  'history STATE --usa',
80
80
  'Return history of incidents of COUNTRY|STATE (in the last N days)'
81
- option :usa, :type => :boolean
82
- def history(location, days=30)
81
+ option :usa, type: :boolean
82
+ def history(location, days = 30)
83
83
  if options[:usa]
84
84
  puts Kovid.history_us_state(location, days)
85
85
  else
@@ -13,7 +13,8 @@ module Kovid
13
13
  'Cases Today'.paint_white,
14
14
  'Deaths'.paint_red,
15
15
  'Deaths Today'.paint_red,
16
- 'Recovered'.paint_green
16
+ 'Recovered'.paint_green,
17
+ 'Tests'.paint_white,
17
18
  ].freeze
18
19
 
19
20
  DATE_CASES_DEATHS_RECOVERED = [
@@ -8,28 +8,28 @@ require_relative 'uri_builder'
8
8
 
9
9
  module Kovid
10
10
  class Request
11
- COUNTRIES_PATH = UriBuilder.new('/v2/countries').url
12
- STATES_URL = UriBuilder.new('/v2/states').url
13
- JHUCSSE_URL = UriBuilder.new('/v2/jhucsse').url
14
- HISTORICAL_URL = UriBuilder.new('/v2/historical').url
15
- HISTORICAL_US_URL = UriBuilder.new('/v2/historical/usacounties').url
16
-
17
- SERVER_DOWN = 'Server overwhelmed. Please try again in a moment.'
18
-
19
- EU_ISOS = %w[AT BE BG CY CZ DE DK EE ES FI FR GR HR HU IE IT LT \
20
- LU LV MT NL PL PT RO SE SI SK].freeze
21
- EUROPE_ISOS = EU_ISOS + %w[GB IS NO CH MC AD SM VA BA RS ME MK AL \
22
- BY UA RU MD].freeze
23
- AFRICA_ISOS = %w[DZ AO BJ BW BF BI CM CV CF TD KM CD CG CI DJ EG \
24
- GQ ER SZ ET GA GM GH GN GW KE LS LR LY MG MW ML \
25
- MR MU MA MZ NA NE NG RW ST SN SC SL SO ZA SS SD \
26
- TZ TG TN UG ZM ZW EH].freeze
27
- SOUTH_AMERICA_ISOS = %w[AR BO BV BR CL CO EC FK GF GY PY PE GS SR \
28
- UY VE].freeze
29
- ASIA_ISOS = %w[AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN \
30
- IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO \
31
- MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW \
32
- UZ VN YE].freeze
11
+ COUNTRIES_PATH = UriBuilder.new('/v2/countries').url
12
+ STATES_URL = UriBuilder.new('/v2/states').url
13
+ JHUCSSE_URL = UriBuilder.new('/v2/jhucsse').url
14
+ HISTORICAL_URL = UriBuilder.new('/v2/historical').url
15
+ HISTORICAL_US_URL = UriBuilder.new('/v2/historical/usacounties').url
16
+
17
+ SERVER_DOWN = 'Server overwhelmed. Please try again in a moment.'
18
+
19
+ EU_ISOS = %w[AT BE BG CY CZ DE DK EE ES FI FR GR HR HU IE IT LT \
20
+ LU LV MT NL PL PT RO SE SI SK].freeze
21
+ EUROPE_ISOS = EU_ISOS + %w[GB IS NO CH MC AD SM VA BA RS ME MK AL \
22
+ BY UA RU MD].freeze
23
+ AFRICA_ISOS = %w[DZ AO BJ BW BF BI CM CV CF TD KM CD CG CI DJ EG \
24
+ GQ ER SZ ET GA GM GH GN GW KE LS LR LY MG MW ML \
25
+ MR MU MA MZ NA NE NG RW ST SN SC SL SO ZA SS SD \
26
+ TZ TG TN UG ZM ZW EH].freeze
27
+ SOUTH_AMERICA_ISOS = %w[AR BO BV BR CL CO EC FK GF GY PY PE GS SR \
28
+ UY VE].freeze
29
+ ASIA_ISOS = %w[AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN \
30
+ IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO \
31
+ MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW \
32
+ UZ VN YE].freeze
33
33
 
34
34
  class << self
35
35
  def eu_aggregate
@@ -172,7 +172,7 @@ module Kovid
172
172
 
173
173
  if response.key?('message')
174
174
  not_found(country) do |c|
175
- "Could not find cases for #{c}.\nIf searching United States, add --usa option"
175
+ "Could not find cases for #{c}.\nIf searching United States, add --usa option"
176
176
  end
177
177
  else
178
178
  Kovid::Tablelize.history(response, days)
@@ -183,7 +183,7 @@ module Kovid
183
183
 
184
184
  def history_us_state(state, days)
185
185
  history_path = UriBuilder.new('/v2/historical/usacounties').url
186
- state = Kovid.lookup_us_state(state).downcase()
186
+ state = Kovid.lookup_us_state(state).downcase
187
187
 
188
188
  response = JSON.parse(
189
189
  Typhoeus.get(
@@ -191,7 +191,7 @@ module Kovid
191
191
  ).response_body
192
192
  )
193
193
 
194
- if response.respond_to?(:key?) and response.key?('message')
194
+ if response.respond_to?(:key?) && response.key?('message')
195
195
  return not_found(state)
196
196
  end
197
197
 
@@ -203,13 +203,13 @@ module Kovid
203
203
 
204
204
  # normalize data so we can call Kovid::Tablelize.history on US State data
205
205
  response = {
206
- "state" => state,
207
- "timeline" => { "cases" => cases, "deaths" => deaths }
206
+ 'state' => state,
207
+ 'timeline' => { 'cases' => cases, 'deaths' => deaths }
208
208
  }
209
209
 
210
210
  Kovid::Tablelize.history(response, days)
211
211
  rescue JSON::ParserError
212
- puts SERVER_DOWN
212
+ puts SERVER_DOWN
213
213
  end
214
214
 
215
215
  def histogram(country, date)
@@ -233,11 +233,11 @@ module Kovid
233
233
  rows = []
234
234
  default_warning = "Wrong spelling/No reported cases on #{location.upcase}."
235
235
 
236
- if block_given?
237
- rows << [ yield(location) ]
238
- else
239
- rows << [ default_warning ]
240
- end
236
+ rows << if block_given?
237
+ [yield(location)]
238
+ else
239
+ [default_warning]
240
+ end
241
241
 
242
242
  Terminal::Table.new title: "You checked: #{location.upcase}", rows: rows
243
243
  end
@@ -328,9 +328,9 @@ module Kovid
328
328
  end.compact
329
329
  end
330
330
 
331
- def usacounties_aggregator(data, key=nil)
332
- data.inject({}) do |base,other|
333
- base.merge(other['timeline'][key]) do |k,l,r|
331
+ def usacounties_aggregator(data, key = nil)
332
+ data.inject({}) do |base, other|
333
+ base.merge(other['timeline'][key]) do |_k, l, r|
334
334
  l ||= 0
335
335
  l ||= 0
336
336
  l + r
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kovid
4
- VERSION = '0.6.10'
4
+ VERSION = '0.6.11'
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.6.10
4
+ version: 0.6.11
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-05-02 00:00:00.000000000 Z
11
+ date: 2020-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carmen