Module: LunchMoney

Defined in:
lib/lunchmoney/errors.rb,
lib/lunchmoney.rb,
lib/lunchmoney/api.rb,
lib/lunchmoney/version.rb,
lib/lunchmoney/deprecate.rb,
lib/lunchmoney/calls/base.rb,
lib/lunchmoney/calls/tags.rb,
lib/lunchmoney/exceptions.rb,
lib/lunchmoney/validators.rb,
lib/lunchmoney/calls/users.rb,
lib/lunchmoney/objects/tag.rb,
lib/lunchmoney/calls/assets.rb,
lib/lunchmoney/calls/crypto.rb,
lib/lunchmoney/objects/data.rb,
lib/lunchmoney/objects/user.rb,
lib/lunchmoney/calls/budgets.rb,
lib/lunchmoney/configuration.rb,
lib/lunchmoney/objects/asset.rb,
lib/lunchmoney/objects/split.rb,
lib/lunchmoney/objects/budget.rb,
lib/lunchmoney/objects/config.rb,
lib/lunchmoney/objects/crypto.rb,
lib/lunchmoney/objects/object.rb,
lib/lunchmoney/calls/categories.rb,
lib/lunchmoney/objects/category.rb,
lib/lunchmoney/objects/tag_base.rb,
lib/lunchmoney/calls/transactions.rb,
lib/lunchmoney/objects/crypto_base.rb,
lib/lunchmoney/objects/transaction.rb,
lib/lunchmoney/calls/plaid_accounts.rb,
lib/lunchmoney/objects/plaid_account.rb,
lib/lunchmoney/objects/child_category.rb,
lib/lunchmoney/calls/recurring_expenses.rb,
lib/lunchmoney/objects/transaction_base.rb,
lib/lunchmoney/objects/child_transaction.rb,
lib/lunchmoney/objects/recurring_expense.rb,
lib/lunchmoney/objects/update_transaction.rb,
lib/lunchmoney/objects/recurring_expense_base.rb,
lib/lunchmoney/objects/transaction_modification_base.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Modules: Calls, Deprecate, Objects, Validators Classes: Api, Configuration, Errors, Exception, InvalidApiKey, InvalidObjectAttribute, InvalidQueryParameter, MissingArgument

Constant Summary collapse

LOCK =

Lock used to avoid config conflicts

T.let(Mutex.new, Mutex)
VERSION =

Current version of the gem

"1.4.0"

Class Method Summary collapse

Class Method Details

.configurationLunchMoney::Configuration



44
45
46
47
# File 'lib/lunchmoney.rb', line 44

def configuration
  @configuration = T.let(nil, T.nilable(LunchMoney::Configuration)) unless defined?(@configuration)
  @configuration || LOCK.synchronize { @configuration = LunchMoney::Configuration.new }
end

.configure(&block) {|configuration| ... } ⇒ void

This method returns an undefined value.

Examples:

Set your API key

LunchMoney.configure do |config|
  config.api_key = "your_api_key"
end

Turn off object validation

LunchMoney.configure do |config|
  config.validate_object_attributes = false
end

Parameters:

Yields:



39
40
41
# File 'lib/lunchmoney.rb', line 39

def configure(&block)
  yield(configuration)
end

.validate_object_attributes?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/lunchmoney.rb', line 50

def validate_object_attributes?
  configuration.validate_object_attributes
end