FaaAdip
A Ruby gem for interacting with the FAA's Airport Data & Information Portal (ADIP) API.
Installation
Add this line to your application's Gemfile:
gem 'faa_adip'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install faa_adip
Usage
First, obtain your API credentials from the FAA External API Portal.
Basic Usage
require 'faa_adip'
# Initialize with client credentials
client = FaaAdip.new(
'your_client_id',
'your_client_secret'
)
# Or use environment variables
# export FAA_ADIP_CLIENT_ID=your_client_id
# export FAA_ADIP_CLIENT_SECRET=your_client_secret
client = FaaAdip.new
# Search for airports
results = client.search_airports(
state: 'VA',
facility_use: 'PUBLIC',
page_size: 20
)
# Get information for a specific airport
airport = client.get_airport('KIAD')
# Get runway information
runways = client.get_runways('KIAD')
# Get weather information
metar = client.get_metar('KIAD')
taf = client.get_taf('KIAD')
# Find nearby airports
nearby = client.get_nearby_airports('KIAD', 30, facility_use: 'PUBLIC')
Available Search Parameters
The search_airports
method accepts the following parameters:
-
:airport_id
- Airport identifier (e.g., 'KIAD') -
:site_number
- FAA site number -
:loc_id
- Location identifier -
:state
- Two-letter state code -
:city
- City name -
:county
- County name -
:facility_name
- Airport name or partial name -
:facility_use
- 'PUBLIC', 'PRIVATE', or 'MILITARY' -
:latitude
- Latitude coordinate -
:longitude
- Longitude coordinate -
:radius
- Search radius in nautical miles (when used with lat/lon) -
:page_size
- Number of results per page (default: 20, max: 100) -
:page_num
- Page number (default: 1)
Endpoints
The gem provides access to the following endpoints:
Airport Information
-
search_airports(options = {})
- Search for airports using various criteria -
get_airport(airport_id)
- Get detailed information for a specific airport
Runway Data
-
get_runways(airport_id)
- Get runway information for a specific airport -
get_runway(airport_id, runway_id)
- Get detailed information for a specific runway
Weather Data
-
get_metar(airport_id)
- Get METAR (current weather) data for an airport -
get_taf(airport_id)
- Get TAF (forecast) data for an airport
Facility Data
-
get_facilities(airport_id)
- Get facility information for an airport -
get_nearby_airports(airport_id, radius = 20, options = {})
- Find airports near a specific airport
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
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.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/faa_adip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the FaaAdip project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.