Class: Fintoc::V1::Movement

Inherits:
Object
  • Object
show all
Defined in:
lib/fintoc/v1/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:, 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()
  @transaction_date = DateTime.iso8601(transaction_date) if transaction_date
  @type = type
  @reference_id = reference_id
  @recipient_account =
    if 
      Fintoc::V1::TransferAccount.new(**)
    end
  @sender_account = Fintoc::V1::TransferAccount.new(**) if 
  @comment = comment
  @client = client
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



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

def 
  @account
end

#amountObject (readonly)

Returns the value of attribute amount.



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

def amount
  @amount
end

#commentObject (readonly)

Returns the value of attribute comment.



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

def comment
  @comment
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#post_dateObject (readonly)

Returns the value of attribute post_date.



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

def 
  @post_date
end

#recipient_accountObject (readonly)

Returns the value of attribute recipient_account.



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

def 
  @recipient_account
end

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

Returns the value of attribute sender_account.



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

def 
  @sender_account
end

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

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

#hashObject



49
50
51
# File 'lib/fintoc/v1/resources/movement.rb', line 49

def hash
  @id.hash
end

#locale_dateObject



53
54
55
# File 'lib/fintoc/v1/resources/movement.rb', line 53

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

#to_sObject



57
58
59
# File 'lib/fintoc/v1/resources/movement.rb', line 57

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