Project

tropical

0.0
The project is in a healthy, maintained state
Consultation weather forecast up to 5 days.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Project Readme

Tropical

Ruby Gem

Gem to search weather forecast for 5 days:

Installation

Add this line to your application's Gemfile:

gem 'tropical', '~> 0.1.9'

And then execute:

$ bundle install

Usage

Ruby API

tropical = Tropical::OpenWeatherMap.new(
  {
    appid: 'your_api_key', # required
    q:     'São Paulo',    # required
    lang:  'pt_br',        # optional
    units: 'metric',       # optional
    cnt:   '50'            # optional
  }
)

For more information about the params: openweathermap

Note: The mode param is not avaible.

  • City name
tropical.city_name

# => "São Paulo"
  • Population
tropical.population

# => 10021295
  • Country
tropical.country

# => "BR"
  • Timezone
tropical.timezone

# => -3
  • Current date
tropical.current_date

# => 2021-02-14 18:00:00 -0300
  • Coord
tropical.coord

# => {:lat=>-23.5475, :lon=>-46.6361}
  • Scale
tropical.scale

# => "°C"
  • Current temperature
tropical.current_temp

# => 26.92
  • Current weather
tropical.current_weather

# => "chuva moderada"
  • Full sumary
tropical.full_sumary

# => "27°C e chuva moderada em São Paulo em 14/02. Média para os próximos dias: 26°C em 14/02, 26°C em 15/02, 26°C em 16/02, 26°C em 17/02, 25°C em 18/02 e 24°C em 19/02."
  • Sumary current day
tropical.sumary_current_day

# => "27°C e chuva moderada em São Paulo em 14/02."
  • Sumary days forecast
tropical.sumary_days_forecast

# => "26°C em 14/02, 26°C em 15/02, 26°C em 16/02, 26°C em 17/02, 25°C em 18/02 e 24°C em 19/02." 

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/valterandrei/tropical. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Code of Conduct

Everyone interacting in the Tropical project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.