Class: Clearbooks::Ledger

Inherits:
Base
  • Object
show all
Defined in:
lib/clearbooks/model/ledger.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

build, create

Constructor Details

#initialize(data) ⇒ Ledger

Returns a new instance of Ledger.

Parameters:



30
31
32
33
# File 'lib/clearbooks/model/ledger.rb', line 30

def initialize data
  @account = data.savon :account
  @amount = BigDecimal.new data.savon :amount
end

Instance Attribute Details

#accountString (readonly)

Optional. Account code for associated transaction.



16
17
18
# File 'lib/clearbooks/model/ledger.rb', line 16

def 
  @account
end

#amountBigDecimal (readonly)

Optional. Amount for associated transaction in the journal.



21
22
23
# File 'lib/clearbooks/model/ledger.rb', line 21

def amount
  @amount
end

Instance Method Details

#to_savonHash

Returns self as Savon readable Hash

Returns:

  • (Hash)

    Returns self as Savon readable Hash



39
40
41
42
43
44
45
46
# File 'lib/clearbooks/model/ledger.rb', line 39

def to_savon
  {
    ledger: {
      :@account => @account,
      :@amount => @amount.to_f
    }.compact
  }
end