Class: OpenWeatherMap::CurrentWeather
- Inherits:
-
Object
- Object
- OpenWeatherMap::CurrentWeather
- Defined in:
- lib/openweathermap/current-weather.rb
Overview
Represents the current weather at a location
Instance Attribute Summary collapse
-
#city ⇒ OpenWeatherMap::City
readonly
Requested city’s data.
-
#weather_conditions ⇒ OpenWeatherMap::WeatherConditions
readonly
Conditions at the moment.
Instance Method Summary collapse
-
#initialize(data) ⇒ CurrentWeather
constructor
Create a new CurrentWeather object.
Constructor Details
#initialize(data) ⇒ CurrentWeather
Create a new CurrentWeather object
13 14 15 16 17 |
# File 'lib/openweathermap/current-weather.rb', line 13 def initialize(data) data = JSON.parse(data) @city = OpenWeatherMap::City.new(data['name'], data['coord']['lon'], data['coord']['lat'], data['sys']['country']) @weather_conditions = OpenWeatherMap::WeatherConditions.new(data) end |
Instance Attribute Details
#city ⇒ OpenWeatherMap::City (readonly)
Returns Requested city’s data.
8 9 10 |
# File 'lib/openweathermap/current-weather.rb', line 8 def city @city end |
#weather_conditions ⇒ OpenWeatherMap::WeatherConditions (readonly)
Returns Conditions at the moment.
5 6 7 |
# File 'lib/openweathermap/current-weather.rb', line 5 def weather_conditions @weather_conditions end |