weather/app/controllers/ruling_weathers_controller.rb

14 lines
625 B
Ruby

class RulingWeathersController < ApplicationController
def widget
@ruling_weather_setting = RulingWeatherSetting.find(OrbitHelper.widget_custom_value)
head_trans = ["uv","relative_humidity","current_wind_speed","accumulated_rainfall"].map{|head| ["#{head}-head",I18n.t("ruling_weather.#{head}")]}.to_h
{
"extras" => {}.merge(head_trans),
"weather" => [@ruling_weather_setting.get_now_info]
}
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