vatsim_online 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +9 -0
- data/README.md +24 -2
- data/lib/vatsim_online/station_parser.rb +8 -4
- data/lib/vatsim_online/version.rb +1 -1
- data/spec/station_parser_spec.rb +20 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Changelog
|
4
4
|
|
5
|
+
### v. 0.6.0 - 08 October 2012
|
6
|
+
|
7
|
+
* The `vatsim_online` method now also supports a comma-separated list of full or
|
8
|
+
partial ICAO codes like this: `"LO,LB".vatsim_online`. This allows you to pull the
|
9
|
+
information for multiple airports or FIRs in a single request
|
10
|
+
* The comma-seprated list is not sensitive to whitespace, meaning you can use
|
11
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
12
|
+
the same result
|
13
|
+
|
5
14
|
### v. 0.5.3 - 30 September 2012
|
6
15
|
|
7
16
|
* fixed bug with exceptions on missing ATC remark
|
data/README.md
CHANGED
@@ -32,8 +32,8 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
This gem provides one public method: `vatsim_online`, which can be applied to
|
34
34
|
any string (or variable containing a string) representing a full or partial ICAO
|
35
|
-
code. The provided ICAO code or fragment
|
36
|
-
matched against the current vatsim data.
|
35
|
+
code or a comma-separated list of ICAO codes. The provided ICAO code or fragment
|
36
|
+
will be used as a search criteria and matched against the current vatsim data.
|
37
37
|
|
38
38
|
For example if you want to retrieve all active stations (ATC positions and pilots)
|
39
39
|
for Vienna airport (ICAO: LOWW), then you can use:
|
@@ -42,6 +42,9 @@ for Vienna airport (ICAO: LOWW), then you can use:
|
|
42
42
|
# Attaching the method directly to a string:
|
43
43
|
"LOWW".vatsim_online
|
44
44
|
|
45
|
+
# Attaching the method directly to a list of ICAOs:
|
46
|
+
"LOWW, LOWK".vatsim_online
|
47
|
+
|
45
48
|
# Attaching the method to a variable containing a string:
|
46
49
|
icao = "LOWW"
|
47
50
|
icao.vatsim_online
|
@@ -59,7 +62,12 @@ airports and ATC station callsigns start with `"LO"`:
|
|
59
62
|
# Attaching the method to a variable containing a string:
|
60
63
|
icao = "LO"
|
61
64
|
icao.vatsim_online
|
65
|
+
|
66
|
+
# Attaching the method to a list of ICAOs:
|
67
|
+
icao = "LO, LB"
|
68
|
+
icao.vatsim_online
|
62
69
|
```
|
70
|
+
|
63
71
|
When parsing the pilot stations for particular airport or area, the library will
|
64
72
|
return the pilots that are flying **to or from** the given area or airport,
|
65
73
|
not the current enroute stations. The discovery algorithm is based on **origin
|
@@ -289,9 +297,23 @@ libraries too.
|
|
289
297
|
* The ICAO string used as a search criteria **is not** case sensitive
|
290
298
|
* Pilot stations returned are based on origin and destination airports, the
|
291
299
|
current algorithm does not evaluate enroute flights.
|
300
|
+
* When attaching the `vatsim_online` method to a comma-separated list of full or
|
301
|
+
partial ICAO identifiers it does not matter whether there will be any spaces in
|
302
|
+
front or after the identifiers or the commas, i.e. you can use
|
303
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
304
|
+
the same result.
|
292
305
|
|
293
306
|
## Changelog
|
294
307
|
|
308
|
+
### v. 0.6.0 - 08 October 2012
|
309
|
+
|
310
|
+
* The `vatsim_online` method now also supports a comma-separated list of full or
|
311
|
+
partial ICAO codes like this: `"LO,LB".vatsim_online`. This allows you to pull the
|
312
|
+
information for multiple airports or FIRs in a single request
|
313
|
+
* The comma-seprated list is not sensitive to whitespace, meaning you can use
|
314
|
+
`"LO,LB".vatsim_online` or `"LO, LB".vatsim_online` or `"LO , LB".vatsim_online` with
|
315
|
+
the same result
|
316
|
+
|
295
317
|
### v. 0.5.3 - 30 September 2012
|
296
318
|
|
297
319
|
* fixed bug with exceptions on missing ATC remark
|
@@ -14,7 +14,7 @@ module VatsimTools
|
|
14
14
|
def initialize(icao, args = nil)
|
15
15
|
VatsimTools::DataDownloader.new
|
16
16
|
args.class == Hash ? @role = determine_role(args) : @role = "all"
|
17
|
-
@icao = icao.upcase
|
17
|
+
@icao = icao.upcase.split(',').each {|s| s.strip!}
|
18
18
|
@excluded = args[:exclude].upcase if args && args[:exclude]
|
19
19
|
@gcmap_width = args[:gcmap_width] if args && args[:gcmap_width]
|
20
20
|
@gcmap_height = args[:gcmap_height] if args && args[:gcmap_height]
|
@@ -31,8 +31,10 @@ module VatsimTools
|
|
31
31
|
stations = []
|
32
32
|
CSV.foreach(LOCAL_DATA, :col_sep =>':') do |row|
|
33
33
|
callsign, origin, destination, client = row[0].to_s, row[11].to_s, row[13].to_s, row[3].to_s
|
34
|
-
|
35
|
-
|
34
|
+
for icao in @icao
|
35
|
+
stations << row if (callsign[0...icao.length] == icao && client == "ATC") unless @role == "pilot"
|
36
|
+
stations << row if (origin[0...icao.length] == icao || destination[0...icao.length] == icao) unless @role == "atc"
|
37
|
+
end
|
36
38
|
end
|
37
39
|
stations
|
38
40
|
end
|
@@ -49,7 +51,9 @@ module VatsimTools
|
|
49
51
|
def sorted_station_objects
|
50
52
|
atc = []; pilots = []; arrivals = []; departures = []
|
51
53
|
station_objects.each {|sobj| sobj.role == "ATC" ? atc << sobj : pilots << sobj}
|
52
|
-
|
54
|
+
for icao in @icao
|
55
|
+
pilots.each {|p| p.origin[0...icao.length] == icao ? departures << p : arrivals << p }
|
56
|
+
end
|
53
57
|
atc.delete_if {|a| @excluded && a.callsign[0...@excluded.length] == @excluded }
|
54
58
|
{:atc => atc, :pilots => pilots, :arrivals => arrivals, :departures => departures}
|
55
59
|
end
|
data/spec/station_parser_spec.rb
CHANGED
@@ -134,6 +134,26 @@ describe VatsimTools::StationParser do
|
|
134
134
|
target.new(icao, args).sorted_station_objects[:atc].size.should eq(2)
|
135
135
|
end
|
136
136
|
|
137
|
+
it "should support multiple icaos" do
|
138
|
+
gem_data_file
|
139
|
+
icao = "LB"
|
140
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(4)
|
141
|
+
target.new(icao).sorted_station_objects[:pilots].size.should eq(2)
|
142
|
+
icao = "LO"
|
143
|
+
target.new(icao).sorted_station_objects[:pilots].size.should eq(12)
|
144
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(0)
|
145
|
+
gem_data_file
|
146
|
+
icao = "LO,LB"
|
147
|
+
target.new(icao).sorted_station_objects[:pilots].size.should eq(14)
|
148
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(4)
|
149
|
+
icao = "LO, LB"
|
150
|
+
target.new(icao).sorted_station_objects[:pilots].size.should eq(14)
|
151
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(4)
|
152
|
+
icao = "LO , LB"
|
153
|
+
target.new(icao).sorted_station_objects[:pilots].size.should eq(14)
|
154
|
+
target.new(icao).sorted_station_objects[:atc].size.should eq(4)
|
155
|
+
end
|
156
|
+
|
137
157
|
end
|
138
158
|
|
139
159
|
end
|
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.6.0
|
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-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|