Class: Norma43::Models::Transaction
- Inherits:
-
Object
- Object
- Norma43::Models::Transaction
- Includes:
- Mixins::AttributesAssignment
- Defined in:
- lib/norma43/models/transaction.rb
Constant Summary
Constants included from Mixins::AttributesAssignment
Mixins::AttributesAssignment::EMPTY_ATTRIBUTES
Instance Attribute Summary collapse
-
#additional_currency ⇒ Object
Returns the value of attribute additional_currency.
-
#additional_items ⇒ Object
Returns the value of attribute additional_items.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#amount_code ⇒ Object
Returns the value of attribute amount_code.
-
#document_number ⇒ Object
Returns the value of attribute document_number.
-
#origin_branch_code ⇒ Object
Returns the value of attribute origin_branch_code.
-
#own_item ⇒ Object
Returns the value of attribute own_item.
-
#reference_1 ⇒ Object
Returns the value of attribute reference_1.
-
#reference_2 ⇒ Object
Returns the value of attribute reference_2.
-
#shared_item ⇒ Object
Returns the value of attribute shared_item.
-
#transaction_date ⇒ Object
Returns the value of attribute transaction_date.
-
#value_date ⇒ Object
Returns the value of attribute value_date.
Instance Method Summary collapse
- #debit? ⇒ Boolean
-
#initialize(attributes = EMPTY_ATTRIBUTES) ⇒ Transaction
constructor
A new instance of Transaction.
Methods included from Mixins::AttributesAssignment
Constructor Details
#initialize(attributes = EMPTY_ATTRIBUTES) ⇒ Transaction
Returns a new instance of Transaction.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/norma43/models/transaction.rb', line 21 def initialize(attributes = EMPTY_ATTRIBUTES) @origin_branch_code, @transaction_date, @value_date, @shared_item, @own_item, @amount_code, @amount, @document_number, @reference_1, @reference_2, additional_items, additional_currency = Hash(attributes).values_at( :origin_branch_code, :transaction_date, :value_date, :shared_item, :own_item, :amount_code, :amount, :document_number, :reference_1, :reference_2) @additional_items = Array(additional_items).map { |attrs| AdditionalItem.new(attrs) } @additional_currency = AdditionalCurrency.new(additional_currency) if additional_currency end |
Instance Attribute Details
#additional_currency ⇒ Object
Returns the value of attribute additional_currency.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def additional_currency @additional_currency end |
#additional_items ⇒ Object
Returns the value of attribute additional_items.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def additional_items @additional_items end |
#amount ⇒ Object
Returns the value of attribute amount.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def amount @amount end |
#amount_code ⇒ Object
Returns the value of attribute amount_code.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def amount_code @amount_code end |
#document_number ⇒ Object
Returns the value of attribute document_number.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def document_number @document_number end |
#origin_branch_code ⇒ Object
Returns the value of attribute origin_branch_code.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def origin_branch_code @origin_branch_code end |
#own_item ⇒ Object
Returns the value of attribute own_item.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def own_item @own_item end |
#reference_1 ⇒ Object
Returns the value of attribute reference_1.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def reference_1 @reference_1 end |
#reference_2 ⇒ Object
Returns the value of attribute reference_2.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def reference_2 @reference_2 end |
#shared_item ⇒ Object
Returns the value of attribute shared_item.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def shared_item @shared_item end |
#transaction_date ⇒ Object
Returns the value of attribute transaction_date.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def transaction_date @transaction_date end |
#value_date ⇒ Object
Returns the value of attribute value_date.
8 9 10 |
# File 'lib/norma43/models/transaction.rb', line 8 def value_date @value_date end |
Instance Method Details
#debit? ⇒ Boolean
48 |
# File 'lib/norma43/models/transaction.rb', line 48 def debit?; self.amount_code == DEBIT_CODE end |