kovid 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +60 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/kovid +4 -0
- data/kovid.gemspec +34 -0
- data/lib/kovid.rb +8 -0
- data/lib/kovid/cli.rb +34 -0
- data/lib/kovid/nineteen.rb +29 -0
- data/lib/kovid/request.rb +57 -0
- data/lib/kovid/tablelize.rb +64 -0
- data/lib/kovid/version.rb +5 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eda967d6a2af12ffe6c318f4deceda6a69d3d200cafd5bca9a681a675beb2cf8
|
4
|
+
data.tar.gz: ad0ade25d0e1d3e26b91821b02a480f973d92e70ac205d460660b4e38e52955a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b894aa6499ca25617128ff8ac6acf330d45831657722bb1ba2d98cf89a18a6d62c79e8e67b3ae922fdee53306f5075474c6da78ce0314835f928be681ee3b4e8
|
7
|
+
data.tar.gz: ea6c116dabb8d9a7252e3791f73eeb0d402e8d094d58bdb246b50904e4dc2483a629049d17e615250fd628dbea809af84df527b030e538b1b43df1377b31ec05
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at siawmensah@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kovid (0.1.2)
|
5
|
+
httparty
|
6
|
+
terminal-table
|
7
|
+
thor
|
8
|
+
typhoeus
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
coderay (1.1.2)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
ethon (0.12.0)
|
16
|
+
ffi (>= 1.3.0)
|
17
|
+
ffi (1.12.2)
|
18
|
+
httparty (0.18.0)
|
19
|
+
mime-types (~> 3.0)
|
20
|
+
multi_xml (>= 0.5.2)
|
21
|
+
method_source (0.9.2)
|
22
|
+
mime-types (3.3.1)
|
23
|
+
mime-types-data (~> 3.2015)
|
24
|
+
mime-types-data (3.2019.1009)
|
25
|
+
multi_xml (0.6.0)
|
26
|
+
pry (0.12.2)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
rake (12.3.3)
|
30
|
+
rspec (3.9.0)
|
31
|
+
rspec-core (~> 3.9.0)
|
32
|
+
rspec-expectations (~> 3.9.0)
|
33
|
+
rspec-mocks (~> 3.9.0)
|
34
|
+
rspec-core (3.9.1)
|
35
|
+
rspec-support (~> 3.9.1)
|
36
|
+
rspec-expectations (3.9.1)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.9.0)
|
39
|
+
rspec-mocks (3.9.1)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.9.0)
|
42
|
+
rspec-support (3.9.2)
|
43
|
+
terminal-table (1.8.0)
|
44
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
45
|
+
thor (1.0.1)
|
46
|
+
typhoeus (1.3.1)
|
47
|
+
ethon (>= 0.9.0)
|
48
|
+
unicode-display_width (1.7.0)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
kovid!
|
55
|
+
pry
|
56
|
+
rake (~> 12.0)
|
57
|
+
rspec (~> 3.0)
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
2.1.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Emmanuel Hayford
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# 🦠 Kovid
|
2
|
+
|
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
|
+
|
6
|
+
|
7
|
+
Please feel free to contribute or suggest ideas!
|
8
|
+
|
9
|
+
## ⚙️ Installation
|
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.
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
## ⚒️ Usage
|
27
|
+
|
28
|
+
To fetch basic data on a country run:
|
29
|
+
|
30
|
+
`kovid check ghana`
|
31
|
+
|
32
|
+
![kovid](https://i.gyazo.com/ca57d9250c7523a921d0d7e1104716be.png "Covid data.")
|
33
|
+
|
34
|
+
For a full table info on a country:
|
35
|
+
|
36
|
+
`kovid check ghana -f` OR `kovid check ghana --full`
|
37
|
+
|
38
|
+
![kovid](https://i.gyazo.com/628f07faf8e3c1c2a0b6ab05e4a86404.png "Covid data.")
|
39
|
+
|
40
|
+
To compare country stats:
|
41
|
+
|
42
|
+
`kovid compare ghana poland`
|
43
|
+
|
44
|
+
![kovid](https://i.gyazo.com/a15922e13e9e6c1ba804ccf5beeb863b.png "Covid data.")
|
45
|
+
|
46
|
+
To compare a countries stats with a full table:
|
47
|
+
|
48
|
+
`kovid compare ghana poland -f`
|
49
|
+
|
50
|
+
![kovid](https://i.gyazo.com/d0b72207765090b118a5b76d72ddde19.png "Covid data.")
|
51
|
+
|
52
|
+
## 👨💻 Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
55
|
+
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
57
|
+
|
58
|
+
## 🤲 Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/siaw23/kovid. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/siaw23/kovid/blob/master/CODE_OF_CONDUCT.md).
|
61
|
+
|
62
|
+
|
63
|
+
## 🔖 License
|
64
|
+
|
65
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
66
|
+
|
67
|
+
## ❤️ Code of Conduct
|
68
|
+
|
69
|
+
Everyone interacting in the Kovid project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/siaw23/kovid/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kovid"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/kovid
ADDED
data/kovid.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'lib/kovid/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "kovid"
|
5
|
+
spec.version = Kovid::VERSION
|
6
|
+
spec.authors = ["Emmanuel Hayford"]
|
7
|
+
spec.email = ["siawmensah@gmail.com"]
|
8
|
+
|
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
|
+
spec.homepage = "https://github.com/siaw23/kovid"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/siaw23/kovid"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/siaw23/kovid"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency "thor"
|
31
|
+
spec.add_dependency "terminal-table"
|
32
|
+
spec.add_dependency "typhoeus"
|
33
|
+
spec.add_development_dependency "pry"
|
34
|
+
end
|
data/lib/kovid.rb
ADDED
data/lib/kovid/cli.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'kovid'
|
5
|
+
|
6
|
+
module Kovid
|
7
|
+
class CLI < Thor
|
8
|
+
desc 'whatis', 'Defines COVID-19'
|
9
|
+
def whatis
|
10
|
+
Kovid::Nineteen.whatis
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'check', 'Returns data on country'
|
14
|
+
method_option :full, aliases: '-f'
|
15
|
+
def check(name)
|
16
|
+
if options[:full]
|
17
|
+
Kovid::Nineteen.country_full(name)
|
18
|
+
else
|
19
|
+
Kovid::Nineteen.country(name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'compare', 'Returns full comparison table for given countries'
|
24
|
+
def compare(*name)
|
25
|
+
if name[-1] == "-f" || name[-1] == "--full"
|
26
|
+
name = name.reverse.drop(1).reverse
|
27
|
+
|
28
|
+
Kovid::Nineteen.country_comparison_full(name)
|
29
|
+
else
|
30
|
+
Kovid::Nineteen.country_comparison(name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'request'
|
4
|
+
|
5
|
+
module Kovid
|
6
|
+
class Nineteen
|
7
|
+
class << self
|
8
|
+
def whatis
|
9
|
+
puts 'Coronavirus disease (COVID-19) is an infectious disease caused by a new virus.'
|
10
|
+
end
|
11
|
+
|
12
|
+
def country(name)
|
13
|
+
puts Kovid::Request.by_country(name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def country_full(name)
|
17
|
+
puts Kovid::Request.by_country_full(name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def country_comparison(name)
|
21
|
+
puts Kovid::Request.by_country_comparison(name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def country_comparison_full(name)
|
25
|
+
puts Kovid::Request.by_country_comparison_full(name)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'typhoeus'
|
4
|
+
require 'json'
|
5
|
+
require_relative 'tablelize'
|
6
|
+
|
7
|
+
module Kovid
|
8
|
+
class Request
|
9
|
+
BASE_URL = 'https://corona.lmao.ninja'
|
10
|
+
|
11
|
+
class << self
|
12
|
+
require 'pry'
|
13
|
+
def by_country(name)
|
14
|
+
path = "/countries/#{name}"
|
15
|
+
fetch_url = BASE_URL + path
|
16
|
+
|
17
|
+
response ||= JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
|
18
|
+
Kovid::Tablelize.country_table(response)
|
19
|
+
end
|
20
|
+
|
21
|
+
def by_country_full(name)
|
22
|
+
path = "/countries/#{name}"
|
23
|
+
fetch_url = BASE_URL + path
|
24
|
+
|
25
|
+
response ||= JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
|
26
|
+
Kovid::Tablelize.full_country_table(response)
|
27
|
+
end
|
28
|
+
|
29
|
+
def by_country_comparison(list)
|
30
|
+
array = []
|
31
|
+
|
32
|
+
|
33
|
+
list.each do |country|
|
34
|
+
path = "/countries/#{country}"
|
35
|
+
fetch_url = BASE_URL + path
|
36
|
+
|
37
|
+
array << JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
|
38
|
+
end
|
39
|
+
|
40
|
+
Kovid::Tablelize.compare_countries_table(array)
|
41
|
+
end
|
42
|
+
|
43
|
+
def by_country_comparison_full(list)
|
44
|
+
array = []
|
45
|
+
|
46
|
+
list.each do |country|
|
47
|
+
path = "/countries/#{country}"
|
48
|
+
fetch_url = BASE_URL + path
|
49
|
+
|
50
|
+
array << JSON.parse(Typhoeus.get(fetch_url.to_s, cache_ttl: 3600).response_body)
|
51
|
+
end
|
52
|
+
|
53
|
+
Kovid::Tablelize.compare_countries_table_full(array)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'terminal-table'
|
4
|
+
|
5
|
+
module Kovid
|
6
|
+
class Tablelize
|
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 = []
|
44
|
+
|
45
|
+
data.each do |country|
|
46
|
+
rows << [country['country'], country['cases'], country['deaths'], country['recovered']]
|
47
|
+
end
|
48
|
+
|
49
|
+
puts Terminal::Table.new(headings: headings, rows: rows)
|
50
|
+
end
|
51
|
+
|
52
|
+
def compare_countries_table_full(data)
|
53
|
+
headings = ['Country', 'Cases', 'Deaths', 'Recovered', 'Cases Today', 'Deaths Today', 'Critical', 'Cases/Million']
|
54
|
+
rows = []
|
55
|
+
|
56
|
+
data.each do |country|
|
57
|
+
rows << [country['country'], country['cases'], country['deaths'], country['recovered'], country['todayCases'], country['todayDeaths'], country['critical'], country['casesPerOneMillion']]
|
58
|
+
end
|
59
|
+
|
60
|
+
puts Terminal::Table.new(headings: headings, rows: rows)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kovid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emmanuel Hayford
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: terminal-table
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: typhoeus
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A CLI tool to fetch and compare the 2019 coronavirus pandemic numbers.
|
70
|
+
email:
|
71
|
+
- siawmensah@gmail.com
|
72
|
+
executables:
|
73
|
+
- kovid
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/console
|
87
|
+
- bin/setup
|
88
|
+
- exe/kovid
|
89
|
+
- kovid.gemspec
|
90
|
+
- lib/kovid.rb
|
91
|
+
- lib/kovid/cli.rb
|
92
|
+
- lib/kovid/nineteen.rb
|
93
|
+
- lib/kovid/request.rb
|
94
|
+
- lib/kovid/tablelize.rb
|
95
|
+
- lib/kovid/version.rb
|
96
|
+
homepage: https://github.com/siaw23/kovid
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata:
|
100
|
+
allowed_push_host: https://rubygems.org/
|
101
|
+
homepage_uri: https://github.com/siaw23/kovid
|
102
|
+
source_code_uri: https://github.com/siaw23/kovid
|
103
|
+
changelog_uri: https://github.com/siaw23/kovid
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.3.0
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubygems_version: 3.1.2
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: "\U0001F9A0 A CLI tool to fetch and compare the 2019 coronavirus pandemic
|
123
|
+
numbers."
|
124
|
+
test_files: []
|