Module: FlightStats

Defined in:
lib/flightstats.rb,
lib/flightstats/api.rb,
lib/flightstats/flight.rb,
lib/flightstats/helper.rb,
lib/flightstats/airline.rb,
lib/flightstats/airport.rb,
lib/flightstats/version.rb,
lib/flightstats/appendix.rb,
lib/flightstats/operator.rb,
lib/flightstats/resource.rb,
lib/flightstats/schedule.rb,
lib/flightstats/codeshare.rb,
lib/flightstats/equipment.rb,
lib/flightstats/flight_id.rb,
lib/flightstats/api/errors.rb,
lib/flightstats/flight_leg.rb,
lib/flightstats/arrival_date.rb,
lib/flightstats/abstract_date.rb,
lib/flightstats/flight_status.rb,
lib/flightstats/departure_date.rb,
lib/flightstats/extended_options.rb,
lib/flightstats/flight_durations.rb,
lib/flightstats/flight_equipment.rb,
lib/flightstats/airport_resources.rb,
lib/flightstats/operational_times.rb,
lib/flightstats/published_arrival.rb,
lib/flightstats/published_departure.rb,
lib/flightstats/api/net_http_adapter.rb,
lib/flightstats/actual_gate_departure.rb,
lib/flightstats/estimated_gate_arrival.rb,
lib/flightstats/scheduled_gate_arrival.rb,
lib/flightstats/actual_runway_departure.rb,
lib/flightstats/estimated_gate_departure.rb,
lib/flightstats/estimated_runway_arrival.rb,
lib/flightstats/scheduled_gate_departure.rb,
lib/flightstats/estimated_runway_departure.rb,
lib/flightstats/flight_plan_planned_arrival.rb,
lib/flightstats/flight_plan_planned_departure.rb

Defined Under Namespace

Modules: Helper, Version Classes: API, AbstractDate, ActualGateDeparture, ActualRunwayDeparture, Airline, Airport, AirportResources, Appendix, ArrivalDate, Codeshare, ConfigurationError, DepartureDate, Equipment, Error, EstimatedGateArrival, EstimatedGateDeparture, EstimatedRunwayArrival, EstimatedRunwayDeparture, ExtendedOptions, Flight, FlightDurations, FlightEquipment, FlightId, FlightLeg, FlightPlanPlannedArrival, FlightPlanPlannedDeparture, FlightStatus, OperationalTimes, Operator, PublishedArrival, PublishedDeparture, Resource, Schedule, ScheduledGateArrival, ScheduledGateDeparture

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.app_idString

Returns An APP id.

Returns:

  • (String)

    An APP id.

Raises:



21
22
23
24
25
# File 'lib/flightstats.rb', line 21

def app_id
  defined? @app_id and @app_id or raise(
    ConfigurationError, "FlightStats.app_id not configured"
  )
end

.app_keyString

Returns An APP key.

Returns:

  • (String)

    An APP key.

Raises:



30
31
32
33
34
# File 'lib/flightstats.rb', line 30

def app_key
  defined? @app_key and @app_key or raise(
    ConfigurationError, "FlightStats.app_key not configured"
  )
end

.loggerLogger?

Assigns a logger to log requests/responses and more.

Examples:

require 'logger'
FlightStats.logger = Logger.new STDOUT

Rails applications automatically log to the Rails log:

FlightStats.logger = Rails.logger

Turn off logging entirely:

FlightStats.logger = nil # Or FlightStats.logger = Logger.new nil

Returns:

  • (Logger, nil)


47
48
49
# File 'lib/flightstats.rb', line 47

def logger
  @logger
end

Class Method Details

.log(level, message) ⇒ true?

Convenience logging method includes a Logger#progname dynamically.

Returns:

  • (true, nil)


51
52
53
# File 'lib/flightstats.rb', line 51

def log level, message
  logger.send(level, name) { message }
end

Instance Method Details

#const_defined?(sym, inherit = false) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


56
57
58
59
# File 'lib/flightstats.rb', line 56

def const_defined? sym, inherit = false
  raise ArgumentError, "inherit must be false" if inherit
  super sym
end

#const_get(sym, inherit = false) ⇒ Object

Raises:

  • (ArgumentError)


61
62
63
64
# File 'lib/flightstats.rb', line 61

def const_get sym, inherit = false
  raise ArgumentError, "inherit must be false" if inherit
  super sym
end