FlightXML2RESTDriver 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,202 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+ require_relative './FlightXML2REST.rb'
4
+
5
+ class FlightXML2REST
6
+ DefaultEndpointUrl = "http://flightxml.flightaware.com/json/FlightXML2/"
7
+ attr_accessor :username, :apiKey, :endpoint_url
8
+
9
+ def initialize(username, apiKey, endpoint_url = nil)
10
+ endpoint_url ||= DefaultEndpointUrl
11
+ $api = RestClient::Resource.new(endpoint_url, username, apiKey)
12
+ end
13
+
14
+ #Methods
15
+ def AircraftType(aircraftTypeRequest)
16
+ @aircraftTypeResult = AircraftTypeResults.new($api['AircraftType'].post aircraftTypeRequest.post, :content_type => "application/x-www-form-urlencoded")
17
+ end
18
+
19
+ def AirlineFlightInfo(airlineFlightInfoRequest)
20
+ @airlineFlightInfoResult = AirlineFlightInfoResults.new($api['AirlineFlightInfo'].post airlineFlightInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
21
+ end
22
+
23
+ def AirlineFlightSchedules(airlineFlightSchedulesRequest)
24
+ @airlineFlightSchedulesResult = AirlineFlightSchedulesResults.new($api['AirlineFlightSchedules'].post airlineFlightSchedulesRequest.post, :content_type => "application/x-www-form-urlencoded")
25
+ end
26
+
27
+ def AirlineInfo(airlineInfoRequest)
28
+ @airlineInfoResult = AirlineInfoResults.new($api['AirlineInfo'].post airlineInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
29
+ end
30
+
31
+ def AirlineInsight(airlineInsightRequest)
32
+ @airlineInsightResult = AirlineInsightResults.new($api['AirlineInsight'].post airlineInsightRequest.post, :content_type => "application/x-www-form-urlencoded")
33
+ end
34
+
35
+ def AirportInfo(airportInfoRequest)
36
+ @airportInfoResult = AirportInfoResults.new($api['AirportInfo'].post airportInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
37
+ end
38
+
39
+ def AllAirlines(allAirlinesRequest)
40
+ @allAirlinesResult = AllAirlinesResults.new($api['AllAirlines'].post allAirlinesRequest.post, :content_type => "application/x-www-form-urlencoded")
41
+ end
42
+
43
+ def AllAirports(allAirportsRequest)
44
+ @allAirportsResult = AllAirportsResults.new($api['AllAirports'].post allAirportsRequest.post, :content_type => "application/x-www-form-urlencoded")
45
+ end
46
+
47
+ def Arrived(arrivedRequest)
48
+ @arrivedResult = ArrivedResults.new($api['Arrived'].post arrivedRequest.post, :content_type => "application/x-www-form-urlencoded")
49
+ end
50
+
51
+ def BlockIdentCheck(blockIdentCheckRequest)
52
+ @blockIdentCheckResult = BlockIdentCheckResults.new($api['BlockIdentCheck'].post blockIdentCheckRequest.post, :content_type => "application/x-www-form-urlencoded")
53
+ end
54
+
55
+ def CountAirportOperations(countAirportOperationsRequest)
56
+ @countAirportOperationsResult = CountAirportOperationsResults.new($api['CountAirportOperations'].post countAirportOperationsRequest.post, :content_type => "application/x-www-form-urlencoded")
57
+ end
58
+
59
+ def CountAllEnrouteAirlineOperations(countAllEnrouteAirlineOperationsRequest)
60
+ @countAllEnrouteAirlineOperationsResult = CountAllEnrouteAirlineOperationsResults.new($api['CountAllEnrouteAirlineOperations'].post countAllEnrouteAirlineOperationsRequest.post, :content_type => "application/x-www-form-urlencoded")
61
+ end
62
+
63
+ def DecodeFlightRoute(decodeFlightRouteRequest)
64
+ @decodeFlightRouteResult = DecodeFlightRouteResults.new($api['DecodeFlightRoute'].post decodeFlightRouteRequest.post, :content_type => "application/x-www-form-urlencoded")
65
+ end
66
+
67
+ def DecodeRoute(decodeRouteRequest)
68
+ @decodeRouteResult = DecodeRouteResults.new($api['DecodeRoute'].post decodeRouteRequest.post, :content_type => "application/x-www-form-urlencoded")
69
+ end
70
+
71
+ def DeleteAlert(deleteAlertRequest)
72
+ @deleteAlertResult = DeleteAlertResults.new($api['DeleteAlert'].post deleteAlertRequest.post, :content_type => "application/x-www-form-urlencoded")
73
+ end
74
+
75
+ def Departed(departedRequest)
76
+ @departedResult = DepartedResults.new($api['Departed'].post departedRequest.post, :content_type => "application/x-www-form-urlencoded")
77
+ end
78
+
79
+ def Enroute(enrouteRequest)
80
+ @enrouteResult = EnrouteResults.new($api['Enroute'].post enrouteRequest.post, :content_type => "application/x-www-form-urlencoded")
81
+ end
82
+
83
+ def FleetArrived(fleetArrivedRequest)
84
+ @fleetArrivedResult = FleetArrivedResults.new($api['FleetArrived'].post fleetArrivedRequest.post, :content_type => "application/x-www-form-urlencoded")
85
+ end
86
+
87
+ def FleetScheduled(fleetScheduledRequest)
88
+ @fleetScheduledResult = FleetScheduledResults.new($api['FleetScheduled'].post fleetScheduledRequest.post, :content_type => "application/x-www-form-urlencoded")
89
+ end
90
+
91
+ def FlightInfo(flightInfoRequest)
92
+ @flightInfoResult = FlightInfoResults.new($api['FlightInfo'].post flightInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
93
+ end
94
+
95
+ def FlightInfoEx(flightInfoExRequest)
96
+ @flightInfoExResult = FlightInfoExResults.new($api['FlightInfoEx'].post flightInfoExRequest.post, :content_type => "application/x-www-form-urlencoded")
97
+ end
98
+
99
+ def GetAlerts(getAlertsRequest)
100
+ @getAlertsResult = GetAlertsResults.new($api['GetAlerts'].post getAlertsRequest.post, :content_type => "application/x-www-form-urlencoded")
101
+ end
102
+
103
+ def GetFlightID(getFlightIDRequest)
104
+ @getFlightIDResult = GetFlightIDResults.new($api['GetFlightID'].post getFlightIDRequest.post, :content_type => "application/x-www-form-urlencoded")
105
+ end
106
+
107
+ def GetHistoricalTrack(getHistoricalTrackRequest)
108
+ @getHistoricalTrackResult = GetHistoricalTrackResults.new($api['GetHistoricalTrack'].post getHistoricalTrackRequest.post, :content_type => "application/x-www-form-urlencoded")
109
+ end
110
+
111
+ def GetLastTrack(getLastTrackRequest)
112
+ @getLastTrackResult = GetLastTrackResults.new($api['GetLastTrack'].post getLastTrackRequest.post, :content_type => "application/x-www-form-urlencoded")
113
+ end
114
+
115
+ def InboundFlightInfo(inboundFlightInfoRequest)
116
+ @inboundFlightInfoResult = InboundFlightInfoResults.new($api['InboundFlightInfo'].post inboundFlightInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
117
+ end
118
+
119
+ def InFlightInfo(inFlightInfoRequest)
120
+ @inFlightInfoResult = InFlightInfoResults.new($api['InFlightInfo'].post inFlightInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
121
+ end
122
+
123
+ def LatLongsToDistance(latLongsToDistanceRequest)
124
+ @latLongsToDistanceResult = LatLongsToDistanceResults.new($api['LatLongsToDistance'].post latLongsToDistanceRequest.post, :content_type => "application/x-www-form-urlencoded")
125
+ end
126
+
127
+ def LatLongsToHeading(latLongsToHeadingRequest)
128
+ @latLongsToHeadingResult = LatLongsToHeadingResults.new($api['LatLongsToHeading'].post latLongsToHeadingRequest.post, :content_type => "application/x-www-form-urlencoded")
129
+ end
130
+
131
+ def MapFlight(mapFlightRequest)
132
+ @mapFlightResult = MapFlightResults.new($api['MapFlight'].post mapFlightRequest.post, :content_type => "application/x-www-form-urlencoded")
133
+ end
134
+
135
+ def MapFlightEx(mapFlightExRequest)
136
+ @mapFlightExResult = MapFlightExResults.new($api['MapFlightEx'].post mapFlightExRequest.post, :content_type => "application/x-www-form-urlencoded")
137
+ end
138
+
139
+ def Metar(metarRequest)
140
+ @metarResult = MetarResults.new($api['Metar'].post metarRequest.post, :content_type => "application/x-www-form-urlencoded")
141
+ end
142
+
143
+ def MetarEx(metarExRequest)
144
+ @metarExResult = MetarExResults.new($api['MetarEx'].post metarExRequest.post, :content_type => "application/x-www-form-urlencoded")
145
+ end
146
+
147
+ def NTaf(nTafRequest)
148
+ @nTafResult = NTafResults.new($api['NTaf'].post nTafRequest.post, :content_type => "application/x-www-form-urlencoded")
149
+ end
150
+
151
+ def RegisterAlertEndpoint(registerAlertEndpointRequest)
152
+ @registerAlertEndpointResult = RegisterAlertEndpointResults.new($api['RegisterAlertEndpoint'].post registerAlertEndpointRequest.post, :content_type => "application/x-www-form-urlencoded")
153
+ end
154
+
155
+ def RoutesBetweenAirports(routesBetweenAirportsRequest)
156
+ @routesBetweenAirportsResult = RoutesBetweenAirportsResults.new($api['RoutesBetweenAirports'].post routesBetweenAirportsRequest.post, :content_type => "application/x-www-form-urlencoded")
157
+ end
158
+
159
+ def RoutesBetweenAirportsEx(routesBetweenAirportsExRequest)
160
+ @routesBetweenAirportsExResult = RoutesBetweenAirportsExResults.new($api['RoutesBetweenAirportsEx'].post routesBetweenAirportsExRequest.post, :content_type => "application/x-www-form-urlencoded")
161
+ end
162
+
163
+ def Scheduled(scheduledRequest)
164
+ @scheduledResult = ScheduledResults.new($api['Scheduled'].post scheduledRequest.post, :content_type => "application/x-www-form-urlencoded")
165
+ end
166
+
167
+ def Search(searchRequest)
168
+ @searchResult = SearchResults.new($api['Search'].post searchRequest.post, :content_type => "application/x-www-form-urlencoded")
169
+ end
170
+
171
+ def SearchBirdseyeInFlight(searchBirdseyeInFlightRequest)
172
+ @searchBirdseyeInFlightResult = SearchBirdseyeInFlightResults.new($api['SearchBirdseyeInFlight'].post searchBirdseyeInFlightRequest.post, :content_type => "application/x-www-form-urlencoded")
173
+ end
174
+
175
+ def SearchBirdseyePositions(searchBirdseyePositionsRequest)
176
+ @searchBirdseyePositionsResult = SearchBirdseyePositionsResults.new($api['SearchBirdseyePositions'].post searchBirdseyePositionsRequest.post, :content_type => "application/x-www-form-urlencoded")
177
+ end
178
+
179
+ def SearchCount(searchCountRequest)
180
+ @searchCountResult = SearchCountResults.new($api['SearchCount'].post searchCountRequest.post, :content_type => "application/x-www-form-urlencoded")
181
+ end
182
+
183
+ def SetAlert(setAlertRequest)
184
+ @setAlertResult = SetAlertResults.new($api['SetAlert'].post setAlertRequest.post, :content_type => "application/x-www-form-urlencoded")
185
+ end
186
+
187
+ def SetMaximumResultSize(setMaximumResultSizeRequest)
188
+ @setMaximumResultSizeResult = SetMaximumResultSizeResults.new($api['SetMaximumResultSize'].post setMaximumResultSizeRequest.post, :content_type => "application/x-www-form-urlencoded")
189
+ end
190
+
191
+ def Taf(tafRequest)
192
+ @tafResult = TafResults.new($api['Taf'].post tafRequest.post, :content_type => "application/x-www-form-urlencoded")
193
+ end
194
+
195
+ def TailOwner(tailOwnerRequest)
196
+ @tailOwnerResult = TailOwnerResults.new($api['TailOwner'].post tailOwnerRequest.post, :content_type => "application/x-www-form-urlencoded")
197
+ end
198
+
199
+ def ZipcodeInfo(zipcodeInfoRequest)
200
+ @zipcodeInfoResult = ZipcodeInfoResults.new($api['ZipcodeInfo'].post zipcodeInfoRequest.post, :content_type => "application/x-www-form-urlencoded")
201
+ end
202
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: FlightXML2RESTDriver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - auzroz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: REST Interface to the FlightAwareXML2 API
14
+ email: admin@plundr.net
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/FlightXML2REST.rb
20
+ - lib/FlightXML2RESTDriver.rb
21
+ - examples/Examples.rb
22
+ homepage: https://github.com/auzroz/flightxml2-jsonclient-ruby
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.7
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: FlightXML2 Ruby REST Interface
46
+ test_files: []