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, country: 'US') ⇒ Object
- #weather(lat, lon, data_sets: [:current_weather], language: 'en') ⇒ Object
- #weather_alert(id, language: 'en') ⇒ Object
Instance Method Details
#availability(lat, lon, country: 'US') ⇒ Object
22 23 24 |
# File 'lib/tenkit/client.rb', line 22 def availability(lat, lon, country: 'US') get("/availability/#{lat}/#{lon}?country=#{country}") end |
#weather(lat, lon, data_sets: [:current_weather], language: 'en') ⇒ Object
26 27 28 29 30 31 |
# File 'lib/tenkit/client.rb', line 26 def weather(lat, lon, data_sets: [:current_weather], language: 'en') path_root = "/weather/#{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, language: 'en') ⇒ Object
33 34 35 36 37 |
# File 'lib/tenkit/client.rb', line 33 def weather_alert(id, language: 'en') puts 'TODO: implement weather alert endpoint' puts language puts id end |