Method: OpenWeatherClient::Weather#initialize
- Defined in:
- lib/open_weather_client/weather.rb
#initialize(lat:, lon:, time: Time.now) ⇒ Weather
Initialize a new Weather request
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/open_weather_client/weather.rb', line 22 def initialize(lat:, lon:, time: Time.now) if OpenWeatherClient.configuration.spatial_quantization.respond_to?(:call) lat, lon = OpenWeatherClient.configuration.spatial_quantization.call(lat, lon) end raise RangeError unless (-90..90).member?(lat) raise RangeError unless (-180..180).member?(lon) @lat = lat @lon = lon @time = time end |