vatsim_online 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +49 -0
- data/CONTRIBUTING.md +8 -0
- data/README.md +72 -7
- data/lib/vatsim_online/station.rb +32 -4
- data/lib/vatsim_online/station_parser.rb +10 -3
- data/lib/vatsim_online/version.rb +1 -1
- data/spec/station_parser_spec.rb +22 -1
- data/spec/vatsim_data.txt +4 -0
- data/spec/vatsim_online_spec.rb +40 -1
- data/vatsim_online.gemspec +1 -1
- metadata +6 -4
data/CHANGELOG.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# vatsim_online
|
2
|
+
|
3
|
+
## Changelog
|
4
|
+
|
5
|
+
### v. 0.5 - 23 September 2012
|
6
|
+
|
7
|
+
* New option `:exclude => "ICAO"` allowing further request customization by
|
8
|
+
excluding a matching subset of ATC stations from the listing. Read the documentation
|
9
|
+
for detailed explanation and examples
|
10
|
+
* New customized station attribute: `online_since`. Returns the station login time
|
11
|
+
parsed as a Ruby Time object in UTC (zulu time). As opposed to the `logon` attribute
|
12
|
+
which returns an unformatted, unparsed string such as `20120722091954`
|
13
|
+
* The `rating` station attribute is now humanized not to return just an integer,
|
14
|
+
but a readable version of the VATSIM rating, i.e. S1, S2, S3, C1, C3, I1, I3, etc...
|
15
|
+
* Added the possibility of customizing the great circle maps by optionally passing
|
16
|
+
parameters for width and height: `icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)`.
|
17
|
+
Read the documentation for detailed explanation and examples
|
18
|
+
* New customized station attribute `atis_message`. It will return a humanized web safe
|
19
|
+
version of the ATC atis without the voice server info and with lines split with
|
20
|
+
`<br />` tags. As opposed to the original `atis` attribute, which returns raw atis,
|
21
|
+
as reported from VATSIM, including voice server as first line
|
22
|
+
|
23
|
+
### v. 0.4 - 27 August 2012
|
24
|
+
|
25
|
+
* GCMapper integration: this library now plays nicely with [gcmapper](https://rubygems.org/gems/gcmapper).
|
26
|
+
A new attribute is provided for the pilot stations: `.gcmap` which returns a great
|
27
|
+
circle map image url, depicting the GC route of the aircraft, its origin and destination,
|
28
|
+
its current position on the route, together with its current altitude and groundspeed.
|
29
|
+
Look at the example in the README section above.
|
30
|
+
* New station attributes: planned_altitude, transponder, heading, qnh_in, qnh_mb,
|
31
|
+
flight_type, cid, latitude_humanized, longitude_humanized
|
32
|
+
|
33
|
+
|
34
|
+
### v. 0.3 - 22 July 2012
|
35
|
+
|
36
|
+
* The hash returned by the `vatsim_online` method now includes 2 new arrays:
|
37
|
+
`arrivals` and `departures`. These two are returned separately for convenience,
|
38
|
+
in case you want to loop through them separately. The `pilots` array return is
|
39
|
+
unchanged and contains all arrivals and departures.
|
40
|
+
* New station attributes: latitude, longitude
|
41
|
+
* Improved UTF-8 conversion process
|
42
|
+
|
43
|
+
### v. 0.2 - 21 July 2012
|
44
|
+
|
45
|
+
* Station attribute `departure` is now renamed to `origin`
|
46
|
+
* UTF-8 is now enforced for all local caching and file/string manipulations, the
|
47
|
+
original Vatsim data is re-encoded
|
48
|
+
* Station ATIS is now cleaned of invalid and obscure characters
|
49
|
+
* 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/README.md
CHANGED
@@ -89,6 +89,8 @@ icao.vatsim_online[:pilots].first #=> p1
|
|
89
89
|
a1.callsign #=> "LQSA_TWR"
|
90
90
|
a1.frequency #=> "118.25"
|
91
91
|
a1.name #=> "Svilen Vassilev"
|
92
|
+
a1.rating #=> "S2"
|
93
|
+
a1.online_since #=> "2012-09-22 10:00:48 UTC"
|
92
94
|
...
|
93
95
|
|
94
96
|
p1.callsign #=> "ACH217S"
|
@@ -120,11 +122,13 @@ Here's a complete list of the station object attributes that can be accessed:
|
|
120
122
|
* `origin`
|
121
123
|
* `destination`
|
122
124
|
* `route`
|
123
|
-
* `rating`
|
125
|
+
* `rating` (returns a humanized version of the VATSIM rating: S1, S2, S3, C1, etc...)
|
124
126
|
* `facility`
|
125
127
|
* `remarks`
|
126
|
-
* `atis`
|
127
|
-
* `
|
128
|
+
* `atis` (raw atis, as reported from VATSIM, including voice server as first line)
|
129
|
+
* `atis_message` (a humanized version of the ATC atis w/o server and with lines split)
|
130
|
+
* `logon` (login time as unparsed text string: `20120722091954`)
|
131
|
+
* `online_since` (returns the station login time parsed as a Ruby Time object in UTC)
|
128
132
|
* `latitude`
|
129
133
|
* `longitude`
|
130
134
|
* `latitude_humanized` (e.g. N44.09780)
|
@@ -139,10 +143,25 @@ Here's a complete list of the station object attributes that can be accessed:
|
|
139
143
|
The `.gcmap` method, available for all pilot stations, returns a great
|
140
144
|
circle map image url, depicting the GC route of the aircraft, its origin and destination,
|
141
145
|
its current position on the route, together with its current altitude and groundspeed.
|
142
|
-
Example
|
146
|
+
Example below:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
icao.vatsim_online[:pilots].first.gcmap #=> image url of the map
|
150
|
+
```
|
143
151
|
|
144
152
|
![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=*)
|
145
153
|
|
154
|
+
The map size (width and height) and scale **can be customized** by passing an
|
155
|
+
optional hash of arguments to the `vatsim_online` method like this:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
icao.vatsim_online(:gcmap_width => "400", :gcmap_height => "400")[:pilots].first.gcmap #=> image url of the map
|
159
|
+
|
160
|
+
# The quotes are optional, so the statement can also be written like this:
|
161
|
+
icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)[:pilots].first.gcmap
|
162
|
+
```
|
163
|
+
![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=*)
|
164
|
+
|
146
165
|
### Customizing the request
|
147
166
|
|
148
167
|
The `vatsim online` method can be customized by passing in a hash-style collection
|
@@ -151,9 +170,32 @@ of arguments. The currently supported arguments and their defaults are:
|
|
151
170
|
```ruby
|
152
171
|
:atc => true # Possible values: true, false. Default: true
|
153
172
|
:pilots => true # Possible values: true, false. Default: true
|
173
|
+
:exclude => "ICAO" # Accepts any full or partial ICAO code to be excluded from the ATC stations
|
174
|
+
:gcmap_width => integer # Optional parameter customizing the width of the station's `.gcmap`
|
175
|
+
:gcmap_height => integer # Optional parameter customizing the height of the station's `.gcmap`
|
154
176
|
```
|
177
|
+
#### ATC exclusions
|
155
178
|
|
156
|
-
|
179
|
+
The `:exclude => "ICAO"` option can be used to exclude matching stations from the
|
180
|
+
ATC listing. It accepts full or partial ICAO codes or callsigns.
|
181
|
+
|
182
|
+
For example you might want to display all Austrian ATC stations by calling
|
183
|
+
`"LO".vatsim_online`. Seems logical since all Austrian stations callsigns begin
|
184
|
+
with the `LO` prefix. However a few UK stations (London Control for example) also
|
185
|
+
have callsigns beginning with `LO` (*LON_CTR*). To avoid including them, you can
|
186
|
+
use the `:exclude` option on your request like this:
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
# Lets exclude all ATC station names beginning with LON from our request
|
190
|
+
"LO".vatsim_online(:exclude => "LON")[:atc] #=> [atc1, atc2, atc3...]
|
191
|
+
|
192
|
+
# This option is not case sensitive so we can use "lon" as well:
|
193
|
+
"LO".vatsim_online(:exclude => "lon")[:atc] #=> [atc1, atc2, atc3...]
|
194
|
+
```
|
195
|
+
|
196
|
+
#### ATC and PILOTS options
|
197
|
+
|
198
|
+
Both options can be used to exclude **all** ATC or pilots stations respectively from
|
157
199
|
the request, in order to speed it up and avoid processing useless data.
|
158
200
|
|
159
201
|
**Examples:**
|
@@ -203,7 +245,8 @@ end
|
|
203
245
|
= atc.frequency
|
204
246
|
= atc.rating
|
205
247
|
= atc.name
|
206
|
-
= atc.
|
248
|
+
= atc.online_since
|
249
|
+
= atc.atis_message
|
207
250
|
|
208
251
|
- for pilot in @pilots
|
209
252
|
%li
|
@@ -217,16 +260,20 @@ end
|
|
217
260
|
= pilot.groundspeed
|
218
261
|
= pilot.heading
|
219
262
|
= pilot.remarks
|
263
|
+
= pilot.online_since
|
264
|
+
= image_tag pilot.gcmap
|
220
265
|
|
221
266
|
- for arrival in @arrivals
|
222
267
|
%li
|
223
268
|
= arrival.callsign
|
224
269
|
= arrival.name
|
270
|
+
= image_tag arrival.gcmap
|
225
271
|
|
226
272
|
- for departure in @departures
|
227
273
|
%li
|
228
274
|
= departure.callsign
|
229
275
|
= departure.name
|
276
|
+
= image_tag departure.gcmap
|
230
277
|
```
|
231
278
|
|
232
279
|
### Notes
|
@@ -245,6 +292,24 @@ current algorithm does not evaluate enroute flights.
|
|
245
292
|
|
246
293
|
## Changelog
|
247
294
|
|
295
|
+
### v. 0.5 - 23 September 2012
|
296
|
+
|
297
|
+
* New option `:exclude => "ICAO"` allowing further request customization by
|
298
|
+
excluding a matching subset of ATC stations from the listing. Read the documentation
|
299
|
+
for detailed explanation and examples
|
300
|
+
* New customized station attribute: `online_since`. Returns the station login time
|
301
|
+
parsed as a Ruby Time object in UTC (zulu time). As opposed to the `logon` attribute
|
302
|
+
which returns an unformatted, unparsed string such as `20120722091954`
|
303
|
+
* The `rating` station attribute is now humanized not to return just an integer,
|
304
|
+
but a readable version of the VATSIM rating, i.e. S1, S2, S3, C1, C3, I1, I3, etc...
|
305
|
+
* Added the possibility of customizing the great circle maps by optionally passing
|
306
|
+
parameters for width and height: `icao.vatsim_online(:gcmap_width => 400, :gcmap_height => 400)`.
|
307
|
+
Read the documentation for detailed explanation and examples
|
308
|
+
* New customized station attribute `atis_message`. It will return a humanized web safe
|
309
|
+
version of the ATC atis without the voice server info and with lines split with
|
310
|
+
`<br />` tags. As opposed to the original `atis` attribute, which returns raw atis,
|
311
|
+
as reported from VATSIM, including voice server as first line
|
312
|
+
|
248
313
|
### v. 0.4 - 27 August 2012
|
249
314
|
|
250
315
|
* GCMapper integration: this library now plays nicely with [gcmapper](https://rubygems.org/gems/gcmapper).
|
@@ -291,6 +356,6 @@ Copyright © 2012 [Svilen Vassilev](http://about.me/svilen)
|
|
291
356
|
[![endorse](http://api.coderwall.com/svilenv/endorse.png)](http://coderwall.com/svilenv)
|
292
357
|
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5FR7AQA4PLD8A)
|
293
358
|
|
294
|
-
Released under the [MIT LICENSE](https://github.com/tarakanbg/
|
359
|
+
Released under the [MIT LICENSE](https://github.com/tarakanbg/vatsim_online/blob/master/LICENSE)
|
295
360
|
|
296
361
|
Maps generated by the [Great Circle Mapper](http://www.gcmap.com/), copyright Karl L. Swartz
|
@@ -6,11 +6,12 @@ module VatsimTools
|
|
6
6
|
attributes = %w{callsign name role frequency altitude groundspeed aircraft
|
7
7
|
origin destination rating facility remarks route atis logon latitude longitude
|
8
8
|
planned_altitude transponder heading qnh_in qnh_mb flight_type cid gcmap
|
9
|
-
latitude_humanized longitude_humanized
|
9
|
+
latitude_humanized longitude_humanized online_since gcmap_width gcmap_height
|
10
|
+
atis_message}
|
10
11
|
attributes.each {|attribute| attr_accessor attribute.to_sym }
|
11
12
|
|
12
13
|
|
13
|
-
def initialize(station)
|
14
|
+
def initialize(station, args = nil)
|
14
15
|
@callsign = station[0]
|
15
16
|
@cid = station[1]
|
16
17
|
@name = station[2]
|
@@ -22,7 +23,7 @@ module VatsimTools
|
|
22
23
|
@aircraft = station[9]
|
23
24
|
@origin = station[11]
|
24
25
|
@destination = station[13]
|
25
|
-
@rating = station[16]
|
26
|
+
@rating = humanized_rating(station[16])
|
26
27
|
@facility = station[18]
|
27
28
|
@remarks = station[29]
|
28
29
|
@route = station[30]
|
@@ -37,7 +38,11 @@ module VatsimTools
|
|
37
38
|
@qnh_in = station[39]
|
38
39
|
@qnh_mb = station[40]
|
39
40
|
@flight_type = station[21]
|
41
|
+
@online_since = utc_logon_time
|
42
|
+
@gcmap_width = args[:gcmap_width].to_i if args && args[:gcmap_width]
|
43
|
+
@gcmap_height = args[:gcmap_height].to_i if args && args[:gcmap_height]
|
40
44
|
@gcmap = gcmap_generator
|
45
|
+
@atis_message = construct_atis_message(station[35]) if station[35]
|
41
46
|
end
|
42
47
|
|
43
48
|
private
|
@@ -49,7 +54,7 @@ module VatsimTools
|
|
49
54
|
route += "-" + @destination
|
50
55
|
route += "%2C+\"" + @callsign + "%5Cn" + @altitude + "+ft%5Cn" + @groundspeed + "+kts"
|
51
56
|
route += "\"%2B%40" + @latitude_humanized + "+" + @longitude_humanized
|
52
|
-
route.gcmap
|
57
|
+
route.gcmap(:width => @gcmap_width, :height => @gcmap_height)
|
53
58
|
end
|
54
59
|
|
55
60
|
def latitude_parser(lat)
|
@@ -66,6 +71,29 @@ module VatsimTools
|
|
66
71
|
raw_atis.gsub(/[\^]/, '. ')
|
67
72
|
end
|
68
73
|
|
74
|
+
def utc_logon_time
|
75
|
+
Time.parse ("#{@logon[0...4]}-#{@logon[4...6]}-#{@logon[6...8]} #{@logon[8...10]}:#{@logon[10...12]}:#{@logon[12...14]} UTC")
|
76
|
+
end
|
77
|
+
|
78
|
+
def humanized_rating(rating_number)
|
79
|
+
case rating_number
|
80
|
+
when "1" then "P0/OBS"
|
81
|
+
when "2" then "S1"
|
82
|
+
when "3" then "S2"
|
83
|
+
when "4" then "S3"
|
84
|
+
when "5" then "C1"
|
85
|
+
when "7" then "C3"
|
86
|
+
when "8" then "I1"
|
87
|
+
when "10" then "I3"
|
88
|
+
else
|
89
|
+
"UNK"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def construct_atis_message(raw_atis)
|
94
|
+
message = raw_atis.gsub(/[\^]/, '<br />')
|
95
|
+
message = message[message.index('>')+1...message.length]
|
96
|
+
end
|
69
97
|
|
70
98
|
end
|
71
99
|
end
|
@@ -6,8 +6,8 @@ module VatsimTools
|
|
6
6
|
require_relative "data_downloader"
|
7
7
|
require_relative "station"
|
8
8
|
|
9
|
-
|
10
|
-
attr_accessor
|
9
|
+
attributes = %w{role icao excluded gcmap_width gcmap_height}
|
10
|
+
attributes.each {|attribute| attr_accessor attribute.to_sym }
|
11
11
|
|
12
12
|
LOCAL_DATA = "#{Dir.tmpdir}/vatsim_data.txt"
|
13
13
|
|
@@ -15,6 +15,9 @@ module VatsimTools
|
|
15
15
|
VatsimTools::DataDownloader.new
|
16
16
|
args.class == Hash ? @role = determine_role(args) : @role = "all"
|
17
17
|
@icao = icao.upcase
|
18
|
+
@excluded = args[:exclude].upcase if args && args[:exclude]
|
19
|
+
@gcmap_width = args[:gcmap_width] if args && args[:gcmap_width]
|
20
|
+
@gcmap_height = args[:gcmap_height] if args && args[:gcmap_height]
|
18
21
|
end
|
19
22
|
|
20
23
|
def determine_role(args)
|
@@ -36,7 +39,10 @@ module VatsimTools
|
|
36
39
|
|
37
40
|
def station_objects
|
38
41
|
station_objects= []
|
39
|
-
|
42
|
+
args = {}
|
43
|
+
args[:gcmap_width] = @gcmap_width if @gcmap_width
|
44
|
+
args[:gcmap_height] = @gcmap_height if @gcmap_height
|
45
|
+
stations.each {|station| station_objects << VatsimTools::Station.new(station, args) }
|
40
46
|
station_objects
|
41
47
|
end
|
42
48
|
|
@@ -44,6 +50,7 @@ module VatsimTools
|
|
44
50
|
atc = []; pilots = []; arrivals = []; departures = []
|
45
51
|
station_objects.each {|sobj| sobj.role == "ATC" ? atc << sobj : pilots << sobj}
|
46
52
|
pilots.each {|p| p.origin[0...@icao.length] == @icao ? departures << p : arrivals << p }
|
53
|
+
atc.delete_if {|a| @excluded && a.callsign[0...@excluded.length] == @excluded }
|
47
54
|
{:atc => atc, :pilots => pilots, :arrivals => arrivals, :departures => departures}
|
48
55
|
end
|
49
56
|
|
data/spec/station_parser_spec.rb
CHANGED
@@ -25,6 +25,13 @@ describe VatsimTools::StationParser do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
describe "excluded list" do
|
29
|
+
it "should not interfere if missing" do
|
30
|
+
args = {:exclude => "loww"}
|
31
|
+
target.new("loww", args).role.should eq("all")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
28
35
|
describe "stations" do
|
29
36
|
args = {:pilots => true, :atc => true}
|
30
37
|
it "should return an expected result" do
|
@@ -112,7 +119,21 @@ describe VatsimTools::StationParser do
|
|
112
119
|
target.new(icao).sorted_station_objects[:arrivals].size.should eq(6)
|
113
120
|
target.new(icao).sorted_station_objects[:departures].size.should eq(6)
|
114
121
|
end
|
115
|
-
end
|
116
122
|
|
123
|
+
it "should recognize exclusions" do
|
124
|
+
gem_data_file
|
125
|
+
icao = "LB"
|
126
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(4)
|
127
|
+
args = {:exclude => "LBGO"}
|
128
|
+
target.new(icao, args).excluded.should eq("LBGO")
|
129
|
+
target.new(icao, args).excluded.length.should eq(4)
|
130
|
+
target.new(icao, args).sorted_station_objects[:atc].size.should eq(3)
|
131
|
+
args = {:exclude => "LBSF"}
|
132
|
+
target.new(icao, args).sorted_station_objects[:atc].size.should eq(2)
|
133
|
+
args = {:exclude => "lbsf"}
|
134
|
+
target.new(icao, args).sorted_station_objects[:atc].size.should eq(2)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
117
138
|
|
118
139
|
end
|
data/spec/vatsim_data.txt
CHANGED
@@ -266,6 +266,10 @@ KHB116:1014284:Maxim Solomin ULLI:PILOT::50.66457:131.14727:37695:490:H/B744/P:8
|
|
266
266
|
KKK6450:997204:Burak GOKGOZ LTBA:PILOT::40.97795:28.81595:177:0::0::::EUROPE-CE:100:1:1200::::::::::::::::::::20120722102517:76:29.79:1008:
|
267
267
|
KLM1659:1151702:jeffrey de graaf EHRD:PILOT::45.36689:12.19101:3239:200:B738:280:EHAM:360:LIPZ:EUROPE-C2:100:1:4222:::0:I:830:830:1:15:2:50::REG/PHBXM SEL/LNBM DOF/120722 OPR/KLM RVR/200 RMK/TCAS ACFT CERTIFIED NOISE STAGE 4 ORG/EHAM /V/:EDUPO UZ738 RIDSU UL607 UTABA UM738 ADOSA L612 ALBET:0:0:0:0:::20120722075756:1:30.26:1024:
|
268
268
|
LAN500:1001738:Felipe Ibanez - SCEL:PILOT::4.64456:-78.09261:36082:476:T/B763/F:0:SCEL:360:KMIA:USA-W:100:1:2200:::3:I:0:523:0:0:0:0:KATL::ESLAR5 VTN UT100 ROPAX UW200 TOY UL302 LIM UM795 COLBY UB510 SIA UG430 UCA UA301 URSUS FOWEE5:0:0:0:0:::20120722045848:357:30.001:1015:
|
269
|
+
LBSF_TWR:1053857:Sebastien Bartosz:ATC:134.470:43.66528:7.21500:0:::0::::EUROPE-CW2:100:8::5:150::::::::::::::::$ voice2.vacc-sag.org/lfmn_app^Nice Approach^Charts at www.tinyurl.com/chartsfr^Visit www.vatfrance.org:20120722102127:20120722091954::::
|
270
|
+
LBSF_APP:1053857:Sebastien Bartosz:ATC:134.470:43.66528:7.21500:0:::0::::EUROPE-CW2:100:8::5:150::::::::::::::::$ voice2.vacc-sag.org/lfmn_app^Nice Approach^Charts at www.tinyurl.com/chartsfr^Visit www.vatfrance.org:20120722102127:20120722091954::::
|
271
|
+
LBWN_TWR:1053857:Sebastien Bartosz:ATC:134.470:43.66528:7.21500:0:::0::::EUROPE-CW2:100:8::5:150::::::::::::::::$ voice2.vacc-sag.org/lfmn_app^Nice Approach^Charts at www.tinyurl.com/chartsfr^Visit www.vatfrance.org:20120722102127:20120722091954::::
|
272
|
+
LBGO_TWR:1053857:Sebastien Bartosz:ATC:134.470:43.66528:7.21500:0:::0::::EUROPE-CW2:100:8::5:150::::::::::::::::$ voice2.vacc-sag.org/lfmn_app^Nice Approach^Charts at www.tinyurl.com/chartsfr^Visit www.vatfrance.org:20120722102127:20120722091954::::
|
269
273
|
LEPA_E_GND:1205099:Mart Feiner:ATC:121.700:39.55168:2.73881:0:::0::::EUROPE-CW2:100:2::2:15::::::::::::::::$ voice1.vacc-sag.org/lepa_e_gnd:20120722101855:20120722100336::::
|
270
274
|
LFMD_ATIS:1053857:Sebastien Bartosz:ATC:126.470:43.54639:6.95417:0:::0::::EUROPE-CW2:100:8::4:0::::::::::::::::$ voice2.vacc-sag.org/lfmd_atis^LFMDinfo B observation at 0930 ILS 17 departure rwy 17 wind 250^degrees 7 knots variable between 190 and 310 visibility^more than 10 kms clouds SCT 10000 feet temperature 28 dewpoint^12 degrees C QNH 1013 hpa firstcontact B:20120722101523:20120722092930::::
|
271
275
|
LFMN_APP:1053857:Sebastien Bartosz:ATC:134.470:43.66528:7.21500:0:::0::::EUROPE-CW2:100:8::5:150::::::::::::::::$ voice2.vacc-sag.org/lfmn_app^Nice Approach^Charts at www.tinyurl.com/chartsfr^Visit www.vatfrance.org:20120722102127:20120722091954::::
|
data/spec/vatsim_online_spec.rb
CHANGED
@@ -19,6 +19,8 @@ describe VatsimOnline do
|
|
19
19
|
|
20
20
|
"LO".vatsim_online[:pilots].first.callsign.should eq("AMZ1105")
|
21
21
|
"WM".vatsim_online[:atc].first.callsign.should eq("WMKK_APP")
|
22
|
+
"LO".vatsim_online(:gcmap_width => "400", :gcmap_height => "400")[:pilots].first.gcmap.should eq("http://www.gcmap.com/map?P=LOWW-N45.45676+E12.28972-LIPZ%2C+\"AMZ1105%5Cn1007+ft%5Cn128+kts\"%2B%40N45.45676+E12.28972%0d%0a&MS=wls&MR=120&MX=400x400&PM=b:disc7%2b\"%25U%25+%28N\"")
|
23
|
+
"LO".vatsim_online(:gcmap_width => 400, :gcmap_height => 400)[:pilots].first.gcmap.should eq("http://www.gcmap.com/map?P=LOWW-N45.45676+E12.28972-LIPZ%2C+\"AMZ1105%5Cn1007+ft%5Cn128+kts\"%2B%40N45.45676+E12.28972%0d%0a&MS=wls&MR=120&MX=400x400&PM=b:disc7%2b\"%25U%25+%28N\"")
|
22
24
|
end
|
23
25
|
|
24
26
|
it "should be case insensitive" do
|
@@ -45,7 +47,7 @@ describe VatsimTools::Station do
|
|
45
47
|
new_object.name.should eq("Adriel Loke")
|
46
48
|
new_object.role.should eq("ATC")
|
47
49
|
new_object.frequency.should eq("124.200")
|
48
|
-
new_object.rating.should eq("
|
50
|
+
new_object.rating.should eq("S2")
|
49
51
|
new_object.facility.should eq("5")
|
50
52
|
new_object.logon.should eq("20120722092836")
|
51
53
|
new_object.latitude.should eq("2.93968")
|
@@ -53,6 +55,17 @@ describe VatsimTools::Station do
|
|
53
55
|
new_object.longitude.should eq("101.39812")
|
54
56
|
new_object.longitude_humanized.should eq("E101.39812")
|
55
57
|
end
|
58
|
+
|
59
|
+
it "should parse Ruby time with online_since attr" do
|
60
|
+
gem_data_file
|
61
|
+
icao = "LBWN"
|
62
|
+
station = VatsimTools::StationParser.new(icao).sorted_station_objects[:atc].first
|
63
|
+
station.logon.should eq("20120722091954")
|
64
|
+
station.online_since.class.should eq(Time)
|
65
|
+
station.online_since.utc?.should eq(true)
|
66
|
+
station.online_since.should eq("2012-07-22 09:19:54 UTC")
|
67
|
+
station.rating.should eq("I1")
|
68
|
+
end
|
56
69
|
end
|
57
70
|
|
58
71
|
describe "pilot object" do
|
@@ -85,6 +98,32 @@ describe VatsimTools::Station do
|
|
85
98
|
new_object.gcmap.should eq("http://www.gcmap.com/map?P=KDFW-N44.0978+W58.41483-EGLL%2C+\"AAL026%5Cn37210+ft%5Cn543+kts\"%2B%40N44.0978+W58.41483%0d%0a&MS=wls&MR=120&MX=720x360&PM=b:disc7%2b\"%25U%25+%28N\"")
|
86
99
|
end
|
87
100
|
|
101
|
+
it "should handle resized gcmap" do
|
102
|
+
gem_data_file
|
103
|
+
icao = "EGLL"
|
104
|
+
args = {}
|
105
|
+
args[:gcmap_width] = "400"
|
106
|
+
args[:gcmap_height] = "400"
|
107
|
+
station = VatsimTools::StationParser.new(icao).stations.first
|
108
|
+
new_object = VatsimTools::Station.new(station, args)
|
109
|
+
new_object.gcmap_width.should eq(400)
|
110
|
+
new_object.gcmap_height.should eq(400)
|
111
|
+
new_object.gcmap.should eq("http://www.gcmap.com/map?P=KDFW-N44.0978+W58.41483-EGLL%2C+\"AAL026%5Cn37210+ft%5Cn543+kts\"%2B%40N44.0978+W58.41483%0d%0a&MS=wls&MR=120&MX=400x400&PM=b:disc7%2b\"%25U%25+%28N\"")
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "atc object" do
|
118
|
+
it "should handle regular and humanized atis" do
|
119
|
+
gem_data_file
|
120
|
+
icao = "LBWN"
|
121
|
+
station = VatsimTools::StationParser.new(icao).sorted_station_objects[:atc].first
|
122
|
+
station.logon.should eq("20120722091954")
|
123
|
+
station.rating.should eq("I1")
|
124
|
+
station.atis.should eq("$ voice2.vacc-sag.org/lfmn_app. Nice Approach. Charts at www.tinyurl.com/chartsfr. Visit www.vatfrance.org")
|
125
|
+
station.atis_message.should eq("Nice Approach<br />Charts at www.tinyurl.com/chartsfr<br />Visit www.vatfrance.org")
|
126
|
+
end
|
88
127
|
end
|
89
128
|
|
90
129
|
end
|
data/vatsim_online.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency "guard-rspec"
|
23
23
|
gem.add_dependency "curb", "~> 0.8.1"
|
24
24
|
gem.add_dependency "time_diff", "~> 0.2.2"
|
25
|
-
gem.add_dependency "gcmapper", "~> 0.3"
|
25
|
+
gem.add_dependency "gcmapper", "~> 0.3.1"
|
26
26
|
end
|
27
27
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vatsim_online
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ~>
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: 0.3.1
|
134
134
|
type: :runtime
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
requirements:
|
139
139
|
- - ~>
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
141
|
+
version: 0.3.1
|
142
142
|
description: Selectively pulls and parses Vatsim online stations data. Essentially
|
143
143
|
it's a 'who's online' library, capable of displaying online ATC and/or pilots for
|
144
144
|
given airports, areas or globally. Stations are returned as objects, exposing a
|
@@ -152,6 +152,8 @@ extra_rdoc_files: []
|
|
152
152
|
files:
|
153
153
|
- .gitignore
|
154
154
|
- .travis.yml
|
155
|
+
- CHANGELOG.md
|
156
|
+
- CONTRIBUTING.md
|
155
157
|
- Gemfile
|
156
158
|
- Guardfile
|
157
159
|
- LICENSE
|