Class: Covid19::Client

Inherits:
Thor
  • Object
show all
Defined in:
lib/covid19/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/covid19/client.rb', line 7

def self.exit_on_failure?
  true
end

Instance Method Details

#all_continentsObject



13
14
15
16
17
18
19
20
# File 'lib/covid19/client.rb', line 13

def all_continents
  locality  = Covid19::Decorators::Table::LOCALITY[:continent]
  result = Covid19::Services::Covid19Data.all_continents

  puts options[:table] ?
    Covid19::Decorators::Table.create(data: result, locality: locality) :
    result
end

#all_countriesObject



24
25
26
27
28
29
30
31
# File 'lib/covid19/client.rb', line 24

def all_countries
  locality  = Covid19::Decorators::Table::LOCALITY[:country]
  result = Covid19::Services::Covid19Data.all_countries

  puts options[:table] ?
    Covid19::Decorators::Table.create(data: result, locality: locality):
    result
end

#continent(continent_name) ⇒ Object



35
36
37
38
39
# File 'lib/covid19/client.rb', line 35

def continent(continent_name)
  result = Covid19::Services::Covid19Data.continent(continent_name)

  puts options[:table] ? Covid19::Decorators::Table.create(data: result) : result
end

#country(country_name) ⇒ Object



43
44
45
46
47
# File 'lib/covid19/client.rb', line 43

def country(country_name)
  result = Covid19::Services::Covid19Data.country(country_name)

  puts options[:table] ? Covid19::Decorators::Table.create(data: result) : result
end