raad-apra 0.1.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 +7 -0
- data/CHANGELOG.md +15 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/lib/faa_apra/service.rb +299 -0
- data/lib/faa_apra/version.rb +5 -0
- data/lib/faa_apra.rb +21 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b6bc8136e517bfb9132aa7ff6c43ba074e35a3f38d5044e63c251c29fc0a5760
|
4
|
+
data.tar.gz: 1e72ce417acfc322366ff2c8462d96ad16b83841ca76bfa87521cc66fe997398
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c40dc26fad970cc0b5c405eb42f9bab99983361ff8d98133a7a94049164bd762c671a44961d509afe781d76ca8780eb41cd5f3daf56acb450faab3a14b59a70c
|
7
|
+
data.tar.gz: 55b33aa916533fdaa11d483b7f5bd32fa627095c9bbc754b2c6c9cd1032381a47c04907808b306ced23a7940f8cecb4e50d35dedc25d385cfce54fb98de1fbbf
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.1.0] - 2025-05-01
|
4
|
+
|
5
|
+
- Initial release of the FaaApra gem
|
6
|
+
- Added support for all APRA API endpoints:
|
7
|
+
- Coded Instrument Flight Procedures (CIFP)
|
8
|
+
- Daily Digital Obstacle File (DDOF)
|
9
|
+
- Digital Enroute Charts (DEC)
|
10
|
+
- Terminal Procedures Publication (TPP)
|
11
|
+
- Sectional Charts
|
12
|
+
- Grand Canyon VFR Charts
|
13
|
+
- IFR Enroute Charts
|
14
|
+
- Added validation for API parameters
|
15
|
+
- Set up basic documentation
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Your Name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# FaaApra
|
2
|
+
|
3
|
+
A Ruby gem for interacting with the FAA's Aeronautical Products Release API (APRA).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'faa_apra'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ gem install faa_apra
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
First, obtain your API credentials from the [FAA External API Portal](https://external-api.faa.gov/).
|
28
|
+
|
29
|
+
### Basic Usage
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'faa_apra'
|
33
|
+
|
34
|
+
# Initialize with client credentials
|
35
|
+
client = FaaApra.new(
|
36
|
+
'your_client_id',
|
37
|
+
'your_client_secret'
|
38
|
+
)
|
39
|
+
|
40
|
+
# Or use environment variables
|
41
|
+
# export FAA_APRA_CLIENT_ID=your_client_id
|
42
|
+
# export FAA_APRA_CLIENT_SECRET=your_client_secret
|
43
|
+
client = FaaApra.new
|
44
|
+
|
45
|
+
# Get Coded Instrument Flight Procedures (CIFP)
|
46
|
+
cifp_data = client.cifp_chart
|
47
|
+
cifp_info = client.cifp_info(edition: 'current')
|
48
|
+
|
49
|
+
# Get Terminal Procedure Publication (TPP) chart
|
50
|
+
tpp_data = client.dtpp_chart(
|
51
|
+
edition: 'current',
|
52
|
+
area: 'US',
|
53
|
+
format: 'all'
|
54
|
+
)
|
55
|
+
|
56
|
+
# Get Sectional Chart data
|
57
|
+
chart_data = client.sectional_chart(
|
58
|
+
edition: 'current',
|
59
|
+
geoname: 'NEW_YORK',
|
60
|
+
format: 'pdf'
|
61
|
+
)
|
62
|
+
|
63
|
+
# Get IFR Enroute Chart data
|
64
|
+
ifr_data = client.ifr_enroute_chart(
|
65
|
+
edition: 'current',
|
66
|
+
altitude: 'high',
|
67
|
+
format: 'pdf'
|
68
|
+
)
|
69
|
+
```
|
70
|
+
|
71
|
+
### Available Endpoints
|
72
|
+
|
73
|
+
The gem provides access to the following FAA APRA API endpoints:
|
74
|
+
|
75
|
+
#### Coded Instrument Flight Procedures (CIFP)
|
76
|
+
- `cifp_chart(edition: 'current')` - Get CIFP chart download link
|
77
|
+
- `cifp_info(edition: 'current')` - Get CIFP edition information
|
78
|
+
|
79
|
+
#### Daily Digital Obstacle File (DDOF)
|
80
|
+
- `ddof_chart` - Get DDOF download link
|
81
|
+
- `ddof_info` - Get DDOF edition information
|
82
|
+
|
83
|
+
#### Digital Enroute Charts (DEC)
|
84
|
+
- `dec_chart(edition: 'current')` - Get DEC chart download link
|
85
|
+
- `dec_info(edition: 'current')` - Get DEC edition information
|
86
|
+
|
87
|
+
#### Terminal Procedures Publication (TPP)
|
88
|
+
- `dtpp_chart(edition: 'current', area: 'US', format: 'all')` - Get TPP chart download link
|
89
|
+
- `dtpp_info(edition: 'current', area: 'US')` - Get TPP edition information
|
90
|
+
|
91
|
+
#### Sectional Charts
|
92
|
+
- `sectional_chart(edition: 'current', geoname: nil, format: 'pdf')` - Get Sectional Chart download link
|
93
|
+
- `sectional_info(edition: 'current', geoname: nil, format: 'pdf')` - Get Sectional Chart edition information
|
94
|
+
|
95
|
+
#### Grand Canyon VFR Charts
|
96
|
+
- `grand_canyon_chart(edition: 'current', format: 'pdf')` - Get Grand Canyon VFR Chart download link
|
97
|
+
- `grand_canyon_info(edition: 'current', format: 'pdf')` - Get Grand Canyon VFR Chart edition information
|
98
|
+
|
99
|
+
#### IFR Enroute Charts
|
100
|
+
- `ifr_enroute_chart(edition: 'current', geoname: nil, altitude:, format: 'pdf')` - Get IFR Enroute Chart download link
|
101
|
+
- `ifr_enroute_info(edition: 'current', geoname: nil, altitude:, format: 'pdf')` - Get IFR Enroute Chart edition information
|
102
|
+
|
103
|
+
## Development
|
104
|
+
|
105
|
+
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.
|
106
|
+
|
107
|
+
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).
|
108
|
+
|
109
|
+
## Contributing
|
110
|
+
|
111
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/faa_apra. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/yourusername/faa_apra/blob/main/CODE_OF_CONDUCT.md).
|
112
|
+
|
113
|
+
## License
|
114
|
+
|
115
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
116
|
+
|
117
|
+
## Code of Conduct
|
118
|
+
|
119
|
+
Everyone interacting in the FaaApra project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yourusername/faa_apra/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,299 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module FaaApra
|
8
|
+
# Service to interact with FAA's Aeronautic Product Release API (APRA)
|
9
|
+
# https://external-api.faa.gov/apra
|
10
|
+
#
|
11
|
+
# This service provides access to FAA aeronautical chart publication download endpoints
|
12
|
+
# including Coded Instrument Flight Procedures, Digital Enroute Charts, Terminal Procedures, and more.
|
13
|
+
class Service
|
14
|
+
BASE_URL = "https://external-api.faa.gov/apra"
|
15
|
+
|
16
|
+
attr_reader :client_id, :client_secret
|
17
|
+
|
18
|
+
# Initialize the service with FAA API credentials
|
19
|
+
# @param client_id [String] FAA API client ID
|
20
|
+
# @param client_secret [String] FAA API client secret
|
21
|
+
def initialize(client_id = nil, client_secret = nil)
|
22
|
+
@client_id = client_id || ENV['FAA_APRA_CLIENT_ID']
|
23
|
+
@client_secret = client_secret || ENV['FAA_APRA_CLIENT_SECRET']
|
24
|
+
|
25
|
+
raise ArgumentError, "FAA APRA client_id is required" unless @client_id
|
26
|
+
raise ArgumentError, "FAA APRA client_secret is required" unless @client_secret
|
27
|
+
end
|
28
|
+
|
29
|
+
# =========================================================================
|
30
|
+
# Coded Instrument Flight Procedures (CIFP)
|
31
|
+
# =========================================================================
|
32
|
+
|
33
|
+
# Get CIFP chart download link
|
34
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
35
|
+
# @return [Hash] CIFP release data
|
36
|
+
def cifp_chart(edition: 'current')
|
37
|
+
validate_edition(edition)
|
38
|
+
get("/cifp/chart", { edition: edition })
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get CIFP edition date and edition number
|
42
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
43
|
+
# @return [Hash] CIFP edition information
|
44
|
+
def cifp_info(edition: 'current')
|
45
|
+
validate_edition(edition)
|
46
|
+
get("/cifp/info", { edition: edition })
|
47
|
+
end
|
48
|
+
|
49
|
+
# =========================================================================
|
50
|
+
# Daily Digital Obstacle File (DDOF)
|
51
|
+
# =========================================================================
|
52
|
+
|
53
|
+
# Get Daily Digital Obstacle File download link
|
54
|
+
# @return [Hash] DDOF release data
|
55
|
+
def ddof_chart
|
56
|
+
get("/ddof/chart")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get Daily Digital Obstacle File edition information
|
60
|
+
# @return [Hash] DDOF edition information
|
61
|
+
def ddof_info
|
62
|
+
get("/ddof/info")
|
63
|
+
end
|
64
|
+
|
65
|
+
# =========================================================================
|
66
|
+
# Digital Enroute Charts US (DDECUS)
|
67
|
+
# =========================================================================
|
68
|
+
|
69
|
+
# Get Digital Enroute Chart download link
|
70
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
71
|
+
# @return [Hash] DEC release data
|
72
|
+
def dec_chart(edition: 'current')
|
73
|
+
validate_edition(edition)
|
74
|
+
get("/dec/chart", { edition: edition })
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get DEC edition date and edition number
|
78
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
79
|
+
# @return [Hash] DEC edition information
|
80
|
+
def dec_info(edition: 'current')
|
81
|
+
validate_edition(edition)
|
82
|
+
get("/dec/info", { edition: edition })
|
83
|
+
end
|
84
|
+
|
85
|
+
# =========================================================================
|
86
|
+
# US Terminal Procedures Publication (TPP)
|
87
|
+
# =========================================================================
|
88
|
+
|
89
|
+
# Get Terminal Procedure Publication chart download information
|
90
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
91
|
+
# @param area [String] geographic area, 'US' or state name (default: 'US')
|
92
|
+
# @param format [String] 'all', 'changes', or 'xml' format (default: 'all')
|
93
|
+
# @return [Hash] TPP release data
|
94
|
+
def dtpp_chart(edition: 'current', area: 'US', format: 'all')
|
95
|
+
validate_edition(edition)
|
96
|
+
validate_format(format, %w[all changes xml])
|
97
|
+
|
98
|
+
get("/dtpp/chart", {
|
99
|
+
edition: edition,
|
100
|
+
area: area,
|
101
|
+
format: format
|
102
|
+
})
|
103
|
+
end
|
104
|
+
|
105
|
+
# Get Terminal Procedure Publication chart edition information
|
106
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
107
|
+
# @param area [String] geographic area, 'US' or state name (default: 'US')
|
108
|
+
# @return [Hash] TPP edition information
|
109
|
+
def dtpp_info(edition: 'current', area: 'US')
|
110
|
+
validate_edition(edition)
|
111
|
+
|
112
|
+
get("/dtpp/info", {
|
113
|
+
edition: edition,
|
114
|
+
area: area
|
115
|
+
})
|
116
|
+
end
|
117
|
+
|
118
|
+
# =========================================================================
|
119
|
+
# Sectional Charts
|
120
|
+
# =========================================================================
|
121
|
+
|
122
|
+
# Get Sectional Chart download link
|
123
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
124
|
+
# @param geoname [String] geographic name of the sectional chart
|
125
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
126
|
+
# @return [Hash] Sectional Chart release data
|
127
|
+
def sectional_chart(edition: 'current', geoname: nil, format: 'pdf')
|
128
|
+
validate_edition(edition)
|
129
|
+
validate_format(format, %w[tiff pdf])
|
130
|
+
|
131
|
+
params = { edition: edition, format: format }
|
132
|
+
params[:geoname] = geoname if geoname
|
133
|
+
|
134
|
+
get("/sectional/chart", params)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Get Sectional Chart edition information
|
138
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
139
|
+
# @param geoname [String] geographic name of the sectional chart
|
140
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
141
|
+
# @return [Hash] Sectional Chart edition information
|
142
|
+
def sectional_info(edition: 'current', geoname: nil, format: 'pdf')
|
143
|
+
validate_edition(edition)
|
144
|
+
validate_format(format, %w[tiff pdf])
|
145
|
+
|
146
|
+
params = { edition: edition, format: format }
|
147
|
+
params[:geoname] = geoname if geoname
|
148
|
+
|
149
|
+
get("/sectional/info", params)
|
150
|
+
end
|
151
|
+
|
152
|
+
# =========================================================================
|
153
|
+
# Grand Canyon VFR Charts
|
154
|
+
# =========================================================================
|
155
|
+
|
156
|
+
# Get Grand Canyon VFR Chart download link
|
157
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
158
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
159
|
+
# @return [Hash] Grand Canyon VFR Chart release data
|
160
|
+
def grand_canyon_chart(edition: 'current', format: 'pdf')
|
161
|
+
validate_edition(edition)
|
162
|
+
validate_format(format, %w[tiff pdf])
|
163
|
+
|
164
|
+
get("/grandcanyon/chart", { edition: edition, format: format })
|
165
|
+
end
|
166
|
+
|
167
|
+
# Get Grand Canyon VFR Chart edition information
|
168
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
169
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
170
|
+
# @return [Hash] Grand Canyon VFR Chart edition information
|
171
|
+
def grand_canyon_info(edition: 'current', format: 'pdf')
|
172
|
+
validate_edition(edition)
|
173
|
+
validate_format(format, %w[tiff pdf])
|
174
|
+
|
175
|
+
get("/grandcanyon/info", { edition: edition, format: format })
|
176
|
+
end
|
177
|
+
|
178
|
+
# =========================================================================
|
179
|
+
# IFR Enroute Charts
|
180
|
+
# =========================================================================
|
181
|
+
|
182
|
+
# Get IFR Enroute Chart download link
|
183
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
184
|
+
# @param geoname [String] geographic name of the chart
|
185
|
+
# @param altitude [String] 'high' or 'low' altitude (required)
|
186
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
187
|
+
# @return [Hash] IFR Enroute Chart release data
|
188
|
+
def ifr_enroute_chart(edition: 'current', geoname: nil, altitude:, format: 'pdf')
|
189
|
+
validate_edition(edition)
|
190
|
+
validate_altitude(altitude)
|
191
|
+
validate_format(format, %w[tiff pdf])
|
192
|
+
|
193
|
+
params = {
|
194
|
+
edition: edition,
|
195
|
+
altitude: altitude.downcase,
|
196
|
+
format: format
|
197
|
+
}
|
198
|
+
params[:geoname] = geoname if geoname
|
199
|
+
|
200
|
+
get("/ifr/enroute/chart", params)
|
201
|
+
end
|
202
|
+
|
203
|
+
# Get IFR Enroute Chart edition information
|
204
|
+
# @param edition [String] 'current' or 'next' edition (default: 'current')
|
205
|
+
# @param geoname [String] geographic name of the chart
|
206
|
+
# @param altitude [String] 'high' or 'low' altitude (required)
|
207
|
+
# @param format [String] 'tiff' or 'pdf' format (default: 'pdf')
|
208
|
+
# @return [Hash] IFR Enroute Chart edition information
|
209
|
+
def ifr_enroute_info(edition: 'current', geoname: nil, altitude:, format: 'pdf')
|
210
|
+
validate_edition(edition)
|
211
|
+
validate_altitude(altitude)
|
212
|
+
validate_format(format, %w[tiff pdf])
|
213
|
+
|
214
|
+
params = {
|
215
|
+
edition: edition,
|
216
|
+
altitude: altitude.downcase,
|
217
|
+
format: format
|
218
|
+
}
|
219
|
+
params[:geoname] = geoname if geoname
|
220
|
+
|
221
|
+
get("/ifr/enroute/info", params)
|
222
|
+
end
|
223
|
+
|
224
|
+
# =========================================================================
|
225
|
+
# Helper Methods
|
226
|
+
# =========================================================================
|
227
|
+
|
228
|
+
private
|
229
|
+
|
230
|
+
# Make a GET request to the APRA API
|
231
|
+
# @param path [String] API endpoint path
|
232
|
+
# @param params [Hash] Query parameters
|
233
|
+
# @return [Hash] Parsed JSON response
|
234
|
+
def get(path, params = {})
|
235
|
+
uri = URI.parse("#{BASE_URL}#{path}")
|
236
|
+
uri.query = URI.encode_www_form(params) if params.any?
|
237
|
+
|
238
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
239
|
+
http.use_ssl = true
|
240
|
+
|
241
|
+
request = Net::HTTP::Get.new(uri)
|
242
|
+
request['client_id'] = @client_id
|
243
|
+
request['client_secret'] = @client_secret
|
244
|
+
request['Accept'] = 'application/json'
|
245
|
+
|
246
|
+
response = http.request(request)
|
247
|
+
handle_response(response)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Handle API response
|
251
|
+
# @param response [Net::HTTPResponse] HTTP response from the API
|
252
|
+
# @return [Hash] Parsed JSON response
|
253
|
+
# @raise [RuntimeError] If the response is not successful
|
254
|
+
def handle_response(response)
|
255
|
+
case response.code.to_i
|
256
|
+
when 200
|
257
|
+
JSON.parse(response.body)
|
258
|
+
when 400
|
259
|
+
raise "Bad request: #{response.body}"
|
260
|
+
when 401
|
261
|
+
raise "Unauthorized: Invalid API credentials"
|
262
|
+
when 404
|
263
|
+
raise "Not found: Requested resource not available"
|
264
|
+
when 500
|
265
|
+
raise "Internal server error: #{response.body}"
|
266
|
+
else
|
267
|
+
raise "Unexpected response (#{response.code}): #{response.body}"
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# Validate edition parameter
|
272
|
+
# @param edition [String] Edition value to validate
|
273
|
+
# @raise [ArgumentError] If edition is not valid
|
274
|
+
def validate_edition(edition)
|
275
|
+
unless ['current', 'next'].include?(edition.to_s.downcase)
|
276
|
+
raise ArgumentError, "Invalid edition. Must be 'current' or 'next'"
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
# Validate format parameter
|
281
|
+
# @param format [String] Format value to validate
|
282
|
+
# @param allowed_values [Array<String>] Allowed format values
|
283
|
+
# @raise [ArgumentError] If format is not valid
|
284
|
+
def validate_format(format, allowed_values)
|
285
|
+
unless allowed_values.include?(format.to_s.downcase)
|
286
|
+
raise ArgumentError, "Invalid format. Must be one of: #{allowed_values.join(', ')}"
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# Validate altitude parameter
|
291
|
+
# @param altitude [String] Altitude value to validate
|
292
|
+
# @raise [ArgumentError] If altitude is not valid
|
293
|
+
def validate_altitude(altitude)
|
294
|
+
unless ['high', 'low'].include?(altitude.to_s.downcase)
|
295
|
+
raise ArgumentError, "Invalid altitude. Must be 'high' or 'low'"
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
data/lib/faa_apra.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "faa_apra/version"
|
4
|
+
require_relative "faa_apra/service"
|
5
|
+
|
6
|
+
# FaaApra - Ruby gem to interact with FAA's Aeronautic Product Release API (APRA)
|
7
|
+
# https://external-api.faa.gov/apra
|
8
|
+
#
|
9
|
+
# This gem provides access to FAA aeronautical chart publication download endpoints
|
10
|
+
# including Coded Instrument Flight Procedures, Digital Enroute Charts, Terminal Procedures, and more.
|
11
|
+
module FaaApra
|
12
|
+
class Error < StandardError; end
|
13
|
+
|
14
|
+
# Convenience method to create a new service instance
|
15
|
+
# @param client_id [String] FAA API client ID
|
16
|
+
# @param client_secret [String] FAA API client secret
|
17
|
+
# @return [FaaApra::Service] A new service instance
|
18
|
+
def self.new(client_id = nil, client_secret = nil)
|
19
|
+
Service.new(client_id, client_secret)
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raad-apra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JP Silvashy
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 2025-05-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: bundler
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '2.0'
|
19
|
+
type: :development
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '2.0'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '13.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '13.0'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rspec
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rubocop
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.21'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.21'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: yard
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.9'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.9'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: webmock
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.14'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '3.14'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: vcr
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '6.0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '6.0'
|
110
|
+
description: A Ruby gem to interact with the FAA's APRA API, which provides access
|
111
|
+
to aeronautical chart publications and download endpoints.
|
112
|
+
email:
|
113
|
+
- jp@raad.com
|
114
|
+
- jpsilvashy@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- CHANGELOG.md
|
120
|
+
- LICENSE
|
121
|
+
- README.md
|
122
|
+
- lib/faa_apra.rb
|
123
|
+
- lib/faa_apra/service.rb
|
124
|
+
- lib/faa_apra/version.rb
|
125
|
+
homepage: https://github.com/raad-labs/apra
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata:
|
129
|
+
homepage_uri: https://github.com/raad-labs/apra
|
130
|
+
source_code_uri: https://github.com/raad-labs/apra
|
131
|
+
changelog_uri: https://github.com/raad-labs/apra/blob/main/CHANGELOG.md
|
132
|
+
documentation_uri: https://www.rubydoc.info/gems/raad-apra
|
133
|
+
allowed_push_host: https://rubygems.org
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 2.6.0
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubygems_version: 3.6.3
|
149
|
+
specification_version: 4
|
150
|
+
summary: Ruby wrapper for the FAA Aeronautical Products Release API (APRA)
|
151
|
+
test_files: []
|