Sha256: e7d15b50ee1f86b475b1c5b8e9770d6f74e5a2e1b6aa21f6c094df71454602c0

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

module Bankscrap
  class Transaction
    include Utils::Inspectable

    attr_accessor :id, :amount, :description, :description_detail, :effective_date, :operation_date, :balance, :account

    def initialize(params = {})
      raise NotMoneyObjectError.new(:amount) unless params[:amount].is_a?(Money)

      params.each { |key, value| send "#{key}=", value }
    end

    def to_s
      description
    end

    def to_a
      [id, effective_date.strftime('%d/%m/%Y'), description, description_detail, amount]
    end

    def currency
      amount.currency
    end

    private

    def inspect_attributes
      %i(id amount effective_date description balance)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bankscrap-2.0.6 lib/bankscrap/transaction.rb