Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ropenweather

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ropenweather

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ropenweather :gem:

A Ruby Wrapper to the OpenWeatherMap API

This readme is available in pt-br

Installation

This gem is only available for development, so you can clone the repo and build it yourself:

git clone https://github.com/souzagab/ropenweather.git
cd ropenweather
bundle exec rake install

Or reference the repo in your Gemfile:

gem  'ropenweather', git:  'https://github.com/souzagab/ropenweather.git'

And then execute:

bundle install

Usage

This gem uses OpenWeatherMap API and you need to register and get it here.

Instance

To use this gem, you will need to create an instance of the Ropenweather::Client class, the constructor can receive four parameters: api_key, base_uri, lang, units.

paramrequireddefaultaccepted values
api_keyyesapi-key from openweathermap
base_urinohttp://api.openweathermap.org/data/2.5api url
langnoencheck the accepted values here
unitsnometricstandard metric imperial
Example
client = Ropenweather::Client.new(api_key:'y0ur-4pi-k3y',lang:'pt_br')

Today's Current Weather

Returns an hash

client = Ropenweather::Client.new(api_key:'y0ur-4pi-k3y',lang:'pt_br')
client.get_weather(city:'London')
Forecast (5 days )

Returns an hash with an list of forecasts

client = Ropenweather::Client.new(api_key:'y0ur-4pi-k3y',lang:'pt_br')
response = client.get_weather(city:'London', action:'forecast')
response[:list] # Array of forecasts

Development

After cloning, 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.

Contributing

This project is at the beginning of development and has a lot to be improved, contributions are welcome, and here is a list of possible improvements:

  • Wrap the api response in a class
  • Improve error handling
  • Validate method params ( format )

And more..

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 19 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc