Class: Covid19::Client
- Inherits:
-
Thor
- Object
- Thor
- Covid19::Client
- Defined in:
- lib/covid19/client.rb
Class Method Summary collapse
Instance Method Summary collapse
- #all_continents ⇒ Object
- #all_countries ⇒ Object
- #continent(continent_name) ⇒ Object
- #country(country_name) ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
8 9 10 |
# File 'lib/covid19/client.rb', line 8 def self.exit_on_failure? true end |
Instance Method Details
#all_continents ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/covid19/client.rb', line 16 def all_continents locality = Covid19::Decorators::Table::LOCALITY[:continent] result = Covid19::Services::Covid19Data.all_continents puts result if .empty? render_table(data: result, locality: locality) if [:table] render_chart(data: result, type: Covid19::Decorators::Chart::TYPES[:all_continent_general_data], colored: [:colored]) if [:chart] end |
#all_countries ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/covid19/client.rb', line 29 def all_countries locality = Covid19::Decorators::Table::LOCALITY[:country] result = Covid19::Services::Covid19Data.all_countries puts result if .empty? render_table(data: result, locality: locality) if [:table] end |
#continent(continent_name) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/covid19/client.rb', line 41 def continent(continent_name) result = Covid19::Services::Covid19Data.continent(continent_name) puts result if .empty? render_table(data: result) if [:table] if [:chart] render_chart(data: result, type: Covid19::Decorators::Chart::TYPES[:continent_general_data], colored: [:colored]) render_chart(data: result, type: Covid19::Decorators::Chart::TYPES[:continent_diary_data], colored: [:colored]) end end |
#country(country_name) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/covid19/client.rb', line 62 def country(country_name) result = Covid19::Services::Covid19Data.country(country_name) puts result if .empty? render_table(data: result) if [:table] if [:chart] render_chart(data: result, type: Covid19::Decorators::Chart::TYPES[:country_general_data], colored: [:colored]) render_chart(data: result, type: Covid19::Decorators::Chart::TYPES[:country_diary_data], colored: [:colored]) end end |