Module: OpenWeather::Endpoints::OneCall

Included in:
Client
Defined in:
lib/open_weather/endpoints/one_call.rb

Instance Method Summary collapse

Instance Method Details

#one_call(lat, lon = nil, options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/open_weather/endpoints/one_call.rb', line 6

def one_call(lat, lon = nil, options = {})
  options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon)
  options[:exclude] = options[:exclude].join(',') if options[:exclude].is_a?(Array)
  options[:dt] = options[:dt].to_i if options[:dt].is_a?(Time)
  path = options.key?(:dt) ? '2.5/onecall/timemachine' : '2.5/onecall'
  OpenWeather::Models::OneCall::Weather.new(get(path, options), options)
end