1
0
mirror of https://github.com/elisspace/FxLifeSheet.git synced 2026-08-29 15:44:00 +00:00

Weather bugfixes

This commit is contained in:
Felix Krause
2021-11-10 23:46:04 +01:00
parent f2c42dc7b1
commit bdd399f216

View File

@@ -63,6 +63,11 @@ module Importers
request["x-rapidapi-key"] = ENV.fetch("RAPID_API_KEY")
response = http.request(request)
parsed_json = JSON.parse(response.read_body)
if parsed_json["locations"].nil?
puts "ran out of weather API quota..."
binding.pry
return
end
add_to_weather_cache(id, parsed_json)
store_weather_in_db(weather: parsed_json, matched_date: matched_date)
end
@@ -85,7 +90,6 @@ module Importers
"Humidity" => "humidity",
"SolarRadiation" => "solarradiation",
"WindSpeed" => "wspd",
"WindSpeed" => "wspd",
"SeaLevelPressure" => "sealevelpressure",
}.each do |key, value|
insert_weather_row(key, weather.fetch(value), matched_date, type: "number")