Class: Dinie::Resources::Loans::Transactions
- Inherits:
-
Object
- Object
- Dinie::Resources::Loans::Transactions
- Defined in:
- lib/dinie/generated/resources/loans.rb
Overview
Operations on the transactions resource.
Instance Method Summary collapse
-
#initialize(http) ⇒ Transactions
constructor
A new instance of Transactions.
-
#list(loan_id, limit: Internal::OMIT, starting_after: Internal::OMIT, request_options: {}) ⇒ Object
List loan transactions.
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
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 |