Class: MeteoCLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/meteo/meteo_cli.rb

Instance Method Summary collapse

Instance Method Details

#quote(location) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/meteo/meteo_cli.rb', line 18

def quote(location)
  location = (location.nil? or location.strip.size == 0) ? Geo.new.quote : location

  units = options[:units] ? options[:units] : "imperial"
  forecast = options[:forecast] ? options[:forecast].to_i : 0

  service = Meteo.new(forecast > 0)

  response = service.quote(location, units)

  reporter = WeatherReporter.new

  reporter.report(response, units, forecast)
end