Class: ExtrasDeCont::Transaction
- Inherits:
-
Object
- Object
- ExtrasDeCont::Transaction
- Defined in:
- lib/extras_de_cont/transaction.rb
Overview
Models a simple bank transaction
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#deduplication_key ⇒ Object
readonly
Returns the value of attribute deduplication_key.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(date, description, amount, currency, **options) ⇒ Transaction
constructor
A new instance of Transaction.
- #reverted? ⇒ Boolean
Constructor Details
#initialize(date, description, amount, currency, **options) ⇒ Transaction
Returns a new instance of Transaction.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/extras_de_cont/transaction.rb', line 10 def initialize( date, description, amount, currency, ** ) @date = date @description = description @amount = amount @currency = currency @state = [:state] @deduplication_key = [:deduplication_key] || build_deduplication_key end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def currency @currency end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def date @date end |
#deduplication_key ⇒ Object (readonly)
Returns the value of attribute deduplication_key.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def deduplication_key @deduplication_key end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def description @description end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
8 9 10 |
# File 'lib/extras_de_cont/transaction.rb', line 8 def state @state end |
Instance Method Details
#reverted? ⇒ Boolean
25 26 27 |
# File 'lib/extras_de_cont/transaction.rb', line 25 def reverted? state.to_s.casecmp?("REVERTED") end |