diff --git a/README.md b/README.md index 046d5cc..362367c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Also you can get some data on the gem response: * Clouds * Wind speed * Wind angle +* Sunrise Time +* Sunset Time You can get your APP ID from the OpenWeatherMap website. @@ -90,4 +92,3 @@ Contributors: ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). - diff --git a/lib/openweather2/weather.rb b/lib/openweather2/weather.rb index 1da3d57..804068b 100644 --- a/lib/openweather2/weather.rb +++ b/lib/openweather2/weather.rb @@ -1,8 +1,8 @@ module Openweather2 class Weather - attr_reader :city, :longitude, :latitude, :pressure, :humidity, :clouds, - :temperature, :min_temperature, :max_temperature, :wind_speed, :wind_angle + :temperature, :min_temperature, :max_temperature, :wind_speed, + :wind_angle, :sunrise, :sunset def initialize(json) @city = json['name'] @@ -16,6 +16,8 @@ def initialize(json) @clouds = json['clouds']['all'] @wind_speed = json['wind']['speed'] @wind_angle = json['wind']['deg'] + @sunrise = Time.at(json['sys']['sunrise']) + @sunset = Time.at(json['sys']['sunset']) end end -end \ No newline at end of file +end