Class: FlightHaha

Inherits:
Object
  • Object
show all
Defined in:
lib/hasami/flight.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ FlightHaha

Returns a new instance of FlightHaha.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/hasami/flight.rb', line 33

def initialize(raw_data)
  self.raw = raw_data

  # terminal
  self.terminal = "T#{raw_data[0]}"

  # kind
  case raw_data[1]
  when "A"
    self.kind = "Arrivals"
  when "D"
    self.kind = "Departure"
  end

  # code
  self.code = raw_data[2]

  # code
  self.code_zh = raw_data[3]

  # flight
  self.flight = raw_data[4]

  # gate
  self.gate = raw_data[5]

  # datetime
  self.datetime = "#{raw_data[6]} #{raw_data[7]} +08:00"

  # expected_datetime
  self.expected_datetime = "#{raw_data[8]} #{raw_data[9]} +08:00"

  # destination
  self.destination = DestinationHaha.new(iata: raw_data[10], en: raw_data[11], zh: raw_data[12])

  # flight_status
  self.flight_status = raw_data[13]

  # aircraft_type
  self.aircraft_type = raw_data[14]

  # other_route
  self.other_route = DestinationHaha.new(iata: raw_data[15], en: raw_data[16], zh: raw_data[17])

  # baggage_carousel
  self.baggage_carousel = raw_data[18]

  # check_in_counter
  self.check_in_counter = raw_data[19]
end