module FlightStats

Attributes

app_id[W]
app_key[W]
logger[RW]

Assigns a logger to log requests/responses and more.

@return [Logger, nil] @example

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

@example Rails applications automatically log to the Rails log:

FlightStats.logger = Rails.logger

@example Turn off logging entirely:

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

Public Class Methods

app_id() click to toggle source

@return [String] An APP id. @raise [ConfigurationError] If not configured.

# 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_key() click to toggle source

@return [String] An APP key. @raise [ConfigurationError] If not configured.

# File lib/flightstats.rb, line 30
def app_key
  defined? @app_key and @app_key or raise(
    ConfigurationError, "FlightStats.app_key not configured"
  )
end
const_defined?(sym, inherit = false) click to toggle source
Calls superclass method
# 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) click to toggle source
Calls superclass method
# File lib/flightstats.rb, line 61
def const_get sym, inherit = false
  raise ArgumentError, "inherit must be false" if inherit
  super sym
end
log(level, message) click to toggle source

Convenience logging method includes a Logger#progname dynamically. @return [true, nil]

# File lib/flightstats.rb, line 51
def log level, message
  logger.send(level, name) { message }
end