Sha256: abe9ed574ee2fbcb396ffe23f9783d08343718849d8381b3571aea7f96f132d2

Contents?: true

Size: 1.73 KB

Versions: 31

Compression:

Stored size: 1.73 KB

Contents

class Gillbus
  module BuyBooking

    Gillbus.register self, :buy_booking

    class Request < BaseRequest

      def path; '/online2/buyBooking' end

      # paymentMethod (не обязательный)
      # Способ оплаты заказа.
      attr_accessor :payment_method

      # 1 – наличный;
      METHOD_CASH = 1
      # 2 – кредитной карточкой;
      METHOD_CARD = 2
      # 3 – безналичный;
      METHOD_NOCASH = 3
      # 4 – сервисный;
      METHOD_SERVICE = 4
      # 5 – эквайринг.
      METHOD_ACQUIRING = 5
      # По умолчанию 3.

      # ticketCount
      # Кол-во выкупаемых билетов. 1..k
      attr_accessor :ticket_count

      # Номера билетов с порядковым номером
      attr_accessor :ticket_numbers

      attr_accessor :order_ids

      def params
        numbers = ticket_numbers.map.with_index do |num, i|
          [:"ticketNumber#{i}", num]
        end.to_h

        orders = order_ids.map.with_index do |val, i|
          [:"orderId#{i}", val]
        end.to_h

        compact(
          paymentMethod: payment_method,
          ticketCount: ticket_count,
          **numbers,
          **orders
        )
      end

    end

    class Response < BaseResponse

      class TicketConfirmation

        extend Fields

        field :number, :int
        # String. пока не выяснится, в какой таймзоне это значение и зачем
        field :date
        field :order_id
        field :confirmation, :yesno_bool
        field :position_numbers, [:int], key: 'POSITION_NUMBER'

      end

      field :ticket, TicketConfirmation

    end

  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

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