Class: Fintoc::Movement
- Inherits:
-
Object
- Object
- Fintoc::Movement
- Defined in:
- lib/fintoc/resources/movement.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#post_date ⇒ Object
readonly
Returns the value of attribute post_date.
-
#recipient_account ⇒ Object
readonly
Returns the value of attribute recipient_account.
-
#reference_id ⇒ Object
readonly
Returns the value of attribute reference_id.
-
#sender_account ⇒ Object
readonly
Returns the value of attribute sender_account.
-
#transaction_date ⇒ Object
readonly
Returns the value of attribute transaction_date.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(id:, amount:, currency:, description:, post_date:, transaction_date:, type:, reference_id:, recipient_account:, sender_account:, comment:) ⇒ Movement
constructor
A new instance of Movement.
- #locale_date ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id:, amount:, currency:, description:, post_date:, transaction_date:, type:, reference_id:, recipient_account:, sender_account:, comment:) ⇒ Movement
Returns a new instance of Movement.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fintoc/resources/movement.rb', line 10 def initialize( id:, amount:, currency:, description:, post_date:, transaction_date:, type:, reference_id:, recipient_account:, sender_account:, comment:, ** ) @id = id @amount = amount @currency = currency @description = description @post_date = DateTime.iso8601(post_date) @transaction_date = DateTime.iso8601(transaction_date) if transaction_date @type = type @reference_id = reference_id @recipient_account = Fintoc::TransferAccount.new(**recipient_account) if recipient_account @sender_account = Fintoc::TransferAccount.new(**sender_account) if sender_account @comment = comment end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def account @account end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def amount @amount end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def comment @comment end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def id @id end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def post_date @post_date end |
#recipient_account ⇒ Object (readonly)
Returns the value of attribute recipient_account.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def recipient_account @recipient_account end |
#reference_id ⇒ Object (readonly)
Returns the value of attribute reference_id.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def reference_id @reference_id end |
#sender_account ⇒ Object (readonly)
Returns the value of attribute sender_account.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def sender_account @sender_account end |
#transaction_date ⇒ Object (readonly)
Returns the value of attribute transaction_date.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def transaction_date @transaction_date end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/fintoc/resources/movement.rb', line 6 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
37 38 39 |
# File 'lib/fintoc/resources/movement.rb', line 37 def ==(other) @id = other.id end |
#hash ⇒ Object
43 44 45 |
# File 'lib/fintoc/resources/movement.rb', line 43 def hash @id.hash end |
#locale_date ⇒ Object
47 48 49 |
# File 'lib/fintoc/resources/movement.rb', line 47 def locale_date @post_date.strftime('%x') end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/fintoc/resources/movement.rb', line 51 def to_s "#{@amount} (#{@description} @ #{locale_date})" end |