Class: FlightStats::Airport

Inherits:
Resource show all
Defined in:
lib/flightstats/airport.rb

Constant Summary collapse

@@base_path =
"/flex/airports/rest/v1/json"

Instance Attribute Summary collapse

Attributes inherited from Resource

#attributes, #etag, #response, #uri

Class 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

#activeObject

Returns the value of attribute active.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def active
  @active
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def city
  @city
end

#city_codeObject

Returns the value of attribute city_code.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def city_code
  @city_code
end

#classificationObject

Returns the value of attribute classification.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def classification
  @classification
end

#country_codeObject

Returns the value of attribute country_code.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def country_code
  @country_code
end

#country_nameObject

Returns the value of attribute country_name.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def country_name
  @country_name
end

#delay_index_urlObject

Returns the value of attribute delay_index_url.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def delay_index_url
  @delay_index_url
end

#elevation_feetObject

Returns the value of attribute elevation_feet.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def elevation_feet
  @elevation_feet
end

#faaObject

Returns the value of attribute faa.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def faa
  @faa
end

#fsObject

Returns the value of attribute fs.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def fs
  @fs
end

#iataObject

Returns the value of attribute iata.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def iata
  @iata
end

#icaoObject

Returns the value of attribute icao.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def icao
  @icao
end

#latitudeObject

Returns the value of attribute latitude.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def latitude
  @latitude
end

#local_timeObject

Returns the value of attribute local_time.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def local_time
  @local_time
end

#longitudeObject

Returns the value of attribute longitude.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def longitude
  @longitude
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def name
  @name
end

#postal_codeObject

Returns the value of attribute postal_code.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def postal_code
  @postal_code
end

#region_nameObject

Returns the value of attribute region_name.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def region_name
  @region_name
end

#state_codeObject

Returns the value of attribute state_code.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def state_code
  @state_code
end

#street1Object

Returns the value of attribute street1.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def street1
  @street1
end

#time_zone_region_nameObject

Returns the value of attribute time_zone_region_name.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def time_zone_region_name
  @time_zone_region_name
end

#utc_offset_hoursObject

Returns the value of attribute utc_offset_hours.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def utc_offset_hours
  @utc_offset_hours
end

#weather_urlObject

Returns the value of attribute weather_url.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def weather_url
  @weather_url
end

#weather_zoneObject

Returns the value of attribute weather_zone.



3
4
5
# File 'lib/flightstats/airport.rb', line 3

def weather_zone
  @weather_zone
end

Class Method Details

.actives(options = {}) ⇒ Object



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

def actives(options = {})
  from_response API.get("#{base_path}/active", {}, options), 'airports'
end

.actives_for_date(year, month, day, options = {}) ⇒ Object



35
36
37
# File 'lib/flightstats/airport.rb', line 35

def actives_for_date(year, month, day, options = {})
  from_response API.get("#{base_path}/active/#{year}/#{month}/#{day}", {}, options), 'airports'
end

.all(options = {}) ⇒ Object



39
40
41
# File 'lib/flightstats/airport.rb', line 39

def all(options = {})
  from_response API.get("#{base_path}/all", {}, options), 'airports'
end

.base_pathObject



83
84
85
# File 'lib/flightstats/airport.rb', line 83

def base_path
  @@base_path
end

.by_city_code(city_code, options = {}) ⇒ Object



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

def by_city_code(city_code, options = {})
  from_response API.get("#{base_path}/cityCode/#{city_code}", {}, options), 'airports'
end

.by_country_code(country_code, options = {}) ⇒ Object



55
56
57
# File 'lib/flightstats/airport.rb', line 55

def by_country_code(country_code, options = {})
  from_response API.get("#{base_path}/countryCode/#{country_code}", {}, options), 'airports'
end

.by_flight_stats_code(flight_stats_code, options = {}) ⇒ Object



59
60
61
# File 'lib/flightstats/airport.rb', line 59

def by_flight_stats_code(flight_stats_code, options = {})
  from_response API.get("#{base_path}/fs/#{flight_stats_code}", {}, options), 'airport'
end

.by_iata_code(iata_code, options = {}) ⇒ Object



63
64
65
# File 'lib/flightstats/airport.rb', line 63

def by_iata_code(iata_code, options = {})
  from_response API.get("#{base_path}/iata/#{iata_code}", {}, options), 'airports'
end

.by_iata_code_on_date(iata_code, year, month, day, options = {}) ⇒ Object



67
68
69
# File 'lib/flightstats/airport.rb', line 67

def by_iata_code_on_date(iata_code, year, month, day, options = {})
  from_response API.get("#{base_path}/iata/#{iata_code}/#{year}/#{month}/#{day}", {}, options), 'airport'
end

.by_icao_code(icao_code, options = {}) ⇒ Object



71
72
73
# File 'lib/flightstats/airport.rb', line 71

def by_icao_code(icao_code, options = {})
  from_response API.get("#{base_path}/icao/#{icao_code}", {}, options), 'airports'
end

.by_icao_code_on_date(icao_code, year, month, day, options = {}) ⇒ Object



75
76
77
# File 'lib/flightstats/airport.rb', line 75

def by_icao_code_on_date(icao_code, year, month, day, options = {})
  from_response API.get("#{base_path}/icao/#{icao_code}/#{year}/#{month}/#{day}", {}, options), 'airport'
end

.current(code, options = {}) ⇒ Object



43
44
45
# File 'lib/flightstats/airport.rb', line 43

def current(code, options = {})
  from_response API.get("#{base_path}/#{code}/today", {}, options), 'airport'
end

.on_date(code, year, month, day, options = {}) ⇒ Object



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

def on_date(code, year, month, day, options = {})
  from_response API.get("#{base_path}/#{code}/#{year}/#{month}/#{day}", {}, options), 'airport'
end

.within_radius(longitude, latitude, radius_miles, options = {}) ⇒ Object



79
80
81
# File 'lib/flightstats/airport.rb', line 79

def within_radius(longitude, latitude, radius_miles, options = {})
  from_response API.get("#{base_path}/withinRadius/#{longitude}/#{latitude}/#{radius_miles}", {}, options), 'airports'
end