Sha256: cd9ac97645b42cb2748b682d7a8c719e8b91ed6f497c9339522e3b9456928517

Contents?: true

Size: 484 Bytes

Versions: 5

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true

require 'time'
require 'credit_gateway/base_model'
require 'credit_gateway/amount'

module CreditGateway
  class Balance < BaseModel
    attributes :account_id, :date_time, :type,
               :amount, :credit_debit_indicator

    def self.build(json:)
      super.tap do |record|
        record.amount = Amount.build(json: (record.amount || {}))
        record.date_time = Time.parse(record.date_time) if record.date_time
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
credit_gateway-0.3.2 lib/credit_gateway/balance.rb
credit_gateway-0.3.1 lib/credit_gateway/balance.rb
credit_gateway-0.3.0 lib/credit_gateway/balance.rb
credit_gateway-0.1.1 lib/credit_gateway/balance.rb
credit_gateway-0.1.0 lib/credit_gateway/balance.rb