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

petrel

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

petrel

  • 0.0.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Petrel

A RubyGem wrapp for OpenWeatherMap's Free API

Installation

gem install petrel

or in your Gemfile...

gem 'petrel'

Configuration

You will need to set your OpenWeather api_key before making requests. You can get one here.

Petrel.configure do |c|
  c.api_key = 'YOUR_API_KEY'
end

Alternatively, you can do:

Petrel.api_token = 'YOUR_API_TOKEN'

Usage / Examples

Once configured, you have access to the below methods. They correspond to the available endpoints, listed on OpenWeatherMap's API.

# 5 day / 3 hour forecast data
query = { q: 'San Francisco' }
Petrel.forecat(query)

# One Call
query = { lat: 37, lon: -122 }
Petrel.one_call(query)

# Current weather
query = { lat: 37, lon: -122 }
Petrel.weather(query)

Full documentation on what can be in query can be found in OpenWeatherMap's API documentation here.

FAQs

Package last updated on 07 Oct 2020

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