Sha256: d53de5ab7fd9ce1f76e881aa54fd60282589cb2ce602f00dbd108d3640bfd8fc

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

# Will It Rain?

"Will It Rain?" uses [forecast_io](https://github.com/darkskyapp/forecast-ruby) 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](http://en.wikipedia.org/wiki/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:

```ruby
gem 'will_it_rain'
```

You will first need to signup on [forecast.io](http://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:

```ruby
require 'forecast_io'
ForecastIO.api_key = your_api_key
```

## Usage

Find out if there is a chance of rain today:
```ruby
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%:
```ruby
WillItRain.at_location?(latitude, longitude, 25)
```

Get likelihood of precipitation along with percentage:
```ruby
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%:
```ruby
WillItRain.get_summaries(latitude, longitude) # returns array of readable summaries
WillItRain.get_summaries(latitude, longitude, 25) # adjust default threshold
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
will_it_rain-0.1.0 README.md