flight_radar 0.2.1 → 0.3.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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ruby.yml +2 -1
- data/CHANGELOG.md +29 -0
- data/README.md +146 -12
- data/flight_radar.gemspec +11 -5
- data/lib/flight_radar/core.rb +7 -8
- data/lib/flight_radar/flight.rb +16 -5
- data/lib/flight_radar/version.rb +5 -0
- data/lib/flight_radar.rb +50 -6
- metadata +19 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 577b655ed0ac3653a99092e3e9c076befa0c8c1b58c205da36e01c49979cb7c6
|
|
4
|
+
data.tar.gz: 020ffcf2ac3b110f0424cf2fc9b5e09c63e165efb5eae7be6ffff904d9d9660d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 306207a684236c5e747a32eca79272b43163f2364c2f73efe8f8339b971ddffec7be3e11c5b11f0048b2bc14f0bab85fe2441c86b1c6028be3482ecc4c56cbe6
|
|
7
|
+
data.tar.gz: 6675ebe2ea8b5e8e0fee89b40aa4f8875132650ade80db3c4998d394f3d454c3257fd2e5433c841ef8a3e1557ad30c50e302e54f811f68b4d64ef210a0725f75
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2025-11-25
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- New `search(query, limit)` method for searching flights, airports, and airlines
|
|
7
|
+
- New `most_tracked` method to retrieve most tracked flights in real-time
|
|
8
|
+
- New `flight_playback(flight_id)` method for retrieving flight path history
|
|
9
|
+
- New `aircraft(registration)` method for searching aircraft by registration number
|
|
10
|
+
- New `airline_fleet(airline_code)` method for retrieving airline fleet information
|
|
11
|
+
- Added `attr_reader` for all Flight class instance variables (icao_24bit, latitude, longitude, squawk, aircraft_code, registration, time, origin_airport_iata, destination_airport_iata, number, airline_iata, on_ground, callsign, airline_icao)
|
|
12
|
+
- Enhanced gemspec with bug_tracker_uri and documentation_uri metadata
|
|
13
|
+
- Updated README with comprehensive documentation for all new methods
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Fixed bug in Flight#to_s method where heading was displaying ground_speed value
|
|
17
|
+
- Fixed HEADERS constant mutation issue in Core module by using .merge() and .freeze
|
|
18
|
+
- Fixed inconsistent Request class usage in airport and flight_details methods
|
|
19
|
+
- Fixed flight_level method attempting to slice integer instead of properly dividing by 100
|
|
20
|
+
- Fixed ground_speed method type comparison issue
|
|
21
|
+
- Fixed airline_iata extraction to safely handle nil/short values
|
|
22
|
+
- Fixed flaky airline_logo test to require at least 1 logo instead of exactly 2
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Refactored airport method to use Request class instead of direct HTTParty.get
|
|
26
|
+
- Refactored flight_details method to use Request class for consistency
|
|
27
|
+
- Updated GitHub Actions workflow to use Ruby 3.2
|
|
28
|
+
- Added bundler-cache to CI for faster builds
|
|
29
|
+
- Gemspec now loads version dynamically from FlightRadar::VERSION
|
|
30
|
+
- Enhanced gemspec description with more details
|
|
31
|
+
|
|
3
32
|
## [0.2.1] - 2023-12-21
|
|
4
33
|
- Code refactor
|
|
5
34
|
- Add documentation to the code
|
data/README.md
CHANGED
|
@@ -8,13 +8,20 @@
|
|
|
8
8
|
- [Usage](#usage)
|
|
9
9
|
- [Airlines](#airlines)
|
|
10
10
|
- [Airport](#airport)
|
|
11
|
+
- [Airports](#airports)
|
|
11
12
|
- [Zones](#zones)
|
|
12
13
|
- [Flights](#flights)
|
|
13
14
|
- [Flight Details](#flight-details)
|
|
15
|
+
- [Flight Playback](#flight-playback)
|
|
14
16
|
- [Flights by Airline](#flights-by-airline)
|
|
15
17
|
- [Flights by Bounds](#flights-by-bounds)
|
|
18
|
+
- [Search](#search)
|
|
19
|
+
- [Most Tracked Flights](#most-tracked-flights)
|
|
20
|
+
- [Aircraft Information](#aircraft-information)
|
|
21
|
+
- [Airline Fleet](#airline-fleet)
|
|
16
22
|
- [Airline Logo](#airline-logo)
|
|
17
23
|
- [Country Flag](#country-flag)
|
|
24
|
+
- [Documentation](#documentation)
|
|
18
25
|
- [Development](#development)
|
|
19
26
|
- [Contributing](#contributing)
|
|
20
27
|
- [License](#license)
|
|
@@ -58,9 +65,10 @@ FlightRadar.airlines
|
|
|
58
65
|
|
|
59
66
|
### Airport
|
|
60
67
|
|
|
68
|
+
Get traffic statistics for a specific airport.
|
|
69
|
+
|
|
61
70
|
```ruby
|
|
62
|
-
airport
|
|
63
|
-
FlightRadar.airport(airport)
|
|
71
|
+
FlightRadar.airport("LAX")
|
|
64
72
|
```
|
|
65
73
|
|
|
66
74
|
**Sample response:**
|
|
@@ -68,22 +76,21 @@ FlightRadar.airport(airport)
|
|
|
68
76
|
```ruby
|
|
69
77
|
{
|
|
70
78
|
"details" => {
|
|
71
|
-
"name" => "
|
|
79
|
+
"name" => "Los Angeles International Airport",
|
|
72
80
|
"code" => {
|
|
73
|
-
"iata" => "
|
|
74
|
-
"icao" => "
|
|
81
|
+
"iata" => "LAX",
|
|
82
|
+
"icao" => "KLAX"
|
|
75
83
|
},
|
|
76
84
|
"position" => {
|
|
77
|
-
"latitude" =>
|
|
78
|
-
"longitude" =>
|
|
79
|
-
"altitude" =>
|
|
85
|
+
"latitude" => 33.942536,
|
|
86
|
+
"longitude" => -118.408075,
|
|
87
|
+
"altitude" => 125,
|
|
80
88
|
"country" => {
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"code" => "POL"
|
|
89
|
+
"name" => "United States",
|
|
90
|
+
"code" => "USA"
|
|
84
91
|
},
|
|
85
92
|
"region" => {
|
|
86
|
-
"city" => "
|
|
93
|
+
"city" => "Los Angeles"
|
|
87
94
|
}
|
|
88
95
|
},
|
|
89
96
|
# ...
|
|
@@ -91,6 +98,24 @@ FlightRadar.airport(airport)
|
|
|
91
98
|
}
|
|
92
99
|
```
|
|
93
100
|
|
|
101
|
+
### Airports
|
|
102
|
+
|
|
103
|
+
Get a list of all airports.
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
FlightRadar.airports
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Sample response:**
|
|
110
|
+
|
|
111
|
+
```ruby
|
|
112
|
+
[
|
|
113
|
+
{"name" => "Hartsfield-Jackson Atlanta Intl", "iata" => "ATL", "icao" => "KATL", "lat" => 33.6367, "lon" => -84.4281},
|
|
114
|
+
{"name" => "Los Angeles Intl", "iata" => "LAX", "icao" => "KLAX", "lat" => 33.9425, "lon" => -118.408},
|
|
115
|
+
# ...
|
|
116
|
+
]
|
|
117
|
+
```
|
|
118
|
+
|
|
94
119
|
### Zones
|
|
95
120
|
|
|
96
121
|
```ruby
|
|
@@ -151,6 +176,8 @@ FlightRadar.flights
|
|
|
151
176
|
|
|
152
177
|
### Flight Details
|
|
153
178
|
|
|
179
|
+
Get detailed information about a specific flight.
|
|
180
|
+
|
|
154
181
|
```ruby
|
|
155
182
|
flight_id = FlightRadar.flights.sample.id
|
|
156
183
|
FlightRadar.flight_details(flight_id)
|
|
@@ -191,6 +218,17 @@ FlightRadar.flight_details(flight_id)
|
|
|
191
218
|
}
|
|
192
219
|
```
|
|
193
220
|
|
|
221
|
+
### Flight Playback
|
|
222
|
+
|
|
223
|
+
Get playback data for a specific flight (includes full flight path history).
|
|
224
|
+
|
|
225
|
+
```ruby
|
|
226
|
+
flight_id = FlightRadar.flights.sample.id
|
|
227
|
+
FlightRadar.flight_playback(flight_id)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Note:** This is an alias for `flight_details` and returns the same data structure.
|
|
231
|
+
|
|
194
232
|
### Flights by airline
|
|
195
233
|
|
|
196
234
|
```ruby
|
|
@@ -255,6 +293,8 @@ FlightRadar.airline_logo(iata, icao)
|
|
|
255
293
|
|
|
256
294
|
### Country flag
|
|
257
295
|
|
|
296
|
+
Get the URL of a country flag image.
|
|
297
|
+
|
|
258
298
|
```ruby
|
|
259
299
|
FlightRadar.country_flag("Poland")
|
|
260
300
|
```
|
|
@@ -265,6 +305,100 @@ FlightRadar.country_flag("Poland")
|
|
|
265
305
|
"https://www.flightradar24.com/static/images/data/flags-small/poland.gif"
|
|
266
306
|
```
|
|
267
307
|
|
|
308
|
+
### Search
|
|
309
|
+
|
|
310
|
+
Search for flights, airports, and airlines.
|
|
311
|
+
|
|
312
|
+
```ruby
|
|
313
|
+
FlightRadar.search("LOT", 10)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Sample response:**
|
|
317
|
+
|
|
318
|
+
```ruby
|
|
319
|
+
{
|
|
320
|
+
"results" => [
|
|
321
|
+
{
|
|
322
|
+
"id" => "LOT",
|
|
323
|
+
"label" => "LOT (LOT / LO)",
|
|
324
|
+
"detail" => {
|
|
325
|
+
"operator_id" => 11,
|
|
326
|
+
"iata" => "LO",
|
|
327
|
+
"logo" => "https://cdn.flightradar24.com/assets/airlines/logotypes/11.png"
|
|
328
|
+
},
|
|
329
|
+
"type" => "operator",
|
|
330
|
+
"match" => "icao",
|
|
331
|
+
"name" => "LOT"
|
|
332
|
+
},
|
|
333
|
+
# ...
|
|
334
|
+
],
|
|
335
|
+
"stats" => {
|
|
336
|
+
"total" => {
|
|
337
|
+
"all" => 42,
|
|
338
|
+
"airport" => 12,
|
|
339
|
+
"operator" => 15,
|
|
340
|
+
"live" => 8
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Most Tracked Flights
|
|
347
|
+
|
|
348
|
+
Get the most tracked flights in real-time.
|
|
349
|
+
|
|
350
|
+
```ruby
|
|
351
|
+
FlightRadar.most_tracked
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Sample response:**
|
|
355
|
+
|
|
356
|
+
```ruby
|
|
357
|
+
{
|
|
358
|
+
"data" => [
|
|
359
|
+
{
|
|
360
|
+
"flight_id" => "2abc1234",
|
|
361
|
+
"flight" => "AA100",
|
|
362
|
+
"callsign" => "AAL100",
|
|
363
|
+
"squawk" => "1234",
|
|
364
|
+
"clicks" => 5420,
|
|
365
|
+
# ...
|
|
366
|
+
},
|
|
367
|
+
# ...
|
|
368
|
+
],
|
|
369
|
+
"update_time" => 1700000000,
|
|
370
|
+
"version" => 1
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Aircraft Information
|
|
375
|
+
|
|
376
|
+
Search for aircraft by registration number.
|
|
377
|
+
|
|
378
|
+
```ruby
|
|
379
|
+
FlightRadar.aircraft("N12345")
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Sample response:**
|
|
383
|
+
|
|
384
|
+
Returns search results similar to the `search` method, filtered for aircraft.
|
|
385
|
+
|
|
386
|
+
### Airline Fleet
|
|
387
|
+
|
|
388
|
+
Get fleet information for a specific airline.
|
|
389
|
+
|
|
390
|
+
```ruby
|
|
391
|
+
FlightRadar.airline_fleet("LOT")
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
**Sample response:**
|
|
395
|
+
|
|
396
|
+
Returns search results similar to the `search` method, showing airline and aircraft information.
|
|
397
|
+
|
|
398
|
+
## Documentation
|
|
399
|
+
|
|
400
|
+
Live documentation of the gem is available [at this GitHub page](https://kupolak.github.io/flight_radar/).
|
|
401
|
+
|
|
268
402
|
## Development
|
|
269
403
|
|
|
270
404
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/flight_radar.gemspec
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'lib/flight_radar/version'
|
|
4
|
+
|
|
3
5
|
Gem::Specification.new do |spec|
|
|
4
6
|
spec.name = 'flight_radar'
|
|
5
|
-
spec.version =
|
|
7
|
+
spec.version = FlightRadar::VERSION
|
|
6
8
|
spec.authors = ['Jakub Polak']
|
|
7
9
|
spec.email = ['jakub.polak.vz@gmail.com']
|
|
8
10
|
|
|
9
11
|
spec.summary = 'Ruby gem for fetching aircraft data from Flightradar24'
|
|
10
|
-
spec.description = '
|
|
12
|
+
spec.description = 'Unofficial Ruby wrapper for Flightradar24 API. Fetch real-time flight data, ' \
|
|
13
|
+
'airport statistics, airline information, and more. For terms see: ' \
|
|
14
|
+
'https://www.flightradar24.com/terms-and-conditions'
|
|
11
15
|
spec.homepage = 'https://github.com/kupolak/flight_radar'
|
|
12
16
|
spec.license = 'MIT'
|
|
13
17
|
spec.required_ruby_version = '>= 3.2.0'
|
|
14
18
|
|
|
15
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
16
|
-
spec.metadata['source_code_uri'] =
|
|
17
|
-
spec.metadata['changelog_uri'] =
|
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
22
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
|
23
|
+
spec.metadata['documentation_uri'] = 'https://kupolak.github.io/flight_radar/'
|
|
18
24
|
|
|
19
25
|
# Specify which files should be added to the gem when it is released.
|
|
20
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -25,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
25
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
26
32
|
spec.require_paths = ['lib']
|
|
27
33
|
|
|
28
|
-
spec.add_dependency 'httparty', '
|
|
34
|
+
spec.add_dependency 'httparty', '>= 0.21', '< 0.24'
|
|
29
35
|
|
|
30
36
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
31
37
|
end
|
data/lib/flight_radar/core.rb
CHANGED
|
@@ -17,16 +17,19 @@ module Core
|
|
|
17
17
|
MOST_TRACKED_URL = "#{FLIGHT_RADAR_BASE_URL}/flights/most-tracked".freeze
|
|
18
18
|
|
|
19
19
|
# Search data URL
|
|
20
|
-
SEARCH_DATA_URL = "#{FLIGHT_RADAR_BASE_URL}/v1/search/web/find
|
|
20
|
+
SEARCH_DATA_URL = "#{FLIGHT_RADAR_BASE_URL}/v1/search/web/find".freeze
|
|
21
21
|
|
|
22
22
|
# Flights data URLs.
|
|
23
23
|
REAL_TIME_FLIGHT_TRACKER_DATA_URL = "#{DATA_CLOUD_BASE_URL}/zones/fcgi/feed.js".freeze
|
|
24
24
|
FLIGHT_DATA_URL = "#{DATA_LIVE_BASE_URL}/clickhandler/?flight={}".freeze
|
|
25
|
+
FLIGHT_PLAYBACK_URL = "#{DATA_LIVE_BASE_URL}/clickhandler/".freeze
|
|
25
26
|
|
|
26
27
|
# Airports data URLs.
|
|
27
28
|
API_AIRPORT_DATA_URL = "#{API_FLIGHT_RADAR_BASE_URL}/airport.json".freeze
|
|
28
29
|
AIRPORT_DATA_URL = "#{FLIGHT_RADAR_BASE_URL}/airports/traffic-stats/?airport=".freeze
|
|
29
30
|
AIRPORTS_DATA_URL = "#{FLIGHT_RADAR_BASE_URL}/_json/airports.php".freeze
|
|
31
|
+
AIRPORT_ARRIVALS_URL = "#{FLIGHT_RADAR_BASE_URL}/data/airports/".freeze
|
|
32
|
+
AIRPORT_DEPARTURES_URL = "#{FLIGHT_RADAR_BASE_URL}/data/airports/".freeze
|
|
30
33
|
|
|
31
34
|
# Airlines data URL.
|
|
32
35
|
AIRLINES_DATA_URL = "#{FLIGHT_RADAR_BASE_URL}/_json/airlines.php".freeze
|
|
@@ -41,7 +44,6 @@ module Core
|
|
|
41
44
|
AIRLINE_LOGO_URL = "#{CDN_FLIGHT_RADAR_BASE_URL}/assets/airlines/logotypes/".freeze
|
|
42
45
|
ALTERNATIVE_AIRLINE_LOGO_URL = "#{FLIGHT_RADAR_BASE_URL}/static/images/data/operators/".freeze
|
|
43
46
|
|
|
44
|
-
# rubocop:disable Style/MutableConstant
|
|
45
47
|
HEADERS = {
|
|
46
48
|
'accept-encoding': 'gzip, br',
|
|
47
49
|
'accept-language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
|
|
@@ -54,12 +56,9 @@ module Core
|
|
|
54
56
|
'user-agent': 'Mozilla/5.0 (Windows NT 6.1)
|
|
55
57
|
AppleWebKit/537.36 (KHTML, like Gecko)
|
|
56
58
|
Chrome/87.0.4280.88 Safari/537.36'
|
|
57
|
-
}
|
|
58
|
-
# rubocop:enable Style/MutableConstant
|
|
59
|
+
}.freeze
|
|
59
60
|
|
|
60
|
-
JSON_HEADERS = HEADERS
|
|
61
|
-
JSON_HEADERS['accept'] = 'application/json'
|
|
61
|
+
JSON_HEADERS = HEADERS.merge('accept' => 'application/json').freeze
|
|
62
62
|
|
|
63
|
-
IMAGE_HEADERS = HEADERS
|
|
64
|
-
IMAGE_HEADERS['accept'] = 'image/gif, image/jpg, image/jpeg, image/png'
|
|
63
|
+
IMAGE_HEADERS = HEADERS.merge('accept' => 'image/gif, image/jpg, image/jpeg, image/png').freeze
|
|
65
64
|
end
|
data/lib/flight_radar/flight.rb
CHANGED
|
@@ -9,6 +9,12 @@ class Flight
|
|
|
9
9
|
# Accessor for the flight ID.
|
|
10
10
|
attr_accessor :id
|
|
11
11
|
|
|
12
|
+
# Read-only accessors for flight attributes.
|
|
13
|
+
attr_reader :icao_24bit, :latitude, :longitude,
|
|
14
|
+
:squawk, :aircraft_code, :registration, :time, :origin_airport_iata,
|
|
15
|
+
:destination_airport_iata, :number, :airline_iata, :on_ground,
|
|
16
|
+
:callsign, :airline_icao
|
|
17
|
+
|
|
12
18
|
# Initializes a new instance of the `Flight` class with the given flight ID and information.
|
|
13
19
|
#
|
|
14
20
|
# @param flight_id [String] The unique identifier for the flight.
|
|
@@ -31,7 +37,7 @@ class Flight
|
|
|
31
37
|
@origin_airport_iata = get_info(info[11])
|
|
32
38
|
@destination_airport_iata = get_info(info[12])
|
|
33
39
|
@number = get_info(info[13])
|
|
34
|
-
@airline_iata =
|
|
40
|
+
@airline_iata = @number != DEFAULT_TEXT && @number.length >= 2 ? @number[0..1] : DEFAULT_TEXT
|
|
35
41
|
@on_ground = get_info(info[14])
|
|
36
42
|
@vertical_speed = get_info(info[15])
|
|
37
43
|
@callsign = get_info(info[16])
|
|
@@ -46,7 +52,7 @@ class Flight
|
|
|
46
52
|
"<(#{@aircraft_code}) #{@registration}
|
|
47
53
|
- Altitude: #{@altitude}
|
|
48
54
|
- Ground Speed: #{@ground_speed}
|
|
49
|
-
- Heading: #{@
|
|
55
|
+
- Heading: #{@heading}>"
|
|
50
56
|
end
|
|
51
57
|
|
|
52
58
|
# Returns a formatted string representing the altitude of the flight.
|
|
@@ -60,15 +66,20 @@ class Flight
|
|
|
60
66
|
#
|
|
61
67
|
# @return [String] Formatted flight level string (e.g., "FL350").
|
|
62
68
|
def flight_level
|
|
63
|
-
@altitude
|
|
69
|
+
return altitude if @altitude == DEFAULT_TEXT || @altitude.to_i <= 10_000
|
|
70
|
+
|
|
71
|
+
"FL#{(@altitude.to_i / 100).to_s.rjust(3, '0')}"
|
|
64
72
|
end
|
|
65
73
|
|
|
66
74
|
# Returns a formatted string representing the ground speed of the flight.
|
|
67
75
|
#
|
|
68
76
|
# @return [String] Formatted ground speed string (e.g., "300 kts").
|
|
69
77
|
def ground_speed
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
return "#{@ground_speed} kt" if @ground_speed == DEFAULT_TEXT
|
|
79
|
+
|
|
80
|
+
speed_value = @ground_speed.to_i
|
|
81
|
+
speed = "#{speed_value} kt"
|
|
82
|
+
speed += 's' if speed_value > 1
|
|
72
83
|
speed
|
|
73
84
|
end
|
|
74
85
|
|
data/lib/flight_radar.rb
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'flight_radar/version'
|
|
3
4
|
require_relative 'flight_radar/core'
|
|
4
5
|
require_relative 'flight_radar/request'
|
|
5
6
|
require_relative 'flight_radar/flight'
|
|
6
7
|
|
|
7
8
|
# FlightRadar module for sending requests to FlightRadar24 API
|
|
8
9
|
module FlightRadar
|
|
9
|
-
VERSION = '0.2.1'
|
|
10
|
-
|
|
11
10
|
module_function
|
|
12
11
|
|
|
13
12
|
# Default configuration parameters for FlightRadar requests.
|
|
@@ -58,7 +57,9 @@ module FlightRadar
|
|
|
58
57
|
# @param code [String] The code of the airport.
|
|
59
58
|
# @return [Hash] A hash containing traffic statistics for the specified airport.
|
|
60
59
|
def airport(code)
|
|
61
|
-
|
|
60
|
+
url = "#{Core::DATA_LIVE_BASE_URL}/airports/traffic-stats/?airport=#{code}"
|
|
61
|
+
request = Request.new(url, Core::JSON_HEADERS)
|
|
62
|
+
request.content
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
# Retrieves a list of airports.
|
|
@@ -114,8 +115,51 @@ module FlightRadar
|
|
|
114
115
|
# @return [Hash] A hash containing information about flight tracking zones.
|
|
115
116
|
def zones
|
|
116
117
|
request = Request.new(Core::ZONES_DATA_URL, Core::JSON_HEADERS)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
content = request.content
|
|
119
|
+
content.delete('version')
|
|
120
|
+
content
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Searches for flights, airports, and airlines.
|
|
124
|
+
#
|
|
125
|
+
# @param query [String] The search query (e.g., flight number, airport code, airline name).
|
|
126
|
+
# @param limit [Integer] (optional) Maximum number of results to return (default: 50).
|
|
127
|
+
# @return [Hash] A hash containing search results grouped by type.
|
|
128
|
+
def search(query, limit = 50)
|
|
129
|
+
url = "#{Core::SEARCH_DATA_URL}?query=#{query}&limit=#{limit}"
|
|
130
|
+
request = Request.new(url, Core::JSON_HEADERS)
|
|
131
|
+
request.content
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Retrieves a list of the most tracked flights.
|
|
135
|
+
#
|
|
136
|
+
# @return [Hash] A hash containing information about the most tracked flights.
|
|
137
|
+
def most_tracked
|
|
138
|
+
request = Request.new(Core::MOST_TRACKED_URL, Core::JSON_HEADERS)
|
|
139
|
+
request.content
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Retrieves playback data for a specific flight (alias for flight_details with version parameter).
|
|
143
|
+
#
|
|
144
|
+
# @param flight_id [String] The ID of the flight.
|
|
145
|
+
# @return [Hash] A hash containing detailed playback information including flight path.
|
|
146
|
+
def flight_playback(flight_id)
|
|
147
|
+
flight_details(flight_id)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Retrieves information about a specific aircraft by registration number.
|
|
151
|
+
#
|
|
152
|
+
# @param registration [String] The aircraft registration number (e.g., "N12345").
|
|
153
|
+
# @return [Hash] A hash containing search results for the aircraft.
|
|
154
|
+
def aircraft(registration)
|
|
155
|
+
search(registration)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Retrieves fleet information for a specific airline.
|
|
159
|
+
#
|
|
160
|
+
# @param airline_code [String] The airline code (IATA or ICAO).
|
|
161
|
+
# @return [Hash] A hash containing information about the airline's fleet.
|
|
162
|
+
def airline_fleet(airline_code)
|
|
163
|
+
search(airline_code)
|
|
120
164
|
end
|
|
121
165
|
end
|
metadata
CHANGED
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flight_radar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakub Polak
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.21
|
|
19
|
+
version: '0.21'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '0.24'
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0.21'
|
|
30
|
+
- - "<"
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
27
|
-
description: '
|
|
32
|
+
version: '0.24'
|
|
33
|
+
description: 'Unofficial Ruby wrapper for Flightradar24 API. Fetch real-time flight
|
|
34
|
+
data, airport statistics, airline information, and more. For terms see: https://www.flightradar24.com/terms-and-conditions'
|
|
28
35
|
email:
|
|
29
36
|
- jakub.polak.vz@gmail.com
|
|
30
37
|
executables: []
|
|
31
38
|
extensions: []
|
|
32
39
|
extra_rdoc_files: []
|
|
33
40
|
files:
|
|
41
|
+
- ".github/dependabot.yml"
|
|
34
42
|
- ".github/workflows/ruby.yml"
|
|
35
43
|
- ".gitignore"
|
|
36
44
|
- ".rspec"
|
|
@@ -47,6 +55,7 @@ files:
|
|
|
47
55
|
- lib/flight_radar/core.rb
|
|
48
56
|
- lib/flight_radar/flight.rb
|
|
49
57
|
- lib/flight_radar/request.rb
|
|
58
|
+
- lib/flight_radar/version.rb
|
|
50
59
|
homepage: https://github.com/kupolak/flight_radar
|
|
51
60
|
licenses:
|
|
52
61
|
- MIT
|
|
@@ -54,6 +63,8 @@ metadata:
|
|
|
54
63
|
homepage_uri: https://github.com/kupolak/flight_radar
|
|
55
64
|
source_code_uri: https://github.com/kupolak/flight_radar
|
|
56
65
|
changelog_uri: https://github.com/kupolak/flight_radar/blob/main/CHANGELOG.md
|
|
66
|
+
bug_tracker_uri: https://github.com/kupolak/flight_radar/issues
|
|
67
|
+
documentation_uri: https://kupolak.github.io/flight_radar/
|
|
57
68
|
rubygems_mfa_required: 'true'
|
|
58
69
|
post_install_message:
|
|
59
70
|
rdoc_options: []
|
|
@@ -70,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
70
81
|
- !ruby/object:Gem::Version
|
|
71
82
|
version: '0'
|
|
72
83
|
requirements: []
|
|
73
|
-
rubygems_version: 3.
|
|
84
|
+
rubygems_version: 3.5.22
|
|
74
85
|
signing_key:
|
|
75
86
|
specification_version: 4
|
|
76
87
|
summary: Ruby gem for fetching aircraft data from Flightradar24
|