Class: Fintoc::Movement

Inherits:
Object
  • Object
show all
Defined in:
lib/fintoc/resources/movement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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()
  @transaction_date = DateTime.iso8601(transaction_date) if transaction_date
  @type = type
  @reference_id = reference_id
  @recipient_account = Fintoc::TransferAccount.new(**) if 
  @sender_account = Fintoc::TransferAccount.new(**) if 
  @comment = comment
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def 
  @account
end

#amountObject (readonly)

Returns the value of attribute amount.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def amount
  @amount
end

#commentObject (readonly)

Returns the value of attribute comment.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def comment
  @comment
end

#currencyObject (readonly)

Returns the value of attribute currency.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def id
  @id
end

#post_dateObject (readonly)

Returns the value of attribute post_date.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def 
  @post_date
end

#recipient_accountObject (readonly)

Returns the value of attribute recipient_account.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def 
  @recipient_account
end

#reference_idObject (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_accountObject (readonly)

Returns the value of attribute sender_account.



6
7
8
# File 'lib/fintoc/resources/movement.rb', line 6

def 
  @sender_account
end

#transaction_dateObject (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

#typeObject (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

#hashObject



43
44
45
# File 'lib/fintoc/resources/movement.rb', line 43

def hash
  @id.hash
end

#locale_dateObject



47
48
49
# File 'lib/fintoc/resources/movement.rb', line 47

def locale_date
  @post_date.strftime('%x')
end

#to_sObject



51
52
53
# File 'lib/fintoc/resources/movement.rb', line 51

def to_s
  "#{@amount} (#{@description} @ #{locale_date})"
end