Sha256: 5ad4764daef9421921adda77f586e1fb9589feeb5213b62e00bdd587d31803ba

Contents?: true

Size: 1.99 KB

Versions: 26

Compression:

Stored size: 1.99 KB

Contents

class Gillbus
  # not a request, neither a response part
  # just a params record for SearchTrips
  class PassengerDiscount < BaseRequest

    def self.wrap(passenger_or_params)
      return passenger_or_params if passenger_or_params.is_a? self
      new(passenger_or_params)
    end

    # passenger0birthday... passengerNbirthday (обязательный для авиаперевозки)
    # Дата рождения пассажира с порядковым номером 0...N.
    attr_accessor :birthday

    # passenger0studentTicket... passengerNstudentTicket (не обязательный)
    # Номер студенческого билета пассажира с порядковым номером 0... N.
    attr_accessor :student_ticket

    # passenger0studentYear... passengerNstudentYear (не обязательный)
    # Курс, на котором учится пассажир с порядковым номером 0...N, если он студент.
    # Для просчета более выгодной скидки.
    attr_accessor :student_year

    # passenger0ISIC...passengerNISIC (не обязательный)
    # Номер ISIC пассажира с порядковым номером 0...N.
    attr_accessor :isic

    # passenger0withSeat...passengerNwithSeat (не обязательный), boolean
    # Признак обязательного предоставления места пассажиру с порядковым номером 0…N.
    # По-умолчанию false. Если true, то пассажиру будет подобран тариф
    # с предоставлением места, если такой имеется.
    attr_accessor :with_seat

    def params(prefix="")
      compact(
        birthday: date(birthday),
        studentTicket: student_ticket,
        studentYear: student_year,
        ISIC: isic,
        withSeat: bool(with_seat),
      ).map {|k, v| [:"#{prefix}#{k}", v] }.to_h
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
gillbus-0.16.7 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.6 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.5 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.4 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.3 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.2 lib/gillbus/structs/passenger_discount.rb
gillbus-0.16.1 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.7 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.6 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.5 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.4 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.3 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.2 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.1 lib/gillbus/structs/passenger_discount.rb
gillbus-0.15.0 lib/gillbus/structs/passenger_discount.rb
gillbus-0.14.12 lib/gillbus/structs/passenger_discount.rb
gillbus-0.14.11 lib/gillbus/structs/passenger_discount.rb
gillbus-0.14.10 lib/gillbus/structs/passenger_discount.rb
gillbus-0.14.9 lib/gillbus/structs/passenger_discount.rb
gillbus-0.14.8 lib/gillbus/structs/passenger_discount.rb