Sha256: c9be429e094521ac6a415660f9682af126daed98573ee9e443d79819c44e9112

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

# typed: strict
# frozen_string_literal: true

module LunchMoney
  # Slimmed down version of https://lunchmoney.dev/#transaction-object used as a base for other transaction objects
  class TransactionBase < LunchMoney::DataObject
    sig { returns(Integer) }
    attr_accessor :id

    sig { returns(Number) }
    attr_accessor :to_base

    sig { returns(T.nilable(Integer)) }
    attr_accessor :asset_id, :plaid_account_id

    sig { returns(String) }
    attr_accessor :date,
      :amount,
      :currency,
      :payee

    sig { returns(T.nilable(String)) }
    attr_accessor :notes

    sig do
      params(
        id: Integer,
        date: String,
        amount: String,
        currency: String,
        to_base: Number,
        payee: String,
        notes: T.nilable(String),
        asset_id: T.nilable(Integer),
        plaid_account_id: T.nilable(Integer),
      ).void
    end
    def initialize(id:, date:, amount:, currency:, to_base:, payee:, notes: nil, asset_id: nil,
      plaid_account_id: nil)
      super()
      @id = id
      @date = date
      @amount = amount
      @currency = currency
      @to_base = to_base
      @payee = payee
      @notes = notes
      @asset_id = asset_id
      @plaid_account_id = plaid_account_id
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lunchmoney-1.0.0 lib/lunchmoney/transactions/transaction/transaction_base.rb
lunchmoney-0.10.0 lib/lunchmoney/transactions/transaction/transaction_base.rb