<commit_before># EnvironmentCanada

An unofficial gem for retrieving weather conditions and forecasts for Canadian cities from Environment Canada. Not endorsed or affiliated with Environment Canada in any way.

## Installation

Add this line to your application's Gemfile:

    gem 'environment_canada'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install environment_canada

## Usage

### Finding a City

A list of City objects can be retrieved using the `City.find` method.

	EnvironmentCanada::City.find("Calgary")

This will return an array of `City` objects, or none if no match was found. The list of cities is bundled with the gem and includes their city codes for weather conditions and forecast lookup.

### Manually Creating a City Object

Alternatively, create a City object by passing in the city code and name:

	city = EnvironmentCanada::City.new("AB-52", "Calgary")

Case sensitivity does not matter, as the gem will automatically convert the case when connecting to the Environment Canada weather site.

### Retrieving Raw Feed XML

With a `City` object, a string with the latest XML feed can be retrieved:

	xml = city.get_feed

You can then process the XML as you see fit.

### Current Weather Conditions

To retrieve the current weather conditions, use the `City#conditions#` method. This will download the current conditions from Environment Canada and return a Hash with the following keys:

* aqhi (Air Quality Health Index)
* conditions
* dewpoint
* humidity
* pressure
* pressure_tendency
* temperature
* visibility
* wind

This data is not cached, and repeated calls will make new HTTP connections.

### Weather Forecast

TODO

## Contributing

1. Fork it<commit_msg>Fix minor typos in README<commit_after># EnvironmentCanada

An unofficial gem for retrieving weather conditions and forecasts for Canadian cities from Environment Canada. Not endorsed or affiliated with Environment Canada in any way.

## Installation

Add this line to your application's Gemfile:

    gem 'environment_canada'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install environment_canada

## Usage

### Finding a City

A list of `City` objects can be retrieved using the `City.find` method.

	EnvironmentCanada::City.find("Calgary")

This will return an array of `City` objects, or none if no match was found. The list of cities is bundled with the gem and includes their city codes for weather conditions and forecast lookup.

### Manually Creating a City Object

Alternatively, create a `City` object by passing in the city code and name:

	city = EnvironmentCanada::City.new("AB-52", "Calgary")

Case sensitivity does not matter, as the gem will automatically convert the case when connecting to the Environment Canada weather site.

### Retrieving Raw Feed XML

With a `City` object, a string with the latest XML feed can be retrieved:

	xml = city.get_feed

You can then process the XML as you see fit.

### Current Weather Conditions

To retrieve the current weather conditions, use the `City.conditions` method. This will download the current conditions from Environment Canada and return a Hash with the following keys:

* aqhi (Air Quality Health Index)
* conditions
* dewpoint
* humidity
* pressure
* pressure_tendency
* temperature
* visibility
* wind

This data is not cached, and repeated calls will make new HTTP connections.

### Weather Forecast

TODO

## Contributing

1. Fork it
{'fraction_non_alphanumeric': 0.055893426006371275, 'fraction_numerical': 0.0017376194613379669, 'mean_word_length': 4.430817610062893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3536447', 'n_tokens_mistral': 918, 'n_tokens_neox': 853, 'n_words': 475}