Class: FlightStats::Flight
- Defined in:
- lib/flightstats/flight.rb
Instance Attribute Summary collapse
-
#arrival_airport_fs_code ⇒ Object
Returns the value of attribute arrival_airport_fs_code.
-
#arrival_date_adjustment ⇒ Object
Returns the value of attribute arrival_date_adjustment.
-
#arrival_time ⇒ Object
Returns the value of attribute arrival_time.
-
#departure_airport_fs_code ⇒ Object
Returns the value of attribute departure_airport_fs_code.
-
#departure_date_from ⇒ Object
Returns the value of attribute departure_date_from.
-
#departure_date_to ⇒ Object
Returns the value of attribute departure_date_to.
-
#departure_days_of_week ⇒ Object
Returns the value of attribute departure_days_of_week.
-
#departure_time ⇒ Object
Returns the value of attribute departure_time.
-
#distance_miles ⇒ Object
Returns the value of attribute distance_miles.
-
#flight_duration_minutes ⇒ Object
Returns the value of attribute flight_duration_minutes.
-
#flight_legs ⇒ Object
Returns the value of attribute flight_legs.
-
#flight_type ⇒ Object
Returns the value of attribute flight_type.
-
#layover_duration_minutes ⇒ Object
Returns the value of attribute layover_duration_minutes.
-
#online ⇒ Object
Returns the value of attribute online.
-
#service_type ⇒ Object
Returns the value of attribute service_type.
Attributes inherited from Resource
#attributes, #etag, #response, #uri
Class Method Summary collapse
- .direct_and_connecting_arriving(departure_code, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_and_connecting_departing(departure_code, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_arriving_at(arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_arriving_by_flight_number(carrier, flight_number, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_arriving_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_departing_by_flight_number(carrier, flight_number, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_departing_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
- .direct_departing_from(departure_code, year, month, day, params = {}, options = {}) ⇒ Object
Instance Method Summary collapse
Methods inherited from Resource
from_json, from_parsed_json, from_response, #initialize, string_to_model, string_to_model_with_caching, #to_param, #underscore_with_caching
Constructor Details
This class inherits a constructor from FlightStats::Resource
Instance Attribute Details
#arrival_airport_fs_code ⇒ Object
Returns the value of attribute arrival_airport_fs_code.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def arrival_airport_fs_code @arrival_airport_fs_code end |
#arrival_date_adjustment ⇒ Object
Returns the value of attribute arrival_date_adjustment.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def arrival_date_adjustment @arrival_date_adjustment end |
#arrival_time ⇒ Object
Returns the value of attribute arrival_time.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def arrival_time @arrival_time end |
#departure_airport_fs_code ⇒ Object
Returns the value of attribute departure_airport_fs_code.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def departure_airport_fs_code @departure_airport_fs_code end |
#departure_date_from ⇒ Object
Returns the value of attribute departure_date_from.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def departure_date_from @departure_date_from end |
#departure_date_to ⇒ Object
Returns the value of attribute departure_date_to.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def departure_date_to @departure_date_to end |
#departure_days_of_week ⇒ Object
Returns the value of attribute departure_days_of_week.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def departure_days_of_week @departure_days_of_week end |
#departure_time ⇒ Object
Returns the value of attribute departure_time.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def departure_time @departure_time end |
#distance_miles ⇒ Object
Returns the value of attribute distance_miles.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def distance_miles @distance_miles end |
#flight_duration_minutes ⇒ Object
Returns the value of attribute flight_duration_minutes.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def flight_duration_minutes @flight_duration_minutes end |
#flight_legs ⇒ Object
Returns the value of attribute flight_legs.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def flight_legs @flight_legs end |
#flight_type ⇒ Object
Returns the value of attribute flight_type.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def flight_type @flight_type end |
#layover_duration_minutes ⇒ Object
Returns the value of attribute layover_duration_minutes.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def layover_duration_minutes @layover_duration_minutes end |
#online ⇒ Object
Returns the value of attribute online.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def online @online end |
#service_type ⇒ Object
Returns the value of attribute service_type.
3 4 5 |
# File 'lib/flightstats/flight.rb', line 3 def service_type @service_type end |
Class Method Details
.direct_and_connecting_arriving(departure_code, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
44 45 46 |
# File 'lib/flightstats/flight.rb', line 44 def direct_and_connecting_arriving(departure_code, arrival_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/connecting/from/#{departure_code}/to/#{arrival_code}/arriving/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_and_connecting_departing(departure_code, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
48 49 50 |
# File 'lib/flightstats/flight.rb', line 48 def direct_and_connecting_departing(departure_code, arrival_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/connecting/from/#{departure_code}/to/#{arrival_code}/departing/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_arriving_at(arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
20 21 22 |
# File 'lib/flightstats/flight.rb', line 20 def direct_arriving_at(arrival_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/to/#{arrival_code}/arriving/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_arriving_by_flight_number(carrier, flight_number, year, month, day, params = {}, options = {}) ⇒ Object
28 29 30 |
# File 'lib/flightstats/flight.rb', line 28 def direct_arriving_by_flight_number(carrier, flight_number, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/flight/#{carrier}/#{flight_number}/arriving/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_arriving_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
32 33 34 |
# File 'lib/flightstats/flight.rb', line 32 def direct_arriving_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/flight/#{carrier}/#{flight_number}/to/#{arrival_code}/arriving/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_departing_by_flight_number(carrier, flight_number, year, month, day, params = {}, options = {}) ⇒ Object
36 37 38 |
# File 'lib/flightstats/flight.rb', line 36 def direct_departing_by_flight_number(carrier, flight_number, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/flight/#{carrier}/#{flight_number}/departing/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_departing_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, options = {}) ⇒ Object
40 41 42 |
# File 'lib/flightstats/flight.rb', line 40 def direct_departing_by_flight_number_and_location(carrier, flight_number, arrival_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/flight/#{carrier}/#{flight_number}/to/#{arrival_code}/departing/#{year}/#{month}/#{day}", params, ), 'flights' end |
.direct_departing_from(departure_code, year, month, day, params = {}, options = {}) ⇒ Object
24 25 26 |
# File 'lib/flightstats/flight.rb', line 24 def direct_departing_from(departure_code, year, month, day, params = {}, = {}) from_response API.get("/flex/connections/rest/v1/json/direct/from/#{departure_code}/departing/#{year}/#{month}/#{day}", params, ), 'flights' end |
Instance Method Details
#to_s ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/flightstats/flight.rb', line 53 def to_s str = "#{departure_airport_fs_code} - #{arrival_airport_fs_code} (#{distance_miles} miles): from #{departure_date_from} to #{departure_date_to}" flight_legs.each do |leg| str << "\n #{leg.to_s}" end str end |