Class: Dinie::Resources::Loans::Transactions

Inherits:
Object
  • Object
show all
Defined in:
lib/dinie/generated/resources/loans.rb

Overview

Operations on the transactions resource.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Transactions

Returns a new instance of Transactions.



46
47
48
# File 'lib/dinie/generated/resources/loans.rb', line 46

def initialize(http)
  @http = http
end

Instance Method Details

#list(loan_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {}) ⇒ Object

List loan transactions

List installment transactions for a loan with due dates, amounts, and payment status

Parameters:

  • loan_id (String)

    Identificador Ășnico do emprĂ©stimo

  • request_options (Hash) (defaults to: {})

    Request options.

Returns:

  • (Object)


57
58
59
60
61
62
63
64
65
66
# File 'lib/dinie/generated/resources/loans.rb', line 57

def list(loan_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {})
  path = "/loans/#{loan_id}/transactions"
  fetch_page = lambda do |cursor|
    query = { limit:, starting_after: cursor || starting_after }
            .reject { |_key, value| Internal.omitted?(value) }
    body = @http.request(method: :get, path:, query:, request_options:)
    { data: body[:data].map { |raw| Transaction.deserialize(raw) }, has_more: body[:has_more] }
  end
  Dinie::Page.from_fetch(fetch_page)
end