A Ruby interface to the Openweather API.
Add this line to your application's Gemfile:
gem 'OpenWeatherMap', git: 'https://github.com/tiagoleal/OpenWeatherMap-sdk.git'
And then execute:
$ bundle install
https://github.com/tiagoleal/OpenWeatherMap-sdk/tree/master/examples
After create a token
OpenweatherMap Api, you can do the following things.
OpenWeatherMap (show the current forecast)
#id: Your token OpenWeatherMap API (https://openweathermap.org/api)
#city: desired city (optional parameter)
#default city='Santa Cruz do Sul'
client = OpenWeatherMap::Auth.new(id,'Santa Cruz do Sul')
client.current_forecast
OpenWeatherMap (show the next five days forecast)
#id: Your token OpenWeatherMap API (https://openweathermap.org/api)
#city: desired city (optional parameter)
#default city='Santa Cruz do Sul'
client = OpenWeatherMap::Auth.new(id,'Santa Cruz do Sul')
client.next_five_forecast
OpenWeatherMap (show the current and next five days forecast)
#id: Your token OpenWeatherMap API (https://openweathermap.org/api)
#city: desired city (optional parameter)
#default city='Santa Cruz do Sul'
client = OpenWeatherMap::Auth.new(id)
client.complete_forecast
OpenweatherMap-sdk uses Rspec as test framework.
- Running all tests:
rspec spec
- Running tests for an specific file:
rspec spec/OpenWeatherMap_spec.rb
This library aims to support and is the following Ruby versions:
- Ruby 2.6
- Ruby 2.7
Bug reports and pull requests are welcome on GitHub at https://github.com/tiagoleal/OpenWeatherMap-sdk.
The gem is available as open source under the terms of the MIT License.