Module: OWMO
- Defined in:
- lib/owmo.rb,
lib/owmo/version.rb,
lib/owmo/weather.rb,
lib/owmo/weather_response.rb
Overview
rdoc OMWO = OpenWeatherMap.org client for current and forecasted weather conditions.
Defined Under Namespace
Classes: Weather, WeatherResponse
Constant Summary collapse
- URL =
rdoc Openweathermap.org URL
'http://api.openweathermap.org/data/2.5'- VERSION =
rdoc Gem Version
'2.1.5'
Class Method Summary collapse
-
.weather(api_key, **kwargs) ⇒ Object
rdoc Yield a weather object for querying weather data ==== Attributes *
api_key:- OpenWeatherMap.org API key ==== Examples * Single request: api_key = ” OWMO::weather(api_key).get :current, city_name: “London,UK” * Muliple requests: api_key = ” OWMO::weather(api_key) do |weather| puts weather.get :current, city_name: “London,UK” puts weather.get :forecast5, city_name: “London,UK” puts weather.get :forecast16, city_name: “London,UK” end.
Class Method Details
.weather(api_key, **kwargs) ⇒ Object
rdoc Yield a weather object for querying weather data
Attributes
-
api_key:- OpenWeatherMap.org API key
Examples
-
Single request: api_key = ” OWMO::weather(api_key).get :current, city_name: “London,UK”
-
Muliple requests: api_key = ” OWMO::weather(api_key) do |weather|
puts weather.get :current, city_name: "London,UK" puts weather.get :forecast5, city_name: "London,UK" puts weather.get :forecast16, city_name: "London,UK"end
29 30 31 32 33 34 35 36 37 |
# File 'lib/owmo.rb', line 29 def self.weather(api_key, **kwargs) OWMO::Weather.new(api_key, **kwargs) do |weather| if block_given? yield weather else weather end end end |