Class: Fintoc::V2::Transfer
- Inherits:
-
Object
- Object
- Fintoc::V2::Transfer
- Defined in:
- lib/fintoc/v2/resources/transfer.rb
Instance Attribute Summary collapse
-
#account_number ⇒ Object
readonly
Returns the value of attribute account_number.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#counterparty ⇒ Object
readonly
Returns the value of attribute counterparty.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#post_date ⇒ Object
readonly
Returns the value of attribute post_date.
-
#receipt_url ⇒ Object
readonly
Returns the value of attribute receipt_url.
-
#reference_id ⇒ Object
readonly
Returns the value of attribute reference_id.
-
#return_reason ⇒ Object
readonly
Returns the value of attribute return_reason.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tracking_key ⇒ Object
readonly
Returns the value of attribute tracking_key.
-
#transaction_date ⇒ Object
readonly
Returns the value of attribute transaction_date.
Instance Method Summary collapse
- #failed? ⇒ Boolean
- #inbound? ⇒ Boolean
-
#initialize(id:, object:, amount:, currency:, status:, mode:, counterparty:, direction: nil, post_date: nil, transaction_date: nil, comment: nil, reference_id: nil, receipt_url: nil, tracking_key: nil, return_reason: nil, account_number: nil, metadata: {}, created_at: nil, client: nil) ⇒ Transfer
constructor
rubocop:disable Metrics/MethodLength.
- #outbound? ⇒ Boolean
- #pending? ⇒ Boolean
- #refresh ⇒ Object
- #rejected? ⇒ Boolean
- #return_pending? ⇒ Boolean
- #return_transfer(idempotency_key: nil) ⇒ Object
- #returned? ⇒ Boolean
- #succeeded? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(id:, object:, amount:, currency:, status:, mode:, counterparty:, direction: nil, post_date: nil, transaction_date: nil, comment: nil, reference_id: nil, receipt_url: nil, tracking_key: nil, return_reason: nil, account_number: nil, metadata: {}, created_at: nil, client: nil) ⇒ Transfer
rubocop:disable Metrics/MethodLength
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 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 11 def initialize( # rubocop:disable Metrics/MethodLength id:, object:, amount:, currency:, status:, mode:, counterparty:, direction: nil, post_date: nil, transaction_date: nil, comment: nil, reference_id: nil, receipt_url: nil, tracking_key: nil, return_reason: nil, account_number: nil, metadata: {}, created_at: nil, client: nil, ** ) @id = id @object = object @amount = amount @currency = currency @direction = direction @status = status @mode = mode @post_date = post_date @transaction_date = transaction_date @comment = comment @reference_id = reference_id @receipt_url = receipt_url @tracking_key = tracking_key @return_reason = return_reason @counterparty = counterparty @account_number = account_number @metadata = || {} @created_at = created_at @client = client end |
Instance Attribute Details
#account_number ⇒ Object (readonly)
Returns the value of attribute account_number.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def account_number @account_number end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def amount @amount end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def comment @comment end |
#counterparty ⇒ Object (readonly)
Returns the value of attribute counterparty.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def counterparty @counterparty end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def currency @currency end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def direction @direction end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def @metadata end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def mode @mode end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def object @object end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def post_date @post_date end |
#receipt_url ⇒ Object (readonly)
Returns the value of attribute receipt_url.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def receipt_url @receipt_url end |
#reference_id ⇒ Object (readonly)
Returns the value of attribute reference_id.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def reference_id @reference_id end |
#return_reason ⇒ Object (readonly)
Returns the value of attribute return_reason.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def return_reason @return_reason end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def status @status end |
#tracking_key ⇒ Object (readonly)
Returns the value of attribute tracking_key.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def tracking_key @tracking_key end |
#transaction_date ⇒ Object (readonly)
Returns the value of attribute transaction_date.
6 7 8 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 6 def transaction_date @transaction_date end |
Instance Method Details
#failed? ⇒ Boolean
78 79 80 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 78 def failed? @status == 'failed' end |
#inbound? ⇒ Boolean
94 95 96 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 94 def inbound? @direction == 'inbound' end |
#outbound? ⇒ Boolean
98 99 100 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 98 def outbound? @direction == 'outbound' end |
#pending? ⇒ Boolean
70 71 72 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 70 def pending? @status == 'pending' end |
#refresh ⇒ Object
60 61 62 63 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 60 def refresh fresh_transfer = @client.transfers.get(@id) refresh_from_transfer(fresh_transfer) end |
#rejected? ⇒ Boolean
90 91 92 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 90 def rejected? @status == 'rejected' end |
#return_pending? ⇒ Boolean
86 87 88 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 86 def return_pending? @status == 'return_pending' end |
#return_transfer(idempotency_key: nil) ⇒ Object
65 66 67 68 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 65 def return_transfer(idempotency_key: nil) returned_transfer = @client.transfers.return(@id, idempotency_key:) refresh_from_transfer(returned_transfer) end |
#returned? ⇒ Boolean
82 83 84 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 82 def returned? @status == 'returned' end |
#succeeded? ⇒ Boolean
74 75 76 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 74 def succeeded? @status == 'succeeded' end |
#to_s ⇒ Object
54 55 56 57 58 |
# File 'lib/fintoc/v2/resources/transfer.rb', line 54 def to_s amount_str = Money.from_cents(@amount, @currency).format direction_icon = inbound? ? '⬇️' : '⬆️' "#{direction_icon} #{amount_str} (#{@id}) - #{@status}" end |