class OpenWeatherMap::Base
Public Instance Methods
cond()
click to toggle source
# File lib/open_weather_map/base.rb, line 6 def cond @response['weather'][0]['main'] end
cond_jp()
click to toggle source
# File lib/open_weather_map/base.rb, line 18 def cond_jp jp_cond = '' case @response['weather'][0]['main'] when 'Clear' then jp_cond = '晴れ' when 'Clouds' then jp_cond = '曇り' when 'Snow' then jp_cond = '雪' when 'Rain' then jp_cond = '雨' else jp_cond = 'その他' end return jp_cond end
temp_max()
click to toggle source
# File lib/open_weather_map/base.rb, line 14 def temp_max @response['main']['temp_max'] end
temp_max_celsius()
click to toggle source
# File lib/open_weather_map/base.rb, line 35 def temp_max_celsius to_celsius @response['main']['temp_max'] end
temp_min()
click to toggle source
# File lib/open_weather_map/base.rb, line 10 def temp_min @response['main']['temp_min'] end
temp_min_celsius()
click to toggle source
# File lib/open_weather_map/base.rb, line 31 def temp_min_celsius to_celsius @response['main']['temp_min'] end
Private Instance Methods
request(params)
click to toggle source
# File lib/open_weather_map/base.rb, line 40 def request(params) response = RestClient.get OpenWeatherMap::URL, { params: params } JSON.parse(response) end
to_celsius(temp)
click to toggle source
# File lib/open_weather_map/base.rb, line 45 def to_celsius(temp) (temp.to_f - 273.15).round(1) end