Class: LunchMoney::Calls::RecurringExpenses

Inherits:
Base
  • Object
show all
Defined in:
lib/lunchmoney/calls/recurring_expenses.rb

Overview

Constant Summary

Constants inherited from Base

Base::BASE_URL

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from LunchMoney::Calls::Base

Instance Method Details

#recurring_expenses(start_date: nil, end_date: nil) ⇒ Array<LunchMoney::Objects::RecurringExpense>, LunchMoney::Errors

Parameters:

  • start_date (String, nil) (defaults to: nil)
  • end_date (String, nil) (defaults to: nil)

Returns:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lunchmoney/calls/recurring_expenses.rb', line 16

def recurring_expenses(start_date: nil, end_date: nil)
  params = clean_params({ start_date:, end_date: })
  response = get("recurring_expenses", query_params: params)

  api_errors = errors(response)
  return api_errors if api_errors.present?

  response.body[:recurring_expenses].map do |recurring_expense|
    LunchMoney::Objects::RecurringExpense.new(**recurring_expense)
  end
end