Module: Selectors::AirAsia

Included in:
AirAsia
Defined in:
lib/teecket/selectors/air_asia.rb

Instance Method Summary collapse

Instance Method Details

#arrive_at_selector(flight) ⇒ Object



7
8
9
# File 'lib/teecket/selectors/air_asia.rb', line 7

def arrive_at_selector(flight)
  depart_arrivate_at_formatter(flight["segments"][0]["arrival-datetime"])
end

#depart_arrivate_at_formatter(datetime) ⇒ Object



27
28
29
# File 'lib/teecket/selectors/air_asia.rb', line 27

def depart_arrivate_at_formatter(datetime)
  DateTime.parse(datetime).strftime("%I:%M %p")
end

#depart_at_selector(flight) ⇒ Object



3
4
5
# File 'lib/teecket/selectors/air_asia.rb', line 3

def depart_at_selector(flight)
  depart_arrivate_at_formatter(flight["segments"][0]["departure-datetime"])
end

#destination_selector(flight) ⇒ Object



23
24
25
# File 'lib/teecket/selectors/air_asia.rb', line 23

def destination_selector(flight)
  flight["segments"][0]["destinationcode"]
end

#fare_formatter(fare) ⇒ Object



31
32
33
# File 'lib/teecket/selectors/air_asia.rb', line 31

def fare_formatter(fare)
  sprintf("%.2f", fare)
end

#fare_selector(flight) ⇒ Object



11
12
13
# File 'lib/teecket/selectors/air_asia.rb', line 11

def fare_selector(flight)
  fare_formatter(flight["total"]["adult"])
end

#flight_number_formatter(flight_number) ⇒ Object



35
36
37
# File 'lib/teecket/selectors/air_asia.rb', line 35

def flight_number_formatter(flight_number)
  flight_number.gsub(/ /, "")
end

#flight_number_selector(flight) ⇒ Object



15
16
17
# File 'lib/teecket/selectors/air_asia.rb', line 15

def flight_number_selector(flight)
  flight_number_formatter(flight["segments"][0]["flight-number"])
end

#origin_selector(flight) ⇒ Object



19
20
21
# File 'lib/teecket/selectors/air_asia.rb', line 19

def origin_selector(flight)
  flight["segments"][0]["origincode"]
end