weather/app/controllers/ruling_weathers_controller.rb

14 lines
625 B
Ruby
Raw Normal View History

2021-07-27 08:31:45 +00:00
class RulingWeathersController < ApplicationController
def widget
@ruling_weather_setting = RulingWeatherSetting.find(OrbitHelper.widget_custom_value)
2021-07-27 09:12:37 +00:00
head_trans = ["uv","relative_humidity","current_wind_speed","accumulated_rainfall"].map{|head| ["#{head}-head",I18n.t("ruling_weather.#{head}")]}.to_h
2021-07-27 08:31:45 +00:00
{
2021-07-27 09:12:37 +00:00
"extras" => {}.merge(head_trans),
"weather" => [@ruling_weather_setting.get_now_info]
}
2021-07-27 08:31:45 +00:00
end
def get_weather_info
@ruling_weather_setting = RulingWeatherSetting.find(params[:id])
render :json => @ruling_weather_setting.get_now_info(params[:location],params[:dataid],params[:observatory_name])
end
end