Class: Tenkit::Client
Constant Summary collapse
- DATA_SETS =
{ current_weather: 'currentWeather', forecast_daily: 'forecastDaily', forecast_hourly: 'forecastHourly', trend_comparison: 'trendComparison', weather_alerts: 'weatherAlerts', forecast_next_hour: 'forecastNextHour' }.freeze
Instance Method Summary collapse
- #availability(lat, lon, **options) ⇒ Object
- #weather(lat, lon, **options) ⇒ Object
- #weather_alert(id, **options) ⇒ Object
Instance Method Details
#availability(lat, lon, **options) ⇒ Object
22 23 24 25 |
# File 'lib/tenkit/client.rb', line 22 def availability(lat, lon, **) [:country] ||= 'US' get("/availability/#{lat}/#{lon}?country=#{options[:country]}") end |
#weather(lat, lon, **options) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tenkit/client.rb', line 27 def weather(lat, lon, **) [:data_sets] ||= [:current_weather] [:language] ||= 'en' path_root = "/weather/#{options[:language]}/#{lat}/#{lon}?dataSets=" path = path_root + [:data_sets].map { |ds| DATA_SETS[ds] }.compact.join(',') response = get(path) WeatherResponse.new(response) end |
#weather_alert(id, **options) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/tenkit/client.rb', line 38 def weather_alert(id, **) [:language] ||= 'en' puts 'TODO: implement weather alert endpoint' puts language puts id end |