Class: Clearbooks::Journal
Overview
Instance Attribute Summary collapse
-
#accounting_date ⇒ Object
readonly
Optional.
-
#description ⇒ Object
readonly
Required.
-
#entity ⇒ Object
readonly
Optional.
-
#ledgers ⇒ Object
readonly
Optional.
-
#project ⇒ Object
readonly
Optional.
Instance Method Summary collapse
-
#initialize(data) ⇒ Journal
constructor
A new instance of Journal.
-
#to_savon ⇒ Hash
Returns self as Savon readable Hash.
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ Journal
Returns a new instance of Journal.
46 47 48 49 50 51 52 |
# File 'lib/clearbooks/model/journal.rb', line 46 def initialize data @description = data.savon :description @accounting_date = parse_date data.savon :accounting_date @entity = data.savon :entity @project = data.savon :project @ledgers = Ledger.build data.savon :ledgers end |
Instance Attribute Details
#accounting_date ⇒ Object (readonly)
Optional. The accounting date of the journal. return [Date]
21 22 23 |
# File 'lib/clearbooks/model/journal.rb', line 21 def accounting_date @accounting_date end |
#description ⇒ Object (readonly)
Required. The description of the journal. return [String]
16 17 18 |
# File 'lib/clearbooks/model/journal.rb', line 16 def description @description end |
#entity ⇒ Object (readonly)
Optional. The ID of an entity attached to the journal. return [Fixnum]
26 27 28 |
# File 'lib/clearbooks/model/journal.rb', line 26 def entity @entity end |
#ledgers ⇒ Object (readonly)
Optional. An array of transactions added to the journal. Two items required. return [Array, Ledger]
36 37 38 |
# File 'lib/clearbooks/model/journal.rb', line 36 def ledgers @ledgers end |
#project ⇒ Object (readonly)
Optional. The ID of a project attached to the journal. return [Fixnum]
31 32 33 |
# File 'lib/clearbooks/model/journal.rb', line 31 def project @project end |
Instance Method Details
#to_savon ⇒ Hash
Returns self as Savon readable Hash
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/clearbooks/model/journal.rb', line 58 def to_savon { journal: { :@description => @description, :@accountingDate => @accounting_date.strftime('%F'), :@entity => @entity, :@project => @project, :ledgers => @ledgers.map(&:to_savon) }.compact } end |