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 ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #asset_calls ⇒ Object
- #budget_calls ⇒ Object
- #category_calls ⇒ Object
- #crypto_calls ⇒ Object
-
#initialize(api_key: nil) ⇒ Api
constructor
A new instance of Api.
- #plaid_account_calls ⇒ Object
- #recurring_expense_calls ⇒ Object
- #tag_calls ⇒ Object
- #transaction_calls ⇒ Object
- #user_calls ⇒ Object
Constructor Details
#initialize(api_key: nil) ⇒ Api
Returns a new instance of Api.
31 32 33 |
# File 'lib/lunchmoney/api.rb', line 31 def initialize(api_key: nil) @api_key = T.let((api_key || LunchMoney.configuration.api_key), T.nilable(String)) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
28 29 30 |
# File 'lib/lunchmoney/api.rb', line 28 def api_key @api_key end |
Instance Method Details
#asset_calls ⇒ Object
222 223 224 225 226 |
# File 'lib/lunchmoney/api.rb', line 222 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 ⇒ Object
199 200 201 202 203 |
# File 'lib/lunchmoney/api.rb', line 199 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 ⇒ Object
85 86 87 88 89 |
# File 'lib/lunchmoney/api.rb', line 85 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 ⇒ Object
257 258 259 260 261 |
# File 'lib/lunchmoney/api.rb', line 257 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 ⇒ Object
238 239 240 241 242 243 244 245 |
# File 'lib/lunchmoney/api.rb', line 238 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 ⇒ Object
177 178 179 180 181 182 183 184 |
# File 'lib/lunchmoney/api.rb', line 177 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 ⇒ Object
98 99 100 101 102 |
# File 'lib/lunchmoney/api.rb', line 98 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 ⇒ Object
161 162 163 164 165 166 167 168 |
# File 'lib/lunchmoney/api.rb', line 161 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 ⇒ Object
42 43 44 45 46 |
# File 'lib/lunchmoney/api.rb', line 42 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 |