Sha256: c36b0038cbb04faad6cc91a7ad220bdc8d1a574c0d9844948f40193e142af3a8

Contents?: true

Size: 479 Bytes

Versions: 23

Compression:

Stored size: 479 Bytes

Contents

module TxCatcher

  class Deposit < Sequel::Model
    many_to_one :transaction
    many_to_one :address

    attr_accessor :address_string

    def before_save
      if @address_string
        self.address = Address.find_or_create(address: @address_string)
      end

      self.address.update(received: self.address.received + self.amount)
    end

    def amount_in_btc
      CryptoUnit.new(Config["currency"], self.amount, from_unit: :primary).to_standart
    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
txcatcher-0.2.4 lib/txcatcher/models/deposit.rb
txcatcher-0.2.3 lib/txcatcher/models/deposit.rb
txcatcher-0.2.2 lib/txcatcher/models/deposit.rb
txcatcher-0.2.1 lib/txcatcher/models/deposit.rb
txcatcher-0.2.0 lib/txcatcher/models/deposit.rb
txcatcher-0.1.100 lib/txcatcher/models/deposit.rb
txcatcher-0.1.99 lib/txcatcher/models/deposit.rb
txcatcher-0.1.98 lib/txcatcher/models/deposit.rb
txcatcher-0.1.97 lib/txcatcher/models/deposit.rb
txcatcher-0.1.96 lib/txcatcher/models/deposit.rb
txcatcher-0.1.95 lib/txcatcher/models/deposit.rb
txcatcher-0.1.94 lib/txcatcher/models/deposit.rb
txcatcher-0.1.93 lib/txcatcher/models/deposit.rb
txcatcher-0.1.92 lib/txcatcher/models/deposit.rb
txcatcher-0.1.91 lib/txcatcher/models/deposit.rb
txcatcher-0.1.90 lib/txcatcher/models/deposit.rb
txcatcher-0.1.89 lib/txcatcher/models/deposit.rb
txcatcher-0.1.88 lib/txcatcher/models/deposit.rb
txcatcher-0.1.87 lib/txcatcher/models/deposit.rb
txcatcher-0.1.86 lib/txcatcher/models/deposit.rb