Sha256: b34cb1ddb6075e698931211226007d0605d3623f6e4c35c08f8f7fa1f4a0f97e

Contents?: true

Size: 826 Bytes

Versions: 5

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Bckbn
  module Charge
    using Bckbn::CoreExt::StringExt

    CHARGE_RESPONSE_MEMBERS = %i[
      id
      amount
      direction
      posting
      posting_code
      posting_type
      status
      transaction_type
      logs
    ].freeze

    CHARGES_RESPONSE_MEMBERS = %i[
      charges
      page_number
      page_size
      has_previous_page
      has_next_page
      logs
    ].freeze

    private_constant :CHARGE_RESPONSE_MEMBERS

    ChargeResponse = Struct.new(*CHARGE_RESPONSE_MEMBERS, keyword_init: true)

    ChargesResponse = Struct.new(*CHARGES_RESPONSE_MEMBERS, keyword_init: true) do
      def initialize(**opts)
        charges = opts.delete("charges")
        super(opts)
        self.charges = charges.map { |c| ChargeResponse.new(c) }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bckbn-3.0.1 lib/bckbn/resources/charge/models/responses.rb
bckbn-3.0.0 lib/bckbn/resources/charge/models/responses.rb
bckbn-2.2.1 lib/bckbn/resources/charge/models/responses.rb
bckbn-2.1.1 lib/bckbn/resources/charge/models/responses.rb
bckbn-2.1.0 lib/bckbn/resources/charge/models/responses.rb