Sha256: 90d47991c78a33931ff528b3fafff7faa7584b8ac0414d1ce2749344e4bd593c

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

module Bankscrap
  class Account
    include Utils::Inspectable

    attr_accessor :bank, :id, :name, :balance, :currency, :available_balance, :description, :transactions, :iban, :bic

    def initialize(params = {})
      params.each { |key, value| send "#{key}=", value }
    end

    def transactions
      @transactions ||= bank.fetch_transactions_for(self)
    end

    def fetch_transactions(start_date: Date.today - 2.years, end_date: Date.today)
      bank.fetch_transactions_for(self, start_date: start_date, end_date: end_date)
    end

    private

    def inspect_attributes
      %i(id name balance currency available_balance description iban bic)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bankscrap-1.0.4 lib/bankscrap/account.rb
bankscrap-1.0.3 lib/bankscrap/account.rb
bankscrap-1.0.2 lib/bankscrap/account.rb
bankscrap-1.0.1 lib/bankscrap/account.rb
bankscrap-1.0.0 lib/bankscrap/account.rb