Class: LunchMoney::Api
- Inherits:
-
Object
- Object
- LunchMoney::Api
- Defined in:
- lib/lunchmoney/api.rb
Overview
The main API class that a user should interface through. The method of any individual call is delegated through here so that it is never necessary to go through things like LunchMoney::Calls::Users.new.user
instead you can directly call the endpoint with LunchMoney::Api.new.user and it will be delegated to the correct call.
Instance Attribute Summary collapse
- #api_key ⇒ String? readonly
Instance Method Summary collapse
-
#asset_calls ⇒ LunchMoney::Calls::Base
All assets call types come through here.
-
#budget_calls ⇒ LunchMoney::Calls::Base
All budget call types come through here.
-
#category_calls ⇒ LunchMoney::Calls::Base
All category call types come through here.
-
#crypto_calls ⇒ LunchMoney::Calls::Base
All crypto call types come through here.
- #initialize(api_key: nil) ⇒ void constructor
-
#plaid_account_calls ⇒ LunchMoney::Calls::Base
All Plaid accounts call types come through here.
-
#recurring_expense_calls ⇒ LunchMoney::Calls::Base
All recurring expenses call types come through here.
-
#tag_calls ⇒ LunchMoney::Calls::Base
All tags call types come through here.
-
#transaction_calls ⇒ LunchMoney::Calls::Base
All transaction call types come through here.
-
#user_calls ⇒ LunchMoney::Calls::Base
All user call types come through here.
Constructor Details
#initialize(api_key: nil) ⇒ void
32 33 34 |
# File 'lib/lunchmoney/api.rb', line 32 def initialize(api_key: nil) @api_key = T.let((api_key || LunchMoney.configuration.api_key), T.nilable(String)) end |
Instance Attribute Details
#api_key ⇒ String? (readonly)
29 30 31 |
# File 'lib/lunchmoney/api.rb', line 29 def api_key @api_key end |
Instance Method Details
#asset_calls ⇒ LunchMoney::Calls::Base
All assets call types come through here.
223 224 225 226 227 |
# File 'lib/lunchmoney/api.rb', line 223 def asset_calls with_valid_api_key do @asset_calls ||= T.let(LunchMoney::Calls::Assets.new(api_key:), T.nilable(LunchMoney::Calls::Assets)) end end |
#budget_calls ⇒ LunchMoney::Calls::Base
All budget call types come through here.
200 201 202 203 204 |
# File 'lib/lunchmoney/api.rb', line 200 def budget_calls with_valid_api_key do @budget_calls ||= T.let(LunchMoney::Calls::Budgets.new(api_key:), T.nilable(LunchMoney::Calls::Budgets)) end end |
#category_calls ⇒ LunchMoney::Calls::Base
All category call types come through here. Reference the docs for available parameters for each call
86 87 88 89 90 |
# File 'lib/lunchmoney/api.rb', line 86 def category_calls with_valid_api_key do @category_calls ||= T.let(LunchMoney::Calls::Categories.new(api_key:), T.nilable(LunchMoney::Calls::Categories)) end end |
#crypto_calls ⇒ LunchMoney::Calls::Base
All crypto call types come through here.
258 259 260 261 262 |
# File 'lib/lunchmoney/api.rb', line 258 def crypto_calls with_valid_api_key do @crypto_calls ||= T.let(LunchMoney::Calls::Crypto.new(api_key:), T.nilable(LunchMoney::Calls::Crypto)) end end |
#plaid_account_calls ⇒ LunchMoney::Calls::Base
All Plaid accounts call types come through here.
239 240 241 242 243 244 245 246 |
# File 'lib/lunchmoney/api.rb', line 239 def plaid_account_calls with_valid_api_key do @plaid_account_calls ||= T.let( LunchMoney::Calls::PlaidAccounts.new(api_key:), T.nilable(LunchMoney::Calls::PlaidAccounts), ) end end |
#recurring_expense_calls ⇒ LunchMoney::Calls::Base
All recurring expenses call types come through here.
178 179 180 181 182 183 184 185 |
# File 'lib/lunchmoney/api.rb', line 178 def recurring_expense_calls with_valid_api_key do @recurring_expense_calls ||= T.let( LunchMoney::Calls::RecurringExpenses.new(api_key:), T.nilable(LunchMoney::Calls::RecurringExpenses), ) end end |
#tag_calls ⇒ LunchMoney::Calls::Base
All tags call types come through here.
99 100 101 102 103 |
# File 'lib/lunchmoney/api.rb', line 99 def tag_calls with_valid_api_key do @tag_calls ||= T.let(LunchMoney::Calls::Tags.new(api_key:), T.nilable(LunchMoney::Calls::Tags)) end end |
#transaction_calls ⇒ LunchMoney::Calls::Base
All transaction call types come through here.
162 163 164 165 166 167 168 169 |
# File 'lib/lunchmoney/api.rb', line 162 def transaction_calls with_valid_api_key do @transaction_calls ||= T.let( LunchMoney::Calls::Transactions.new(api_key:), T.nilable(LunchMoney::Calls::Transactions), ) end end |
#user_calls ⇒ LunchMoney::Calls::Base
All user call types come through here.
43 44 45 46 47 |
# File 'lib/lunchmoney/api.rb', line 43 def user_calls with_valid_api_key do @user_calls ||= T.let(LunchMoney::Calls::Users.new(api_key:), T.nilable(LunchMoney::Calls::Users)) end end |