kovid 0.1.2 → 0.1.3
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 +15 -3
 - data/kovid.gemspec +2 -3
 - data/lib/kovid/cli.rb +7 -2
 - data/lib/kovid/nineteen.rb +4 -0
 - data/lib/kovid/request.rb +13 -0
 - data/lib/kovid/tablelize.rb +42 -28
 - data/lib/kovid/version.rb +1 -1
 - metadata +5 -19
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6bd969471381d80a48eadfa3a7a209e44b640210d46a07abc49f2893aafa6733
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a17fb95681ea89fe2e8e5ad5aec5b5fde2f8d3b52476668a2d7ed909e38f9dbf
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 65017f21ef033e9a23f54119b136d334fecab2e3f2c637a23743fb0033e7d6b0f0c73123ae12e46d6fef5ff0c768b837edaa992ce8666c3a72049ee4b1be57a2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 367189c05cd5049c445f13b1a797afd7e131c09393f91997f047718cd382fd63984be1f4b867d6d923a4fe3c591c83aeb50e4cefc1ac15a51360c58b3caf15a7
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,15 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # 🦠 Kovid
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            Kovid is a  
     | 
| 
      
 3 
     | 
    
         
            +
            Kovid is a small CLI app to fetch data surrounding the coronavirus pandemic of 2019. I found myself checking [Wikipedia](https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic) constantly for information and since I work mostly in the terminal, like most of you, I thought I'd build this to literally put the data right at our fingertips.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            Please feel free to contribute or suggest ideas!
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            ## ⚙️ Installation
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            Before installing:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ☝️ Wash your hands with soap and water for at least 20 seconds.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ✌️ Run `$ gem install kovid`
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            After installing:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ☝️ Avoid touching your eyes, nose, and mouth with unwashed hands later.
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ✌️ Disinfect your phones, keys, door knobs, anything you touch often than you should.
         
     | 
| 
       9 
23 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            You can install it by running:
         
     | 
| 
       11 
24 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                $ gem install kovid
         
     | 
| 
       13 
25 
     | 
    
         | 
| 
       14 
26 
     | 
    
         
             
            ## ⚒️ Usage
         
     | 
| 
       15 
27 
     | 
    
         | 
    
        data/kovid.gemspec
    CHANGED
    
    | 
         @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       6 
6 
     | 
    
         
             
              spec.authors       = ["Emmanuel Hayford"]
         
     | 
| 
       7 
