vatsim_online_redux 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +120 -0
- data/CONTRIBUTING.md +8 -0
- data/Gemfile +4 -0
- data/LICENSE +23 -0
- data/README.md +478 -0
- data/Rakefile +7 -0
- data/lib/vatsim_online/callsign_parser.rb +54 -0
- data/lib/vatsim_online/data_downloader.rb +134 -0
- data/lib/vatsim_online/station.rb +92 -0
- data/lib/vatsim_online/station_parser.rb +77 -0
- data/lib/vatsim_online/version.rb +3 -0
- data/lib/vatsim_online.rb +24 -0
- data/spec/callsign_parser_spec.rb +29 -0
- data/spec/callsign_parser_spec_helper.rb +10 -0
- data/spec/data_downloader_spec.rb +105 -0
- data/spec/data_downloader_spec_helper.rb +8 -0
- data/spec/spec_helper.rb +104 -0
- data/spec/station_parser_spec.rb +161 -0
- data/spec/station_parser_spec_helper.rb +10 -0
- data/spec/vatsim_data.txt +515 -0
- data/spec/vatsim_online_spec.rb +157 -0
- data/spec/vatsim_online_spec_helper.rb +10 -0
- data/vatsim_online_redux.gemspec +25 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 07e8ebbfd89689a7ce2ca212b97a16b245a31fc2fe096d4ea21c43837ae09aca
|
4
|
+
data.tar.gz: faad629bba96ca658d66458c92b81ca2c5159e2db10f4cd97adcdc2aff7d8c6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b56cff667609da28c95b453d165f726a4f651019b56c548fb06347299bb9f5091d30f8c1be74c3f0fbc5a20b5ab9f4c177fd1d344754e0d9966f34a468cd7d5e
|
7
|
+
data.tar.gz: 7f7bb3c6f2d83e538c3d4ca5087af24abd955f507fa9edb5a1932ce3c896449aef759bce97ae6cc160af0808b96c25bc57686a2fbc130493e6cd18f78037b935
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# vatsim_online
|
2
|
+
|
3
|
+
## Changelog
|
4
|
+
|
5
|
+
### v. 0.9.1 - 31 Dec 2016
|
6
|
+
|
7
|
+
* Maintenance release, updated dependencies
|
8
|
+
|
9
|
+
### v. 0.9 - 20 June 2015
|
10
|
+
|
11
|
+
* Fixed nil String bug, can select "ALL" (thanks to Pierre Ferran and Florian Rimoli)
|
12
|
+
|
13
|
+
### v. 0.8.3 - 10 April 2014
|
14
|
+
|
15
|
+
* Fix stale data bug, change data fallback logic
|
16
|
+
|
17
|
+
### v. 0.8.2 - 5 October 2013
|
18
|
+
|
19
|
+
* Handle undetermined position when drawing gcmap
|
20
|
+
|
21
|
+
### v. 0.8.1 - 5 October 2013
|
22
|
+
|
23
|
+
* Ignore prefile data
|
24
|
+
|
25
|
+
### v. 0.8 - 5 October 2013
|
26
|
+
|
27
|
+
* search by callsign implemented
|
28
|
+
|
29
|
+
### v. 0.7.4 - 2 August 2013
|
30
|
+
|
31
|
+
* fallback scenarios for offline data servers
|
32
|
+
|
33
|
+
### v. 0.7.2 - 15 July 2013
|
34
|
+
|
35
|
+
* added gemspec license declaration
|
36
|
+
|
37
|
+
### v. 0.7.1 - 15 July 2013
|
38
|
+
|
39
|
+
* more comprehensive ATC ratings list
|
40
|
+
* dependencies updated
|
41
|
+
|
42
|
+
### v. 0.7.0 - 26 February 2013
|
43
|
+
|
44
|
+
* added Ruby 2.0 support
|
45
|
+
|
46
|
+
### v. 0.6.2 - 4 January 2013
|
47
|
+
|
48
|
+
* updated gem dependencies
|
49
|
+
* refactored `Station` class for simplicity
|
50
|
+
|
51
|
+
### v. 0.6.1 - 08 October 2012
|
52
|
+
|
53
|
+
* Fixed pilot station duplication issue when using multiple ICAOs
|
54
|
+
|
55
|
+
### v. 0.6.0 - 08 October 2012
|
56
|
+
|
57
|
+
* The `vatsim_online` method now also supports a comma-separated list of full or
|
58
|
+
partial ICAO codes like this: `"LO,LB".vatsim_online`. This allows you to pull the
|
59
|
+
information for multiple airports or FIRs in a single request
|
60
|
+
* The comma-seprated list is not sensitive to whitespace, meaning you can use
|
61
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
62
|
+
the same result
|
63
|
+
|
64
|
+
### v. 0.5.3 - 30 September 2012
|
65
|
+
|
66
|
+
* fixed bug with exceptions on missing ATC remark
|
67
|
+
|
68
|
+
### v. 0.5.2 - 29 September 2012
|
69
|
+
|
70
|
+
* fixed permissions bug on UNIX systems
|
71
|
+
|
72
|
+
### v. 0.5.1 - 23 September 2012
|
73
|
+
|
74
|
+
* bugfixes
|
75
|
+
|
76
|
+
### v. 0.5 - 23 September 2012
|
77
|
+
|
78
|
+
* New option `:exclude => "ICAO"` allowing further request customization by
|
79
|
+
excluding a matching subset of ATC stations from the listing. Read the documentation
|
80
|
+
for detailed explanation and examples
|
81
|
+
* New customized station attribute: `online_since`. Returns the station login time
|
82
|
+
parsed as a Ruby Time object in UTC (zulu time). As opposed to the `logon` attribute
|
83
|
+
which returns an unformatted, unparsed string such as `20120722091954`
|
84
|
+
* The `rating` station attribute is now humanized not to return just an integer,
|
85
|
+
but a readable version of the VATSIM rating, i.e. S1, S2, S3, C1, C3, I1, I3, etc...
|
86
|
+
* Added the possibility of customizing the great circle maps by optionally passing
|
87
|
+
parameters for width and height: `icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)`.
|
88
|
+
Read the documentation for detailed explanation and examples
|
89
|
+
* New customized station attribute `atis_message`. It will return a humanized web safe
|
90
|
+
version of the ATC atis without the voice server info and with lines split with
|
91
|
+
`<br />` tags. As opposed to the original `atis` attribute, which returns raw atis,
|
92
|
+
as reported from VATSIM, including voice server as first line
|
93
|
+
|
94
|
+
### v. 0.4 - 27 August 2012
|
95
|
+
|
96
|
+
* GCMapper integration: this library now plays nicely with [gcmapper](https://rubygems.org/gems/gcmapper).
|
97
|
+
A new attribute is provided for the pilot stations: `.gcmap` which returns a great
|
98
|
+
circle map image url, depicting the GC route of the aircraft, its origin and destination,
|
99
|
+
its current position on the route, together with its current altitude and groundspeed.
|
100
|
+
Look at the example in the README section above.
|
101
|
+
* New station attributes: planned_altitude, transponder, heading, qnh_in, qnh_mb,
|
102
|
+
flight_type, cid, latitude_humanized, longitude_humanized
|
103
|
+
|
104
|
+
|
105
|
+
### v. 0.3 - 22 July 2012
|
106
|
+
|
107
|
+
* The hash returned by the `vatsim_online` method now includes 2 new arrays:
|
108
|
+
`arrivals` and `departures`. These two are returned separately for convenience,
|
109
|
+
in case you want to loop through them separately. The `pilots` array return is
|
110
|
+
unchanged and contains all arrivals and departures.
|
111
|
+
* New station attributes: latitude, longitude
|
112
|
+
* Improved UTF-8 conversion process
|
113
|
+
|
114
|
+
### v. 0.2 - 21 July 2012
|
115
|
+
|
116
|
+
* Station attribute `departure` is now renamed to `origin`
|
117
|
+
* UTF-8 is now enforced for all local caching and file/string manipulations, the
|
118
|
+
original Vatsim data is re-encoded
|
119
|
+
* Station ATIS is now cleaned of invalid and obscure characters
|
120
|
+
* Improved documentation
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Contributing to vatsim_online
|
2
|
+
|
3
|
+
1. Fork it
|
4
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
5
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
6
|
+
4. Make sure all tests are passing!
|
7
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
8
|
+
6. Create new Pull Request
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013 Svilen Vassilev
|
2
|
+
Copyright (c) 2020 Alex Dent
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,478 @@
|
|
1
|
+
# Vatsim Online Redux
|
2
|
+
|
3
|
+
Original credit for this gem goes to https://github.com/tarakanbg/vatsim_online
|
4
|
+
|
5
|
+
I've updated it to make it work with update to date Ruby and with Windows.
|
6
|
+
If at any time the original dev comes back, Ill merge this Gem back into theirs.
|
7
|
+
|
8
|
+
A Ruby gem for selectively pulling, parsing and displaying Vatsim online
|
9
|
+
stations data. Essentially it's a "Who's online" library, capable of displaying
|
10
|
+
online ATC and/or pilots for given airports, areas or globally and to filter by callsign. Stations are
|
11
|
+
returned as objects, exposing a rich set of attributes. Vatsim data is pulled
|
12
|
+
on preset intervals and cached locally to avoid flooding the servers.
|
13
|
+
|
14
|
+
[![Build Status](https://secure.travis-ci.org/tarakanbg/vatsim_online.png?branch=master)](http://travis-ci.org/tarakanbg/vatsim_online)
|
15
|
+
[![Gemnasium](https://gemnasium.com/tarakanbg/vatsim_online.png?travis)](https://gemnasium.com/tarakanbg/vatsim_online)
|
16
|
+
[![Gem Version](https://badge.fury.io/rb/vatsim_online.png)](http://badge.fury.io/rb/vatsim_online)
|
17
|
+
[![Code Climate](https://codeclimate.com/github/tarakanbg/vatsim_online.png)](https://codeclimate.com/github/tarakanbg/vatsim_online)
|
18
|
+
|
19
|
+
## Requirements
|
20
|
+
|
21
|
+
[Ruby 2.6.0](http://www.ruby-lang.org/en/downloads/) or higher
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
gem 'vatsim_online_redux'
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle
|
32
|
+
|
33
|
+
Or install it yourself as:
|
34
|
+
|
35
|
+
$ gem install vatsim_online_redux
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
This gem provides two public methods:
|
40
|
+
|
41
|
+
* `vatsim_online`, which can be applied to
|
42
|
+
any string (or variable containing a string) representing a full or partial ICAO
|
43
|
+
code or a comma-separated list of ICAO codes. The provided ICAO code or fragment
|
44
|
+
will be used as a search criteria and matched against the current vatsim data.
|
45
|
+
|
46
|
+
* `vatsim_callsign`, which can be applied to
|
47
|
+
any string (or variable containing a string) representing a full or partial pilot or ATC
|
48
|
+
callsign or a comma-separated list of callsigns. The provided callsign or fragment
|
49
|
+
will be used as a search criteria and matched against the current vatsim data.
|
50
|
+
|
51
|
+
### Filter by ICAO code examples
|
52
|
+
|
53
|
+
For example if you want to retrieve all active stations (ATC positions and pilots)
|
54
|
+
for Vienna airport (ICAO: LOWW), then you can use:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
# Attaching the method directly to a string:
|
58
|
+
"LOWW".vatsim_online
|
59
|
+
|
60
|
+
# Attaching the method directly to a list of ICAOs:
|
61
|
+
"LOWW, LOWK".vatsim_online
|
62
|
+
|
63
|
+
# Attaching the method to a variable containing a string:
|
64
|
+
icao = "LOWW"
|
65
|
+
icao.vatsim_online
|
66
|
+
```
|
67
|
+
If you want to retrieve the currently active stations for an entire region
|
68
|
+
(FIR/ARTCC), then you can use the first 2-3 letters of the region's ICAO name.
|
69
|
+
For example if you want to pull all the stations active in Austria (ICAO code
|
70
|
+
for the FIR is LOVV), you can use `"LO"` as your ICAO search string: all Austrian
|
71
|
+
airports and ATC station callsigns start with `"LO"`:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
# Attaching the method directly to a string:
|
75
|
+
"LO".vatsim_online
|
76
|
+
|
77
|
+
# Attaching the method to a variable containing a string:
|
78
|
+
icao = "LO"
|
79
|
+
icao.vatsim_online
|
80
|
+
|
81
|
+
# Attaching the method to a list of ICAOs:
|
82
|
+
icao = "LO, LB"
|
83
|
+
icao.vatsim_online
|
84
|
+
```
|
85
|
+
|
86
|
+
When parsing the pilot stations for particular airport or area, the library will
|
87
|
+
return the pilots that are flying **to or from** the given area or airport,
|
88
|
+
not the current enroute stations. The discovery algorithm is based on **origin
|
89
|
+
and destination**.
|
90
|
+
|
91
|
+
### Filter by callsign examples
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
# Attaching the method directly to a string:
|
95
|
+
"BAW".vatsim_callsign # => returns an array of all Speedbird flights as station objects
|
96
|
+
|
97
|
+
# Attaching the method to a variable containing a string:
|
98
|
+
callsign = "BAW"
|
99
|
+
callsign.vatsim_callsign # => returns an array of all Speedbird flights as station objects
|
100
|
+
|
101
|
+
# Attaching the method to a list of callsigns:
|
102
|
+
callsign = "BAW, RYR"
|
103
|
+
callsign.vatsim_callsign # => returns an array of all Speedbird and Ryanair flights as station objects
|
104
|
+
```
|
105
|
+
|
106
|
+
|
107
|
+
### Anatomy of method returns
|
108
|
+
|
109
|
+
The `vatsim_online` method returns a **hash** of 4 elements: 1) the matching *atc*
|
110
|
+
stations, 2) all matching *pilots* stations, 3) matching *arrivals*, 4) matching
|
111
|
+
*departures*. Each of those is an **array**, cosnsisting of
|
112
|
+
station **objects**. Each of these objects includes a number of **attributes**:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
icao.vatsim_online # => {:atc => [a1, a2, a3 ...], :pilots => [p1, p2, p3, p4 ...],
|
116
|
+
# :departures => [p1, p4 ...], :arrivals => [p2, p3...]}
|
117
|
+
|
118
|
+
icao.vatsim_online[:atc] #=> [a1, a2, a3 ...]
|
119
|
+
icao.vatsim_online[:pilots] #=> [p1, p2, p3 ...]
|
120
|
+
icao.vatsim_online[:departures] #=> [p1, p3 ...]
|
121
|
+
icao.vatsim_online[:arrivals] #=> [p2, p4 ...]
|
122
|
+
|
123
|
+
|
124
|
+
icao.vatsim_online[:atc].first #=> a1
|
125
|
+
icao.vatsim_online[:pilots].first #=> p1
|
126
|
+
|
127
|
+
a1.callsign #=> "LQSA_TWR"
|
128
|
+
a1.frequency #=> "118.25"
|
129
|
+
a1.name #=> "Svilen Vassilev"
|
130
|
+
a1.rating #=> "S2"
|
131
|
+
a1.online_since #=> "2012-09-22 10:00:48 UTC"
|
132
|
+
...
|
133
|
+
|
134
|
+
p1.callsign #=> "ACH217S"
|
135
|
+
p1.departure #=> "LQSA"
|
136
|
+
p1.destination #=> "LDSP"
|
137
|
+
p1.remarks #=> "/V/ RMK/CHARTS"
|
138
|
+
...
|
139
|
+
```
|
140
|
+
|
141
|
+
`Arrivals` and `departures` are returned separately for convenience, in case you
|
142
|
+
want to loop through them separately. The `pilots` array contains all arrivals
|
143
|
+
and departures.
|
144
|
+
|
145
|
+
The `vatsim_callsign` method returns an **array** of all matching stations.
|
146
|
+
|
147
|
+
### Station attributes
|
148
|
+
|
149
|
+
Here's a complete list of the station object attributes that can be accessed:
|
150
|
+
|
151
|
+
* `cid` (VATSIM ID)
|
152
|
+
* `callsign`
|
153
|
+
* `name`
|
154
|
+
* `role`
|
155
|
+
* `frequency`
|
156
|
+
* `altitude`
|
157
|
+
* `planned_altitude` (or FL)
|
158
|
+
* `heading`
|
159
|
+
* `groundspeed`
|
160
|
+
* `transponder`
|
161
|
+
* `aircraft`
|
162
|
+
* `origin`
|
163
|
+
* `destination`
|
164
|
+
* `route`
|
165
|
+
* `rating` (returns a humanized version of the VATSIM rating: S1, S2, S3, C1, etc...)
|
166
|
+
* `facility`
|
167
|
+
* `remarks`
|
168
|
+
* `atis` (raw atis, as reported from VATSIM, including voice server as first line)
|
169
|
+
* `atis_message` (a humanized version of the ATC atis w/o server and with lines split)
|
170
|
+
* `logon` (login time as unparsed text string: `20120722091954`)
|
171
|
+
* `online_since` (returns the station login time parsed as a Ruby Time object in UTC)
|
172
|
+
* `latitude`
|
173
|
+
* `longitude`
|
174
|
+
* `latitude_humanized` (e.g. N44.09780)
|
175
|
+
* `longitude_humanized` (e.g. W58.41483)
|
176
|
+
* `qnh_in` (indicated QNH in inches Hg)
|
177
|
+
* `qnh_mb` (indicated QNH in milibars/hectopascals)
|
178
|
+
* `flight_type` (`I` for IFR, `V` for VFR, etc)
|
179
|
+
* `gcmap` (returns a great circle map image url)
|
180
|
+
|
181
|
+
### Great circle map visualization
|
182
|
+
|
183
|
+
The `.gcmap` method, available for all pilot stations, returns a great
|
184
|
+
circle map image url, depicting the GC route of the aircraft, its origin and destination,
|
185
|
+
its current position on the route, together with its current altitude and groundspeed.
|
186
|
+
Example below:
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
icao.vatsim_online[:pilots].first.gcmap #=> image url of the map
|
190
|
+
```
|
191
|
+
|
192
|
+
![GC Map](http://www.gcmap.com/map?P=kdfw-N44.09780+W58.41483-egll,+%22AAL026%5cn37112+ft%5cn516+kts%22%2b%40N44.09780+W58.41483&MS=wls&MR=540&MX=720x360&PM=*)
|
193
|
+
|
194
|
+
The map size (width and height) and scale **can be customized** by passing an
|
195
|
+
optional hash of arguments to the `vatsim_online` method like this:
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
icao.vatsim_online(:gcmap_width => "400", :gcmap_height => "400")[:pilots].first.gcmap #=> image url of the map
|
199
|
+
|
200
|
+
# The quotes are optional, so the statement can also be written like this:
|
201
|
+
icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)[:pilots].first.gcmap
|
202
|
+
```
|
203
|
+
![GC Map](http://www.gcmap.com/map?P=kdfw-N44.09780+W58.41483-egll,+%22AAL026%5cn37112+ft%5cn516+kts%22%2b%40N44.09780+W58.41483&MS=wls&MR=540&MX=400x400&PM=*)
|
204
|
+
|
205
|
+
### Customizing the request
|
206
|
+
|
207
|
+
The `vatsim online` method can be customized by passing in a hash-style collection
|
208
|
+
of arguments. The currently supported arguments and their defaults are:
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
:atc => true # Possible values: true, false. Default: true
|
212
|
+
:pilots => true # Possible values: true, false. Default: true
|
213
|
+
:exclude => "ICAO" # Accepts any full or partial ICAO code to be excluded from the ATC stations
|
214
|
+
:gcmap_width => integer # Optional parameter customizing the width of the station's `.gcmap`
|
215
|
+
:gcmap_height => integer # Optional parameter customizing the height of the station's `.gcmap`
|
216
|
+
```
|
217
|
+
#### ATC exclusions
|
218
|
+
|
219
|
+
The `:exclude => "ICAO"` option can be used to exclude matching stations from the
|
220
|
+
ATC listing. It accepts full or partial ICAO codes or callsigns.
|
221
|
+
|
222
|
+
For example you might want to display all Austrian ATC stations by calling
|
223
|
+
`"LO".vatsim_online`. Seems logical since all Austrian stations callsigns begin
|
224
|
+
with the `LO` prefix. However a few UK stations (London Control for example) also
|
225
|
+
have callsigns beginning with `LO` (*LON_CTR*). To avoid including them, you can
|
226
|
+
use the `:exclude` option on your request like this:
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
# Lets exclude all ATC station names beginning with LON from our request
|
230
|
+
"LO".vatsim_online(:exclude => "LON")[:atc] #=> [atc1, atc2, atc3...]
|
231
|
+
|
232
|
+
# This option is not case sensitive so we can use "lon" as well:
|
233
|
+
"LO".vatsim_online(:exclude => "lon")[:atc] #=> [atc1, atc2, atc3...]
|
234
|
+
```
|
235
|
+
|
236
|
+
#### ATC and PILOTS options
|
237
|
+
|
238
|
+
Both options can be used to exclude **all** ATC or pilots stations respectively from
|
239
|
+
the request, in order to speed it up and avoid processing useless data.
|
240
|
+
|
241
|
+
**Examples:**
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
# Lets exclude all ATC from our request and get the pilots only
|
245
|
+
"LO".vatsim_online(:atc => false)[:pilots] #=> [p1, p2, p3...]
|
246
|
+
|
247
|
+
# Lets exclude all pilots from our request and get the ATC only
|
248
|
+
"LO".vatsim_online(:pilots => false)[:atc] #=> [a1, a2, a3...]
|
249
|
+
|
250
|
+
"LO".vatsim_online(:atc => false)[:pilots].first.callsign #=> "ACH0838"
|
251
|
+
"LO".vatsim_online(:pilots => false)[:atc].first.callsign #=> "LOVV_CTR"
|
252
|
+
|
253
|
+
```
|
254
|
+
|
255
|
+
### Example of Ruby on Rails implementation
|
256
|
+
|
257
|
+
Here's a possible scenario of using this gem in a Ruby on Rails application.
|
258
|
+
Verbosity is kept on purpose for clarity.
|
259
|
+
|
260
|
+
**In your controller:**
|
261
|
+
```ruby
|
262
|
+
def index
|
263
|
+
# We want to retrieve all Austrian online stations (ATC and pilots)
|
264
|
+
icao = "LO"
|
265
|
+
stations = icao.vatsim_online
|
266
|
+
|
267
|
+
# Now we will assign the ATCs and the pilots to separate instance variables,
|
268
|
+
# to be able to loop through them separately in the view
|
269
|
+
@atc = stations[:atc]
|
270
|
+
@pilots = stations[:pilots]
|
271
|
+
|
272
|
+
# We can also isolate the departures and/or arrivals for conveneinence if we
|
273
|
+
# want to loop through them separately
|
274
|
+
@departures = stations[:departures]
|
275
|
+
@arrivals = stations[:arrivals]
|
276
|
+
end
|
277
|
+
```
|
278
|
+
|
279
|
+
**In your view (HAML is used for clarity):**
|
280
|
+
|
281
|
+
```haml
|
282
|
+
- for atc in @atc
|
283
|
+
%li
|
284
|
+
= atc.callsign
|
285
|
+
= atc.frequency
|
286
|
+
= atc.rating
|
287
|
+
= atc.name
|
288
|
+
= atc.online_since
|
289
|
+
= atc.atis_message
|
290
|
+
|
291
|
+
- for pilot in @pilots
|
292
|
+
%li
|
293
|
+
= pilot.callsign
|
294
|
+
= pilot.name
|
295
|
+
= pilot.origin
|
296
|
+
= pilot.destination
|
297
|
+
= pilot.route
|
298
|
+
= pilot.flight_type
|
299
|
+
= pilot.altitude
|
300
|
+
= pilot.groundspeed
|
301
|
+
= pilot.heading
|
302
|
+
= pilot.remarks
|
303
|
+
= pilot.online_since
|
304
|
+
= image_tag pilot.gcmap
|
305
|
+
|
306
|
+
- for arrival in @arrivals
|
307
|
+
%li
|
308
|
+
= arrival.callsign
|
309
|
+
= arrival.name
|
310
|
+
= image_tag arrival.gcmap
|
311
|
+
|
312
|
+
- for departure in @departures
|
313
|
+
%li
|
314
|
+
= departure.callsign
|
315
|
+
= departure.name
|
316
|
+
= image_tag departure.gcmap
|
317
|
+
```
|
318
|
+
|
319
|
+
### Notes
|
320
|
+
|
321
|
+
* Vatsim status and data files are cached locally to reduce the load on vatsim
|
322
|
+
servers. Random server is chosen to retrieve the data each time. By default the
|
323
|
+
status file is updated once every 4 hours and the data file once every 3 minutes
|
324
|
+
regardless of the number of incoming requests.
|
325
|
+
* The data is cached in your default TEMP directory (OS specific)
|
326
|
+
* All the data retrieval and caching logic is encapsulated in a separate class
|
327
|
+
`VatsimTools::DataDownloader` which can be mixed in other applications and
|
328
|
+
libraries too.
|
329
|
+
* The ICAO string used as a search criteria **is not** case sensitive
|
330
|
+
* Pilot stations returned are based on origin and destination airports, the
|
331
|
+
current algorithm does not evaluate enroute flights.
|
332
|
+
* When attaching the `vatsim_online` method to a comma-separated list of full or
|
333
|
+
partial ICAO identifiers it does not matter whether there will be any spaces in
|
334
|
+
front or after the identifiers or the commas, i.e. you can use
|
335
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
336
|
+
the same result.
|
337
|
+
|
338
|
+
## Changelog
|
339
|
+
|
340
|
+
### v. 0.9.1 - 31 Dec 2016
|
341
|
+
|
342
|
+
* Maintenance release, updated dependencies
|
343
|
+
|
344
|
+
### v. 0.9 - 20 June 2015
|
345
|
+
|
346
|
+
* Fixed nil String bug, can select "ALL" (thanks to Pierre Ferran and Florian Rimoli)
|
347
|
+
|
348
|
+
### v. 0.8.3 - 10 April 2014
|
349
|
+
|
350
|
+
* Fix stale data bug, change data fallback logic
|
351
|
+
|
352
|
+
### v. 0.8.2 - 5 October 2013
|
353
|
+
|
354
|
+
* Handle undetermined position when drawing gcmap
|
355
|
+
|
356
|
+
### v. 0.8.1 - 5 October 2013
|
357
|
+
|
358
|
+
* Ignore prefile data
|
359
|
+
|
360
|
+
### v. 0.8 - 5 October 2013
|
361
|
+
|
362
|
+
* search by callsign implemented
|
363
|
+
|
364
|
+
### v. 0.7.4 - 2 August 2013
|
365
|
+
|
366
|
+
* fallback scenarios for offline data servers
|
367
|
+
|
368
|
+
### v. 0.7.2 - 15 July 2013
|
369
|
+
|
370
|
+
* added gemspec license declaration
|
371
|
+
|
372
|
+
### v. 0.7.1 - 15 July 2013
|
373
|
+
|
374
|
+
* more comprehensive ATC ratings list
|
375
|
+
* dependencies updated
|
376
|
+
|
377
|
+
### v. 0.7.0 - 26 February 2013
|
378
|
+
|
379
|
+
* added Ruby 2.0 support
|
380
|
+
|
381
|
+
### v. 0.6.2 - 4 January 2013
|
382
|
+
|
383
|
+
* updated gem dependencies
|
384
|
+
* refactored `Station` class for simplicity
|
385
|
+
|
386
|
+
### v. 0.6.1 - 08 October 2012
|
387
|
+
|
388
|
+
* Fixed pilot station duplication issue when using multiple ICAOs
|
389
|
+
|
390
|
+
### v. 0.6.0 - 08 October 2012
|
391
|
+
|
392
|
+
* The `vatsim_online` method now also supports a comma-separated list of full or
|
393
|
+
partial ICAO codes like this: `"LO,LB".vatsim_online`. This allows you to pull the
|
394
|
+
information for multiple airports or FIRs in a single request
|
395
|
+
* The comma-seprated list is not sensitive to whitespace, meaning you can use
|
396
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
397
|
+
the same result
|
398
|
+
|
399
|
+
### v. 0.5.3 - 30 September 2012
|
400
|
+
|
401
|
+
* fixed bug with exceptions on missing ATC remark
|
402
|
+
|
403
|
+
### v. 0.5.2 - 29 September 2012
|
404
|
+
|
405
|
+
* fixed permissions bug on UNIX systems
|
406
|
+
|
407
|
+
### v. 0.5.1 - 23 September 2012
|
408
|
+
|
409
|
+
* bugfixes
|
410
|
+
|
411
|
+
### v. 0.5 - 23 September 2012
|
412
|
+
|
413
|
+
* New option `:exclude => "ICAO"` allowing further request customization by
|
414
|
+
excluding a matching subset of ATC stations from the listing. Read the documentation
|
415
|
+
for detailed explanation and examples
|
416
|
+
* New customized station attribute: `online_since`. Returns the station login time
|
417
|
+
parsed as a Ruby Time object in UTC (zulu time). As opposed to the `logon` attribute
|
418
|
+
which returns an unformatted, unparsed string such as `20120722091954`
|
419
|
+
* The `rating` station attribute is now humanized not to return just an integer,
|
420
|
+
but a readable version of the VATSIM rating, i.e. S1, S2, S3, C1, C3, I1, I3, etc...
|
421
|
+
* Added the possibility of customizing the great circle maps by optionally passing
|
422
|
+
parameters for width and height: `icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)`.
|
423
|
+
Read the documentation for detailed explanation and examples
|
424
|
+
* New customized station attribute `atis_message`. It will return a humanized web safe
|
425
|
+
version of the ATC atis without the voice server info and with lines split with
|
426
|
+
`<br />` tags. As opposed to the original `atis` attribute, which returns raw atis,
|
427
|
+
as reported from VATSIM, including voice server as first line
|
428
|
+
|
429
|
+
### v. 0.4 - 27 August 2012
|
430
|
+
|
431
|
+
* GCMapper integration: this library now plays nicely with [gcmapper](https://rubygems.org/gems/gcmapper).
|
432
|
+
A new attribute is provided for the pilot stations: `.gcmap` which returns a great
|
433
|
+
circle map image url, depicting the GC route of the aircraft, its origin and destination,
|
434
|
+
its current position on the route, together with its current altitude and groundspeed.
|
435
|
+
Look at the example in the README section above.
|
436
|
+
* New station attributes: planned_altitude, transponder, heading, qnh_in, qnh_mb,
|
437
|
+
flight_type, cid, latitude_humanized, longitude_humanized
|
438
|
+
|
439
|
+
|
440
|
+
### v. 0.3 - 22 July 2012
|
441
|
+
|
442
|
+
* The hash returned by the `vatsim_online` method now includes 2 new arrays:
|
443
|
+
`arrivals` and `departures`. These two are returned separately for convenience,
|
444
|
+
in case you want to loop through them separately. The `pilots` array return is
|
445
|
+
unchanged and contains all arrivals and departures.
|
446
|
+
* New station attributes: latitude, longitude
|
447
|
+
* Improved UTF-8 conversion process
|
448
|
+
|
449
|
+
### v. 0.2 - 21 July 2012
|
450
|
+
|
451
|
+
* Station attribute `departure` is now renamed to `origin`
|
452
|
+
* UTF-8 is now enforced for all local caching and file/string manipulations, the
|
453
|
+
original Vatsim data is re-encoded
|
454
|
+
* Station ATIS is now cleaned of invalid and obscure characters
|
455
|
+
* Improved documentation
|
456
|
+
|
457
|
+
## Contributing
|
458
|
+
|
459
|
+
1. Fork it
|
460
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
461
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
462
|
+
4. Make sure all tests are passing!
|
463
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
464
|
+
6. Create new Pull Request
|
465
|
+
|
466
|
+
## Credits
|
467
|
+
|
468
|
+
Copyright © 2016 [Svilen Vassilev](http://svilen.rubystudio.net)
|
469
|
+
Copyright © 2020 [Alex Dent](https://github.com/aldent95)
|
470
|
+
|
471
|
+
### Contributors
|
472
|
+
|
473
|
+
* [Florian Rimoli](https://github.com/Flox06)
|
474
|
+
* [Pierre Ferran](https://github.com/pierr3)
|
475
|
+
|
476
|
+
Released under the [MIT LICENSE](https://github.com/tarakanbg/vatsim_online/blob/master/LICENSE)
|
477
|
+
|
478
|
+
Maps generated by the [Great Circle Mapper](http://www.gcmap.com/), copyright Karl L. Swartz
|