Class: Nabortu::Methods::GetVariants
- Defined in:
- lib/nabortu/methods/get_variants.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
do_request, #do_request, #initialize
Constructor Details
This class inherits a constructor from Nabortu::Methods::Base
Instance Method Details
#do_prepare ⇒ Object
41 42 43 44 45 |
# File 'lib/nabortu/methods/get_variants.rb', line 41 def do_prepare {offers: @response[:search_result][:offers][:item], request: @response[:search_result][:request]} rescue false end |
#request(params = {}) ⇒ Object
4 5 6 7 8 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 35 36 37 38 39 |
# File 'lib/nabortu/methods/get_variants.rb', line 4 def request(params = {}) date_to = params[:date_to] || raise(Nabortu::Errors::NoParam.new :date_to) date_from = params[:date_from] || raise(Nabortu::Errors::NoParam.new :date_from) origin = params[:origin] || 'MOW' destination = params[:destination] || raise(Nabortu::Errors::NoParam.new :destination) { 'tns:requestParameters' => { 'AviaSearchRequest' => { 'Adults' => params[:adults] || 2, 'Children' => params[:children] || 0, 'Infants' => params[:infants] || 0, 'Segments' => { 'ModifiedSegment' => [ { 'OriginCode' => params[:origin] || 'MOW', 'DestinationCode' => destination, 'Date' => date_to, 'Fare' => 'Economy' }, { 'OriginCode' => destination, 'DestinationCode' => origin, 'Date' => date_from, 'Fare' => 'Economy' }] }, 'PartnerId' => Nabortu.config.partner_id, 'Fare' => 'Economy', 'FlexibleDates' => params[:flexible_dates] || 'false', 'OnlyDirect' => params[:only_direct] || 'true', 'IsOnePassSearch' => params[:one_pass_search] || 'true', 'AllowLowcost' => params[:allow_lowcost] || 'false', 'Nabortu' => params[:nabortu] || 'true' } } } end |