Sha256: aa425ab6e77af719715ee25b109122174d3fb13f189decc949fdcc05cb98b1fc

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

module BitWallet
  class Transaction

    attr_reader(:account,
                :amount,
                :category,
                :confirmations,
                :id,
                :occurred_at,
                :received_at)

    def initialize(wallet, args)
      args = args.with_indifferent_access
      @wallet = wallet
      @account = wallet.accounts.new(args[:account])
      @id = args[:txid]
      @address_str = args[:address]
      @amount = args[:amount]
      @confirmations = args[:confirmations]
      @occurred_at = Time.at(args[:time])
      @received_at = Time.at(args[:timereceived])
      @category = args[:category]
    end

    def address
      @address ||= @account.addresses.find do |address|
        address.address == @address_str
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bit_wallet-0.1.1 lib/bit_wallet/transaction.rb
bit_wallet-0.1.0 lib/bit_wallet/transaction.rb