#!/usr/bin/env ruby $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib)) require 'VIAJERO' origins = ARGV[0] destinations = ARGV[1] mode = ARGV[2] unless origins && destinations && mode puts 'two arguments are need for origin, destination and traffic method' exit(1) end unless ENV['GOOGLE_API'] puts 'you haven\'t set your environment variable yet' exit(1) end traffic_load = Google::TrafficInfo.find(origins: origins, destinations: destinations,mode: mode) distance_data = traffic_load.trafficAnaly puts distance_data