A Ruby gem which pulls and displays the latest VATSIM metar for a particular station (ICAO code).
Ruby 1.9.3 or higher | Supports Ruby 2.0!
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install vatsim_metar
.metar method can be applied to a string (or variable containing a string), representing a valid ICAO code. Like this:
"EGLL".metar # => "EGLL 291750Z 22016KT 9999 SCT023 SCT032 18/13 Q1005" airport = "EGLL" airport.metar # => "EGLL 291750Z 22016KT 9999 SCT023 SCT032 18/13 Q1005"
The input ICAO code is not case sensitive, so the following should work as well:
"kjfk".metar # => "KJFK 291751Z 24016KT 10SM FEW180 SCT250 32/21 A2968 RMK AO2 SLP049 T03170211 10322 20222 58008" airport = "kjfk" airport.metar # => "KJFK 291751Z 24016KT 10SM FEW180 SCT250 32/21 A2968 RMK AO2 SLP049 T03170211 10322 20222 58008"
This library augments the default Ruby
String class with a method named
.metar. It returns a string, containing the latest Vatsim METAR. The data is obtained via
curl from Vatsim's web API, hence the
- added timeout limit
- added connection failure rescue
- check for METAR validity
- dependency update
- added Ruby 2.0 support
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Make sure all tests pass!
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
Copyright © 2013 Svilen Vassilev
If you find my work useful or time-saving, you can endorse it or buy me a cup of coffee:
Released under the MIT LICENSE