Module: LunchMoney::Deprecate

Included in:
Calls::RecurringExpenses
Defined in:
lib/lunchmoney/deprecate.rb

Instance Method Summary collapse

Instance Method Details

#deprecate_endpoint(replacement = nil, level: :warning) ⇒ void

This method returns an undefined value.

Parameters:

  • replacement (String, nil) (defaults to: nil)
  • level (Symbol) (defaults to: :warning)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/lunchmoney/deprecate.rb', line 9

def deprecate_endpoint(replacement = nil, level: :warning)
  return unless endpoint_deprecation_warnings
  return if ENV["SILENCE_LUNCHMONEY_DEPRECATIONS"] == "true"

  replacement_message = if replacement.nil?
    "There is currently no replacement for this endpoint"
  else
    "Please use #{replacement} instead"
  end

  endpoint_name = deprecated_endpoint
  message = "#{endpoint_name} is deprecated and may be removed from LunchMoney | #{replacement_message}"

  log_deprecation(message, level, endpoint_name, replacement)
end