Class: FiveonebookFlight
- Inherits:
-
Object
- Object
- FiveonebookFlight
- Extended by:
- AbstractFlight
- Includes:
- Auth, HTTParty
- Defined in:
- lib/flight_info/fiveonebook_flight.rb
Class Method Summary collapse
Methods included from AbstractFlight
Class Method Details
.body_content(args) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/flight_info/fiveonebook_flight.rb', line 36 def self.body_content(args) { 'Content-Type' => 'application/json', 'USERNAME' => Auth.username, 'SIGN' => Digest::MD5.hexdigest(build_query(args).to_json + Auth.password), 'Accept-Charset' => 'utf-8', 'contentType' => 'utf-8' } end |
.build_query(args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/flight_info/fiveonebook_flight.rb', line 9 def self.build_query(args) cabin_class, direct_flight, adult_num, child_num, depart_airport, arri_airport, depart_time, current_time = args.values_at(:cabin_class, :direct_flight, :adult_num, :child_num, :depart_airport, :arri_airport, :depart_time, :current_time) { agencyCode: Auth.username, rsIsGzip: true, timeStamp: current_time, RQData: { cabinClass: cabin_class, directFlight: direct_flight, routeType: 'OW', resourceChannel: 1, passengerNumberVo: [{ passengerType: 'ADT', passengerNumber: adult_num }, { passengerType: 'CHD', passengerNumber: child_num }], segmentList: [{ departureAirport: depart_airport, arrivalAirport: arri_airport, departureTime: depart_time }] } } end |
.search_flight(args) ⇒ Object
46 47 48 |
# File 'lib/flight_info/fiveonebook_flight.rb', line 46 def self.search_flight(args) query '/searchFlight', args end |