Module: MeteoPl::Exec::Shell

Defined in:
lib/meteo_pl/exec/shell.rb

Class Method Summary collapse

Class Method Details

.callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/meteo_pl/exec/shell.rb', line 4

def call
  command_line = MeteoPl::Utility::Command.new(ARGV)
  return unless command_line.call

  location =  command_line.location,
  timeout = command_line.options[:timeout]
  period = command_line.options[:period]

  http_fetcher = Net::Http.new(timeout)
  graph = Utility::MobileMeteoGraph.new(
    http_fetcher, location, period
  )

  unless graph.uri
    puts 'Graph for given location does not exists'
    return
  end

  Utility::Presenter.new(
    http_fetcher, IO::FileHandler.new, IO::ImageOpener.new, graph
  ).show
end