Class: SearchApi::GoogleFlightsOptions
- Inherits:
-
Object
- Object
- SearchApi::GoogleFlightsOptions
- Includes:
- DynamicSchema::Definable, Helpers
- Defined in:
- lib/searchapi/google_flights_options.rb
Constant Summary collapse
- FLIGHT_TYPES =
%w[ round_trip one_way multi_city ]
- STOPS =
%w[ any nonstop one_stop_or_fewer two_stops_or_fewer ]
- SORT_BY =
%w[ top_flights price departure_time arrival_time duration emissions ]
- TRAVEL_CLASSES =
%w[ economy premium_economy business first_class ]
- NORMALIZE_DOWNCASE =
->(v) { v.to_s.downcase }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}, api_options: nil) ⇒ GoogleFlightsOptions
constructor
A new instance of GoogleFlightsOptions.
- #to_h ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}, api_options: nil) ⇒ GoogleFlightsOptions
Returns a new instance of GoogleFlightsOptions.
73 74 75 76 |
# File 'lib/searchapi/google_flights_options.rb', line 73 def initialize( = {}, api_options: nil ) @options = self.class.builder.build( || {} ) @options = .merge( @options ) if end |
Class Method Details
.build(options = nil, &block) ⇒ Object
65 66 67 |
# File 'lib/searchapi/google_flights_options.rb', line 65 def self.build( = nil, &block ) new( api_options: builder.build( , &block ) ) end |
.build!(options = nil, &block) ⇒ Object
69 70 71 |
# File 'lib/searchapi/google_flights_options.rb', line 69 def self.build!( = nil, &block ) new( api_options: builder.build!( , &block ) ) end |
Instance Method Details
#to_h ⇒ Object
78 79 80 81 82 |
# File 'lib/searchapi/google_flights_options.rb', line 78 def to_h result = @options.to_h result[ :engine ] = 'google_flights' result end |