Module: Selectors::MalindoAir
- Included in:
- MalindoAir
- Defined in:
- lib/teecket/selectors/malindo_air.rb
Instance Method Summary collapse
- #arrive_at_selector(flight) ⇒ Object
- #depart_arrive_at_formatter(datetime) ⇒ Object
- #depart_at_selector(flight) ⇒ Object
- #destination_selector(elem) ⇒ Object
- #fare_formatter(fare) ⇒ Object
- #fare_selector(flight) ⇒ Object
- #flight_number_selector(flight) ⇒ Object
- #origin_selector(flight) ⇒ Object
Instance Method Details
#arrive_at_selector(flight) ⇒ Object
7 8 9 |
# File 'lib/teecket/selectors/malindo_air.rb', line 7 def arrive_at_selector(flight) depart_arrive_at_formatter(flight) end |
#depart_arrive_at_formatter(datetime) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/teecket/selectors/malindo_air.rb', line 29 def depart_arrive_at_formatter(datetime) DateTime .strptime(datetime.gsub(%r(^\/Date\(|\)\/), ""), "%Q") .to_time .strftime("%I:%M %p") end |
#depart_at_selector(flight) ⇒ Object
3 4 5 |
# File 'lib/teecket/selectors/malindo_air.rb', line 3 def depart_at_selector(flight) depart_arrive_at_formatter(flight["DepartureDate"]) end |
#destination_selector(elem) ⇒ Object
25 26 27 |
# File 'lib/teecket/selectors/malindo_air.rb', line 25 def destination_selector(elem) elem["ArrCity"] end |
#fare_formatter(fare) ⇒ Object
36 37 38 |
# File 'lib/teecket/selectors/malindo_air.rb', line 36 def fare_formatter(fare) sprintf("%.2f", fare) end |
#fare_selector(flight) ⇒ Object
11 12 13 |
# File 'lib/teecket/selectors/malindo_air.rb', line 11 def fare_selector(flight) fare_formatter(flight["FlightAmount"]) end |
#flight_number_selector(flight) ⇒ Object
15 16 17 18 19 |
# File 'lib/teecket/selectors/malindo_air.rb', line 15 def flight_number_selector(flight) flight["SegmentInformation"].map do |trip| trip["MACode"] + trip["FlightNo"] end.join(" + ") end |
#origin_selector(flight) ⇒ Object
21 22 23 |
# File 'lib/teecket/selectors/malindo_air.rb', line 21 def origin_selector(flight) flight["DepCity"] end |