Skip to content

Instantly share code, notes, and snippets.

@taiki45
Created September 22, 2012 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taiki45/3765402 to your computer and use it in GitHub Desktop.
Save taiki45/3765402 to your computer and use it in GitHub Desktop.
for blog
## Simple Usage
# creat weather object in differrnt ways
tokyo = WeatherJp.get :tokyo
tokyo = WeatherJp.get "東京都府中市"
minato = WeatherJp::Weather.new("東京都港区")
# get weather info as String
tokyo.today.to_s
#=> can be "東京都 東京の天気は曇りのち晴れ、最高気温34度...etc"
# to get weather info in differrnt ways
minato.get_weather(4) #=> <#DayWeather object>
minato.today.forecast #=> can be "晴れ"
tokyo.get_weather(:tomorrow).rain
minato.day_after_tomorrow.to_s
WeatherJp.get(:tokyo, :today).forecast
# use Weather object
tokyo.each do |w|
puts w.city_name
puts w.day
puts w.forecast
puts w.max_temp
puts w.min_temp
puts w.rain
w.each_pair {|k,v| puts k, v }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment