Sha256: 5615b7ba90d2e7ab4bc2ce313caf4972d1649414c3c3b8eb348ebd22ce7dd3ab

Contents?: true

Size: 451 Bytes

Versions: 21

Compression:

Stored size: 451 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
      Satoshi.new(self.amount, from_unit: :satoshi).to_btc
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
txcatcher-0.1.82 lib/txcatcher/models/deposit.rb
txcatcher-0.1.81 lib/txcatcher/models/deposit.rb
txcatcher-0.1.80 lib/txcatcher/models/deposit.rb
txcatcher-0.1.79 lib/txcatcher/models/deposit.rb
txcatcher-0.1.78 lib/txcatcher/models/deposit.rb
txcatcher-0.1.77 lib/txcatcher/models/deposit.rb
txcatcher-0.1.76 lib/txcatcher/models/deposit.rb
txcatcher-0.1.75 lib/txcatcher/models/deposit.rb
txcatcher-0.1.74 lib/txcatcher/models/deposit.rb
txcatcher-0.1.73 lib/txcatcher/models/deposit.rb
txcatcher-0.1.72 lib/txcatcher/models/deposit.rb
txcatcher-0.1.8 lib/txcatcher/models/deposit.rb
txcatcher-0.1.71 lib/txcatcher/models/deposit.rb
txcatcher-0.1.7 lib/txcatcher/models/deposit.rb
txcatcher-0.1.6 lib/txcatcher/models/deposit.rb
txcatcher-0.1.5 lib/txcatcher/models/deposit.rb
txcatcher-0.1.4 lib/txcatcher/models/deposit.rb
txcatcher-0.1.3 lib/txcatcher/models/deposit.rb
txcatcher-0.1.2 lib/txcatcher/models/deposit.rb
txcatcher-0.1.1 lib/txcatcher/models/deposit.rb