Class: Decent::StoreHodling

Inherits:
Object
  • Object
show all
Defined in:
lib/decent/command/hodling/store_hodling.rb

Class Method Summary collapse

Class Method Details

.store(hodling) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/decent/command/hodling/store_hodling.rb', line 3

def self.store(hodling)
  id                = hodling[:id]
  nickname          = hodling[:nickname]
  address           = hodling[:address]
  currency          = hodling[:currency]
  balance           = hodling[:balance]
  recorded_at       = hodling[:updated_at]
  created_at        = DateTime.now
  historic_hodlings = Database[:historic_holdings]

  historic_hodlings.insert({
    holding_id: id,
    nickname: nickname,
    address: address,
    currency: currency,
    balance: balance,
    recorded_at: recorded_at,
    created_at: created_at
  })
end