Socket
Book a DemoInstallSign in
Socket

will_it_rain

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

will_it_rain

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Will It Rain?

"Will It Rain?" uses forecast_io to determine whether or not it will rain (precipitate, more specifically) at a particular location today. This gem was created primarily to isolate logic from a larger project. I hope it helps you in your weather-related Ruby application.

How does it work?

Different data points are collected from the current day. For each data point, the probability of precipitation is considered. If any data point exceeds the threshold, it is considered a "rain day."

Setup

Add the following to your Gemfile and install:

gem 'will_it_rain'

You will first need to signup on forecast.io and get an API key. You can set the key as a FORECAST_IO_API_KEY environment variable; alternatively you can set the API key in the following way:

require 'forecast_io'
ForecastIO.api_key = your_api_key

Usage

Find out if there is a chance of rain today:

WillItRain.at_location?(latitude, longitude) # returns boolean

The above checks for rain-chances greater than 10% by default. Here is how you can check if chance of rain today is greater than 25%:

WillItRain.at_location?(latitude, longitude, 25)

Get likelihood of precipitation along with percentage:

WillItRain.with_chances(latitude, longitude) # returns {it_will_rain: boolean, chances: percentage_string}
WillItRain.with_chances(latitude, longitude, 5) # compare with a value other than 10%

Get readable summaries of daily data points where precipitation probability exceeds 10%:

WillItRain.get_summaries(latitude, longitude) # returns array of readable summaries
WillItRain.get_summaries(latitude, longitude, 25) # adjust default threshold

FAQs

Package last updated on 09 May 2015

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.