Class: Fintoc::V1::Movement
- Inherits:
-
Object
- Object
- Fintoc::V1::Movement
- Defined in:
- lib/fintoc/v1/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:, client: nil) ⇒ 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:, client: nil) ⇒ Movement
Returns a new instance of Movement.
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 36 37 38 39 40 41 |
# File 'lib/fintoc/v1/resources/movement.rb', line 11 def initialize( id:, amount:, currency:, description:, post_date:, transaction_date:, type:, reference_id:, recipient_account:, sender_account:, comment:, client: nil, ** ) @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 = if recipient_account Fintoc::V1::TransferAccount.new(**recipient_account) end @sender_account = Fintoc::V1::TransferAccount.new(**sender_account) if sender_account @comment = comment @client = client end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def account @account end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def amount @amount end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def comment @comment end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def id @id end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def post_date @post_date end |
#recipient_account ⇒ Object (readonly)
Returns the value of attribute recipient_account.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def recipient_account @recipient_account end |
#reference_id ⇒ Object (readonly)
Returns the value of attribute reference_id.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def reference_id @reference_id end |
#sender_account ⇒ Object (readonly)
Returns the value of attribute sender_account.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def sender_account @sender_account end |
#transaction_date ⇒ Object (readonly)
Returns the value of attribute transaction_date.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def transaction_date @transaction_date end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/fintoc/v1/resources/movement.rb', line 7 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
43 44 45 |
# File 'lib/fintoc/v1/resources/movement.rb', line 43 def ==(other) @id == other.id end |
#hash ⇒ Object
49 50 51 |
# File 'lib/fintoc/v1/resources/movement.rb', line 49 def hash @id.hash end |
#locale_date ⇒ Object
53 54 55 |
# File 'lib/fintoc/v1/resources/movement.rb', line 53 def locale_date @post_date.strftime('%x') end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/fintoc/v1/resources/movement.rb', line 57 def to_s "#{@amount} (#{@description} @ #{locale_date})" end |