7 
     | 
    
         
             
              spec.email         = ["siawmensah@gmail.com"]
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              spec.summary       = %q{A CLI tool to  
     | 
| 
       10 
     | 
    
         
            -
              spec.description   = %q{A CLI tool to  
     | 
| 
      
 9 
     | 
    
         
            +
              spec.summary       = %q{🦠 A CLI tool to fetch and compare the 2019 coronavirus pandemic numbers.}
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.description   = %q{A CLI tool to fetch and compare the 2019 coronavirus pandemic numbers.}
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.homepage      = "https://github.com/siaw23/kovid"
         
     | 
| 
       12 
12 
     | 
    
         
             
              spec.license       = "MIT"
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
         
     | 
| 
         @@ -29,7 +29,6 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              spec.add_dependency "thor"
         
     | 
| 
       31 
31 
     | 
    
         
             
              spec.add_dependency "terminal-table"
         
     | 
| 
       32 
     | 
    
         
            -
              spec.add_dependency "httparty"
         
     | 
| 
       33 
32 
     | 
    
         
             
              spec.add_dependency "typhoeus"
         
     | 
| 
       34 
33 
     | 
    
         
             
              spec.add_development_dependency "pry"
         
     | 
| 
       35 
34 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kovid/cli.rb
    CHANGED
    
    | 
         @@ -10,14 +10,19 @@ module Kovid 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  Kovid::Nineteen.whatis
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                desc ' 
     | 
| 
      
 13 
     | 
    
         
            +
                desc 'check', 'Returns data on country'
         
     | 
| 
       14 
14 
     | 
    
         
             
                method_option :full, aliases: '-f'
         
     | 
| 
       15 
     | 
    
         
            -
                def  
     | 
| 
      
 15 
     | 
    
         
            +
                def check(name)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  if options[:full]
         
     | 
| 
       17 
17 
     | 
    
         
             
                    Kovid::Nineteen.country_full(name)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  else
         
     | 
| 
       19 
19 
     | 
    
         
             
                    Kovid::Nineteen.country(name)
         
     | 
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                desc 'compare', 'Returns comparison table for given countries'
         
     | 
| 
      
 24 
     | 
    
         
            +
                def compare(*name)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  Kovid::Nineteen.country_comparison(name)
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
       22 
27 
     | 
    
         
             
              end
         
     | 
| 
       23 
28 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kovid/nineteen.rb
    CHANGED
    
    
    
        data/lib/kovid/request.rb
    CHANGED
    
    | 
         @@ -25,6 +25,19 @@ module Kovid 
     | 
|
| 
       25 
25 
     | 
    
         
             
                    response ||= JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    Kovid::Tablelize.full_country_table(response)
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def by_country_comparison(list)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    array = []
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    list.each do |country|
         
     | 
| 
      
 33 
     | 
    
         
            +
                      path = "/countries/#{country}"
         
     | 
| 
      
 34 
     | 
    
         
            +
                      fetch_url = BASE_URL + path
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                      array << JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    Kovid::Tablelize.compare_countries_table(array)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
       28 
41 
     | 
    
         
             
                end
         
     | 
| 
       29 
42 
     | 
    
         
             
              end
         
     | 
| 
       30 
43 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kovid/tablelize.rb
    CHANGED
    
    | 
         @@ -4,36 +4,50 @@ require 'terminal-table' 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            module Kovid
         
     | 
| 
       6 
6 
     | 
    
         
             
              class Tablelize
         
     | 
| 
       7 
     | 
    
         
            -
                 
     | 
| 
       8 
     | 
    
         
            -
                   
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 8 
     | 
    
         
            +
                  def country_table(data)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    headings = %w[Cases Deaths Recovered]
         
     | 
| 
      
 10 
     | 
    
         
            +
                    rows = []
         
     | 
| 
      
 11 
     | 
    
         
            +
                    rows << [data['cases'], data['deaths'], data['recovered']]
         
     | 
| 
      
 12 
     | 
    
         
            +
                    puts Terminal::Table.new(title: data['country'], headings: headings, rows: rows)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def full_country_table(data)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    headings = [
         
     | 
| 
      
 17 
     | 
    
         
            +
                      'Cases',
         
     | 
| 
      
 18 
     | 
    
         
            +
                      'Deaths',
         
     | 
| 
      
 19 
     | 
    
         
            +
                      'Recovered',
         
     | 
| 
      
 20 
     | 
    
         
            +
                      'Cases Today',
         
     | 
| 
      
 21 
     | 
    
         
            +
                      'Deaths Today',
         
     | 
| 
      
 22 
     | 
    
         
            +
                      'Critical',
         
     | 
| 
      
 23 
     | 
    
         
            +
                      'Cases/Million'
         
     | 
| 
      
 24 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    rows = []
         
     | 
| 
      
 27 
     | 
    
         
            +
                    rows << [
         
     | 
| 
      
 28 
     | 
    
         
            +
                      data['cases'],
         
     | 
| 
      
 29 
     | 
    
         
            +
                      data['deaths'],
         
     | 
| 
      
 30 
     | 
    
         
            +
                      data['recovered'],
         
     | 
| 
      
 31 
     | 
    
         
            +
                      data['todayCases'],
         
     | 
| 
      
 32 
     | 
    
         
            +
                      data['todayDeaths'],
         
     | 
| 
      
 33 
     | 
    
         
            +
                      data['critical'],
         
     | 
| 
      
 34 
     | 
    
         
            +
                      data['casesPerOneMillion']
         
     | 
| 
      
 35 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 36 
     | 
    
         
            +
                    puts Terminal::Table.new(title: data['country'],
         
     | 
| 
      
 37 
     | 
    
         
            +
                                             headings: headings,
         
     | 
| 
      
 38 
     | 
    
         
            +
                                             rows: rows)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def compare_countries_table(data)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    headings = %w[Country Cases Deaths Recovered]
         
     | 
| 
      
 43 
     | 
    
         
            +
                    rows = []
         
     | 
| 
       12 
44 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
       16 
     | 
    
         
            -
                    'Deaths',
         
     | 
| 
       17 
     | 
    
         
            -
                    'Recovered',
         
     | 
| 
       18 
     | 
    
         
            -
                    'Cases Today',
         
     | 
| 
       19 
     | 
    
         
            -
                    'Deaths Today',
         
     | 
| 
       20 
     | 
    
         
            -
                    'Critical',
         
     | 
| 
       21 
     | 
    
         
            -
                    'Cases/Million'
         
     | 
| 
       22 
     | 
    
         
            -
                  ]
         
     | 
| 
      
 45 
     | 
    
         
            +
                    data.each do |country|
         
     | 
| 
      
 46 
     | 
    
         
            +
                      rows << [country['country'], country['cases'], country['deaths'], country['recovered']]
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
       23 
48 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                   
     | 
| 
       26 
     | 
    
         
            -
                    data['cases'],
         
     | 
| 
       27 
     | 
    
         
            -
                    data['deaths'],
         
     | 
| 
       28 
     | 
    
         
            -
                    data['recovered'],
         
     | 
| 
       29 
     | 
    
         
            -
                    data['todayCases'],
         
     | 
| 
       30 
     | 
    
         
            -
                    data['todayDeaths'],
         
     | 
| 
       31 
     | 
    
         
            -
                    data['critical'],
         
     | 
| 
       32 
     | 
    
         
            -
                    data['casesPerOneMillion']
         
     | 
| 
       33 
     | 
    
         
            -
                  ]
         
     | 
| 
       34 
     | 
    
         
            -
                  puts Terminal::Table.new(title: data['country'],
         
     | 
| 
       35 
     | 
    
         
            -
                                           headings: headings,
         
     | 
| 
       36 
     | 
    
         
            -
                                           rows: rows)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    puts Terminal::Table.new(headings: headings, rows: rows)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
       37 
51 
     | 
    
         
             
                end
         
     | 
| 
       38 
52 
     | 
    
         
             
              end
         
     | 
| 
       39 
53 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kovid/version.rb
    CHANGED
    
    
    
        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.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.3
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-03-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: thor
         
     | 
| 
         @@ -38,20 +38,6 @@ dependencies: 
     | 
|
| 
       38 
38 
     | 
    
         
             
                - - ">="
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       41 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
     | 
    
         
            -
              name: httparty
         
     | 
| 
       43 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
     | 
    
         
            -
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       46 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       48 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       49 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       50 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
     | 
    
         
            -
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       53 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       55 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
42 
     | 
    
         
             
              name: typhoeus
         
     | 
| 
       57 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -80,8 +66,7 @@ dependencies: 
     | 
|
| 
       80 
66 
     | 
    
         
             
                - - ">="
         
     | 
| 
       81 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
68 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       83 
     | 
    
         
            -
            description: A CLI tool to  
     | 
| 
       84 
     | 
    
         
            -
              2019.
         
     | 
| 
      
 69 
     | 
    
         
            +
            description: A CLI tool to fetch and compare the 2019 coronavirus pandemic numbers.
         
     | 
| 
       85 
70 
     | 
    
         
             
            email:
         
     | 
| 
       86 
71 
     | 
    
         
             
            - siawmensah@gmail.com
         
     | 
| 
       87 
72 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -134,5 +119,6 @@ requirements: [] 
     | 
|
| 
       134 
119 
     | 
    
         
             
            rubygems_version: 3.1.2
         
     | 
| 
       135 
120 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       136 
121 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       137 
     | 
    
         
            -
            summary: A CLI tool to  
     | 
| 
      
 122 
     | 
    
         
            +
            summary: "\U0001F9A0 A CLI tool to fetch and compare the 2019 coronavirus pandemic
         
     | 
| 
      
 123 
     | 
    
         
            +
              numbers."
         
     | 
| 
       138 
124 
     | 
    
         
             
            test_files: []
         
     |