Class: VatsimTools::Station

Inherits:
Object
  • Object
show all
Defined in:
lib/vatsim_online/station.rb

Instance Method Summary collapse

Constructor Details

#initialize(station, args = nil) ⇒ Station

Returns a new instance of Station.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vatsim_online/station.rb', line 13

def initialize(station, args = nil)

  @callsign = station['callsign']
  @cid = station['cid'].to_s
  @name = station['name']
  @role = station['role']
  @frequency = station['frequency']
  @latitude = station['latitude'].to_s
  @longitude = station['longitude'].to_s
  @altitude = station['altitude']
  @groundspeed = station['groundspeed']
  @aircraft = station['flight_plan']['aircraft'] rescue ''
  @origin = station['flight_plan']['departure'] rescue ''
  @planned_altitude = station['flight_plan']['altitude'] rescue ''
  @destination = station['flight_plan']['arrival'] rescue ''
  @transponder = station['transponder']
  @facility = station['facility'].to_s
  @flight_type = station['flight_plan']['flight_rules'] rescue ''
  @remarks = station['flight_plan']['remarks'] rescue ''
  @route  = station['flight_plan']['route'] rescue ''
  @logon = station['logon_time']
  @heading = station['heading'].to_s
  @qnh_in = station['qnh_i_hg'].to_s
  @qnh_mb = station['qnh_mb'].to_s

  @atis = atis_cleaner(station['text_atis']) if station['text_atis']
  @rating = humanized_rating(station['rating'].to_s)
  @latitude_humanized = latitude_parser(station['latitude'])
  @longitude_humanized = longitude_parser(station['longitude'])
  @online_since = utc_logon_time if @logon
  @gcmap_width = args[:gcmap_width].to_i if args && args[:gcmap_width]
  @gcmap_height = args[:gcmap_height].to_i if args && args[:gcmap_height]
  @gcmap = gcmap_generator
  @atis_message = construct_atis_message(station['text_atis']) if station['text_atis']
end