lunchmoney 0.10.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/publish_gem.yml +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +41 -4
- data/lib/lunchmoney/api.rb +34 -34
- data/lib/lunchmoney/calls/assets.rb +98 -0
- data/lib/lunchmoney/calls/base.rb +112 -0
- data/lib/lunchmoney/calls/budgets.rb +84 -0
- data/lib/lunchmoney/calls/categories.rb +196 -0
- data/lib/lunchmoney/calls/crypto.rb +50 -0
- data/lib/lunchmoney/calls/plaid_accounts.rb +40 -0
- data/lib/lunchmoney/calls/recurring_expenses.rb +29 -0
- data/lib/lunchmoney/calls/tags.rb +21 -0
- data/lib/lunchmoney/calls/transactions.rb +220 -0
- data/lib/lunchmoney/calls/users.rb +21 -0
- data/lib/lunchmoney/objects/asset.rb +91 -0
- data/lib/lunchmoney/objects/budget.rb +76 -0
- data/lib/lunchmoney/objects/category.rb +55 -0
- data/lib/lunchmoney/objects/child_category.rb +44 -0
- data/lib/lunchmoney/objects/child_transaction.rb +35 -0
- data/lib/lunchmoney/objects/config.rb +40 -0
- data/lib/lunchmoney/objects/crypto.rb +46 -0
- data/lib/lunchmoney/objects/crypto_base.rb +67 -0
- data/lib/lunchmoney/objects/data.rb +44 -0
- data/lib/lunchmoney/objects/object.rb +28 -0
- data/lib/lunchmoney/objects/plaid_account.rb +75 -0
- data/lib/lunchmoney/objects/recurring_expense.rb +68 -0
- data/lib/lunchmoney/objects/recurring_expense_base.rb +31 -0
- data/lib/lunchmoney/objects/split.rb +28 -0
- data/lib/lunchmoney/objects/tag.rb +24 -0
- data/lib/lunchmoney/objects/tag_base.rb +23 -0
- data/lib/lunchmoney/objects/transaction.rb +160 -0
- data/lib/lunchmoney/objects/transaction_base.rb +54 -0
- data/lib/lunchmoney/objects/transaction_modification_base.rb +32 -0
- data/lib/lunchmoney/objects/update_transaction.rb +47 -0
- data/lib/lunchmoney/objects/user.rb +38 -0
- data/lib/lunchmoney/version.rb +1 -1
- data/lunchmoney.gemspec +1 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.rbi +122 -22
- metadata +33 -32
- data/lib/lunchmoney/api_call.rb +0 -109
- data/lib/lunchmoney/assets/asset.rb +0 -89
- data/lib/lunchmoney/assets/asset_calls.rb +0 -96
- data/lib/lunchmoney/budget/budget.rb +0 -74
- data/lib/lunchmoney/budget/budget_calls.rb +0 -82
- data/lib/lunchmoney/budget/config.rb +0 -38
- data/lib/lunchmoney/budget/data.rb +0 -42
- data/lib/lunchmoney/categories/category/category.rb +0 -52
- data/lib/lunchmoney/categories/category/child_category.rb +0 -42
- data/lib/lunchmoney/categories/category_calls.rb +0 -195
- data/lib/lunchmoney/crypto/crypto/crypto.rb +0 -43
- data/lib/lunchmoney/crypto/crypto/crypto_base.rb +0 -65
- data/lib/lunchmoney/crypto/crypto_calls.rb +0 -49
- data/lib/lunchmoney/data_object.rb +0 -25
- data/lib/lunchmoney/plaid_accounts/plaid_account.rb +0 -73
- data/lib/lunchmoney/plaid_accounts/plaid_account_calls.rb +0 -38
- data/lib/lunchmoney/recurring_expenses/recurring_expense/recurring_expense.rb +0 -65
- data/lib/lunchmoney/recurring_expenses/recurring_expense/recurring_expense_base.rb +0 -29
- data/lib/lunchmoney/recurring_expenses/recurring_expense_calls.rb +0 -28
- data/lib/lunchmoney/tags/tag/tag.rb +0 -20
- data/lib/lunchmoney/tags/tag/tag_base.rb +0 -21
- data/lib/lunchmoney/tags/tag_calls.rb +0 -20
- data/lib/lunchmoney/transactions/transaction/child_transaction.rb +0 -31
- data/lib/lunchmoney/transactions/transaction/split.rb +0 -24
- data/lib/lunchmoney/transactions/transaction/transaction.rb +0 -156
- data/lib/lunchmoney/transactions/transaction/transaction_base.rb +0 -52
- data/lib/lunchmoney/transactions/transaction/transaction_modification_base.rb +0 -30
- data/lib/lunchmoney/transactions/transaction/update_transaction.rb +0 -43
- data/lib/lunchmoney/transactions/transaction_calls.rb +0 -218
- data/lib/lunchmoney/user/user.rb +0 -36
- data/lib/lunchmoney/user/user_calls.rb +0 -19
@@ -0,0 +1,76 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "data"
|
5
|
+
require_relative "config"
|
6
|
+
|
7
|
+
module LunchMoney
|
8
|
+
module Objects
|
9
|
+
# https://lunchmoney.dev/#budget-object
|
10
|
+
class Budget < LunchMoney::Objects::Object
|
11
|
+
# API object reference documentation: https://lunchmoney.dev/#budget-object
|
12
|
+
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_accessor :category_name
|
15
|
+
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :order
|
18
|
+
|
19
|
+
sig { returns(T.nilable(String)) }
|
20
|
+
attr_accessor :category_group_name
|
21
|
+
|
22
|
+
sig { returns(T.nilable(Integer)) }
|
23
|
+
attr_accessor :category_id, :group_id
|
24
|
+
|
25
|
+
sig { returns(T.nilable(T::Boolean)) }
|
26
|
+
attr_accessor :is_group
|
27
|
+
|
28
|
+
sig { returns(T::Boolean) }
|
29
|
+
attr_accessor :is_income, :exclude_from_budget, :exclude_from_totals, :archived
|
30
|
+
|
31
|
+
sig { returns(T::Hash[Symbol, LunchMoney::Objects::Data]) }
|
32
|
+
attr_accessor :data
|
33
|
+
|
34
|
+
sig { returns(T.nilable(T::Hash[Symbol, LunchMoney::Objects::Config])) }
|
35
|
+
attr_accessor :config
|
36
|
+
|
37
|
+
sig { returns(T.nilable({ list: T::Array[LunchMoney::Objects::RecurringExpense] })) }
|
38
|
+
attr_accessor :recurring
|
39
|
+
|
40
|
+
sig do
|
41
|
+
params(
|
42
|
+
is_income: T::Boolean,
|
43
|
+
exclude_from_budget: T::Boolean,
|
44
|
+
exclude_from_totals: T::Boolean,
|
45
|
+
data: T::Hash[Symbol, LunchMoney::Objects::Data],
|
46
|
+
category_name: String,
|
47
|
+
order: Integer,
|
48
|
+
archived: T::Boolean,
|
49
|
+
category_id: T.nilable(Integer),
|
50
|
+
category_group_name: T.nilable(String),
|
51
|
+
group_id: T.nilable(Integer),
|
52
|
+
is_group: T.nilable(T::Boolean),
|
53
|
+
config: T.nilable(T::Hash[Symbol, LunchMoney::Objects::Config]),
|
54
|
+
recurring: T.nilable({ list: T::Array[LunchMoney::Objects::RecurringExpense] }),
|
55
|
+
).void
|
56
|
+
end
|
57
|
+
def initialize(is_income:, exclude_from_budget:, exclude_from_totals:, data:, category_name:, order:, archived:,
|
58
|
+
category_id: nil, category_group_name: nil, group_id: nil, is_group: nil, config: nil, recurring: nil)
|
59
|
+
super()
|
60
|
+
@category_id = category_id
|
61
|
+
@is_income = is_income
|
62
|
+
@exclude_from_budget = exclude_from_budget
|
63
|
+
@exclude_from_totals = exclude_from_totals
|
64
|
+
@data = data
|
65
|
+
@category_name = category_name
|
66
|
+
@order = order
|
67
|
+
@category_group_name = category_group_name
|
68
|
+
@group_id = group_id
|
69
|
+
@is_group = is_group
|
70
|
+
@config = config
|
71
|
+
@archived = archived
|
72
|
+
@recurring = recurring
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "child_category"
|
5
|
+
module LunchMoney
|
6
|
+
module Objects
|
7
|
+
# https://lunchmoney.dev/#categories-object
|
8
|
+
class Category < ChildCategory
|
9
|
+
sig { returns(T.nilable(String)) }
|
10
|
+
attr_accessor :group_category_name
|
11
|
+
|
12
|
+
sig { returns(T::Boolean) }
|
13
|
+
attr_accessor :is_income, :exclude_from_budget, :exclude_from_totals, :is_group
|
14
|
+
|
15
|
+
sig { returns(T.nilable(Integer)) }
|
16
|
+
attr_accessor :group_id, :order
|
17
|
+
|
18
|
+
sig { returns(T.nilable(T::Array[T.any(LunchMoney::Objects::Category, LunchMoney::Objects::ChildCategory)])) }
|
19
|
+
attr_accessor :children
|
20
|
+
|
21
|
+
sig do
|
22
|
+
params(
|
23
|
+
id: Integer,
|
24
|
+
name: String,
|
25
|
+
is_income: T::Boolean,
|
26
|
+
exclude_from_budget: T::Boolean,
|
27
|
+
exclude_from_totals: T::Boolean,
|
28
|
+
is_group: T::Boolean,
|
29
|
+
archived: T.nilable(T::Boolean),
|
30
|
+
archived_on: T.nilable(String),
|
31
|
+
updated_at: T.nilable(String),
|
32
|
+
created_at: T.nilable(String),
|
33
|
+
group_id: T.nilable(Integer),
|
34
|
+
order: T.nilable(Integer),
|
35
|
+
description: T.nilable(String),
|
36
|
+
children: T.nilable(T::Array[T.any(LunchMoney::Objects::Category, LunchMoney::Objects::ChildCategory)]),
|
37
|
+
group_category_name: T.nilable(String),
|
38
|
+
).void
|
39
|
+
end
|
40
|
+
def initialize(id:, name:, is_income:, exclude_from_budget:, exclude_from_totals:, is_group:, archived: nil,
|
41
|
+
archived_on: nil, updated_at: nil, created_at: nil, group_id: nil, order: nil, description: nil, children: nil,
|
42
|
+
group_category_name: nil)
|
43
|
+
super(id:, name:, archived:, archived_on:, updated_at:, created_at:, description:)
|
44
|
+
@is_income = is_income
|
45
|
+
@exclude_from_budget = exclude_from_budget
|
46
|
+
@exclude_from_totals = exclude_from_totals
|
47
|
+
@is_group = is_group
|
48
|
+
@group_id = group_id
|
49
|
+
@order = order
|
50
|
+
@children = children
|
51
|
+
@group_category_name = group_category_name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# A slimmed down version of https://lunchmoney.dev/#categories-object used in the
|
7
|
+
# `children` field of some category calls
|
8
|
+
class ChildCategory < LunchMoney::Objects::Object
|
9
|
+
sig { returns(Integer) }
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_accessor :name
|
14
|
+
|
15
|
+
sig { returns(T.nilable(String)) }
|
16
|
+
attr_accessor :description, :archived_on, :updated_at, :created_at
|
17
|
+
|
18
|
+
sig { returns(T.nilable(T::Boolean)) }
|
19
|
+
attr_accessor :archived
|
20
|
+
|
21
|
+
sig do
|
22
|
+
params(
|
23
|
+
id: Integer,
|
24
|
+
name: String,
|
25
|
+
archived: T.nilable(T::Boolean),
|
26
|
+
archived_on: T.nilable(String),
|
27
|
+
updated_at: T.nilable(String),
|
28
|
+
created_at: T.nilable(String),
|
29
|
+
description: T.nilable(String),
|
30
|
+
).void
|
31
|
+
end
|
32
|
+
def initialize(id:, name:, archived: nil, archived_on: nil, updated_at: nil, created_at: nil, description: nil)
|
33
|
+
super()
|
34
|
+
@id = id
|
35
|
+
@name = name
|
36
|
+
@archived = archived
|
37
|
+
@archived_on = archived_on
|
38
|
+
@updated_at = updated_at
|
39
|
+
@created_at = created_at
|
40
|
+
@description = description
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "transaction_base"
|
5
|
+
|
6
|
+
module LunchMoney
|
7
|
+
module Objects
|
8
|
+
# Slimmed down version of https://lunchmoney.dev/#transaction-object used in the
|
9
|
+
# `children` field of a transaction object with an additional `formatted_date`` field
|
10
|
+
class ChildTransaction < TransactionBase
|
11
|
+
sig { returns(String) }
|
12
|
+
attr_accessor :formatted_date
|
13
|
+
|
14
|
+
sig do
|
15
|
+
params(
|
16
|
+
id: Integer,
|
17
|
+
date: String,
|
18
|
+
amount: String,
|
19
|
+
currency: String,
|
20
|
+
to_base: Number,
|
21
|
+
payee: String,
|
22
|
+
formatted_date: String,
|
23
|
+
notes: T.nilable(String),
|
24
|
+
asset_id: T.nilable(Integer),
|
25
|
+
plaid_account_id: T.nilable(Integer),
|
26
|
+
).void
|
27
|
+
end
|
28
|
+
def initialize(id:, date:, amount:, currency:, to_base:, payee:, formatted_date:, notes: nil, asset_id: nil,
|
29
|
+
plaid_account_id: nil)
|
30
|
+
super(id:, date:, amount:, currency:, to_base:, payee:, notes:, asset_id:, plaid_account_id:)
|
31
|
+
@formatted_date = formatted_date
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#config-object
|
7
|
+
class Config < LunchMoney::Objects::Object
|
8
|
+
# API object reference documentation: https://lunchmoney.dev/#config-object
|
9
|
+
|
10
|
+
sig { returns(Integer) }
|
11
|
+
attr_accessor :config_id
|
12
|
+
|
13
|
+
sig { returns(Number) }
|
14
|
+
attr_accessor :amount, :to_base
|
15
|
+
|
16
|
+
sig { returns(String) }
|
17
|
+
attr_accessor :cadence, :currency, :auto_suggest
|
18
|
+
|
19
|
+
sig do
|
20
|
+
params(
|
21
|
+
config_id: Integer,
|
22
|
+
cadence: String,
|
23
|
+
amount: Number,
|
24
|
+
currency: String,
|
25
|
+
to_base: Number,
|
26
|
+
auto_suggest: String,
|
27
|
+
).void
|
28
|
+
end
|
29
|
+
def initialize(config_id:, cadence:, amount:, currency:, to_base:, auto_suggest:)
|
30
|
+
super()
|
31
|
+
@config_id = config_id
|
32
|
+
@cadence = cadence
|
33
|
+
@amount = amount
|
34
|
+
@currency = currency
|
35
|
+
@to_base = to_base
|
36
|
+
@auto_suggest = auto_suggest
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "crypto_base"
|
5
|
+
module LunchMoney
|
6
|
+
module Objects
|
7
|
+
# https://lunchmoney.dev/#crypto-object
|
8
|
+
class Crypto < CryptoBase
|
9
|
+
include LunchMoney::Validators
|
10
|
+
|
11
|
+
sig { returns(String) }
|
12
|
+
attr_reader :balance_as_of
|
13
|
+
|
14
|
+
sig { returns(String) }
|
15
|
+
attr_accessor :currency, :status
|
16
|
+
|
17
|
+
sig do
|
18
|
+
params(
|
19
|
+
created_at: String,
|
20
|
+
source: String,
|
21
|
+
name: String,
|
22
|
+
balance: String,
|
23
|
+
balance_as_of: String,
|
24
|
+
currency: String,
|
25
|
+
status: String,
|
26
|
+
institution_name: T.nilable(String),
|
27
|
+
id: T.nilable(Integer),
|
28
|
+
zabo_account_id: T.nilable(Integer),
|
29
|
+
display_name: T.nilable(String),
|
30
|
+
).void
|
31
|
+
end
|
32
|
+
def initialize(created_at:, source:, name:, balance:, balance_as_of:, currency:,
|
33
|
+
status:, institution_name: nil, id: nil, zabo_account_id: nil, display_name: nil)
|
34
|
+
super(created_at:, source:, name:, balance:, institution_name:, id:, zabo_account_id:, display_name:)
|
35
|
+
@balance_as_of = T.let(validate_iso8601!(balance_as_of), String)
|
36
|
+
@currency = currency
|
37
|
+
@status = status
|
38
|
+
end
|
39
|
+
|
40
|
+
sig { params(time: String).void }
|
41
|
+
def balance_as_of=(time)
|
42
|
+
@balance_as_of = validate_iso8601!(time)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#crypto-object
|
7
|
+
class CryptoBase < LunchMoney::Objects::Object
|
8
|
+
include LunchMoney::Validators
|
9
|
+
|
10
|
+
sig { returns(T.nilable(Integer)) }
|
11
|
+
attr_accessor :id, :zabo_account_id
|
12
|
+
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_reader :source, :created_at
|
15
|
+
|
16
|
+
sig { returns(String) }
|
17
|
+
attr_accessor :name, :balance
|
18
|
+
|
19
|
+
sig { returns(T.nilable(String)) }
|
20
|
+
attr_accessor :display_name, :institution_name
|
21
|
+
|
22
|
+
# Valid crypto source types
|
23
|
+
VALID_SOURCES = T.let(
|
24
|
+
[
|
25
|
+
"synced",
|
26
|
+
"manual",
|
27
|
+
],
|
28
|
+
T::Array[String],
|
29
|
+
)
|
30
|
+
|
31
|
+
sig do
|
32
|
+
params(
|
33
|
+
created_at: String,
|
34
|
+
source: String,
|
35
|
+
name: String,
|
36
|
+
balance: String,
|
37
|
+
institution_name: T.nilable(String),
|
38
|
+
id: T.nilable(Integer),
|
39
|
+
zabo_account_id: T.nilable(Integer),
|
40
|
+
display_name: T.nilable(String),
|
41
|
+
).void
|
42
|
+
end
|
43
|
+
def initialize(created_at:, source:, name:, balance:, institution_name: nil, id: nil, zabo_account_id: nil,
|
44
|
+
display_name: nil)
|
45
|
+
super()
|
46
|
+
@created_at = T.let(validate_iso8601!(created_at), String)
|
47
|
+
@source = T.let(validate_one_of!(source, VALID_SOURCES), String)
|
48
|
+
@name = name
|
49
|
+
@balance = balance
|
50
|
+
@institution_name = institution_name
|
51
|
+
@id = id
|
52
|
+
@zabo_account_id = zabo_account_id
|
53
|
+
@display_name = display_name
|
54
|
+
end
|
55
|
+
|
56
|
+
sig { params(name: String).void }
|
57
|
+
def source=(name)
|
58
|
+
@source = validate_one_of!(name, VALID_SOURCES)
|
59
|
+
end
|
60
|
+
|
61
|
+
sig { params(time: String).void }
|
62
|
+
def created_at=(time)
|
63
|
+
@created_at = validate_iso8601!(time)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#data-object
|
7
|
+
class Data < LunchMoney::Objects::Object
|
8
|
+
# API object reference documentation: https://lunchmoney.dev/#data-object
|
9
|
+
|
10
|
+
sig { returns(T.nilable(Integer)) }
|
11
|
+
attr_accessor :num_transactions
|
12
|
+
|
13
|
+
sig { returns(T.nilable(Number)) }
|
14
|
+
attr_accessor :budget_amount, :budget_to_base, :spending_to_base
|
15
|
+
|
16
|
+
sig { returns(T.nilable(String)) }
|
17
|
+
attr_accessor :budget_currency
|
18
|
+
|
19
|
+
sig { returns(T.nilable(T::Boolean)) }
|
20
|
+
attr_accessor :is_automated
|
21
|
+
|
22
|
+
sig do
|
23
|
+
params(
|
24
|
+
spending_to_base: T.nilable(Number),
|
25
|
+
num_transactions: T.nilable(Integer),
|
26
|
+
budget_amount: T.nilable(Number),
|
27
|
+
budget_currency: T.nilable(String),
|
28
|
+
budget_to_base: T.nilable(Number),
|
29
|
+
is_automated: T.nilable(T::Boolean),
|
30
|
+
).void
|
31
|
+
end
|
32
|
+
def initialize(spending_to_base: nil, num_transactions: nil, budget_amount: nil, budget_currency: nil,
|
33
|
+
budget_to_base: nil, is_automated: nil)
|
34
|
+
super()
|
35
|
+
@budget_amount = budget_amount
|
36
|
+
@budget_currency = budget_currency
|
37
|
+
@budget_to_base = budget_to_base
|
38
|
+
@spending_to_base = spending_to_base
|
39
|
+
@num_transactions = num_transactions
|
40
|
+
@is_automated = is_automated
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
# Namespace for data objects that represent objects returned from the API
|
6
|
+
module Objects
|
7
|
+
# Base data object for the objects returned and used when calling the LunchMoney API
|
8
|
+
class Object
|
9
|
+
sig { params(symbolize_keys: T::Boolean).returns(T::Hash[String, T.untyped]) }
|
10
|
+
def serialize(symbolize_keys: false)
|
11
|
+
ivars = instance_variables
|
12
|
+
|
13
|
+
output = {}
|
14
|
+
|
15
|
+
ivars.each do |ivar|
|
16
|
+
key = ivar.to_s.gsub("@", "")
|
17
|
+
key = key.to_sym if symbolize_keys
|
18
|
+
|
19
|
+
value = instance_variable_get(ivar)
|
20
|
+
|
21
|
+
output[key] = value
|
22
|
+
end
|
23
|
+
|
24
|
+
output
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#plaid-accounts-object
|
7
|
+
class PlaidAccount < LunchMoney::Objects::Object
|
8
|
+
sig { returns(Integer) }
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
sig { returns(String) }
|
12
|
+
attr_accessor :date_linked,
|
13
|
+
:name,
|
14
|
+
:type,
|
15
|
+
:mask,
|
16
|
+
:institution_name,
|
17
|
+
:status,
|
18
|
+
:balance,
|
19
|
+
:currency,
|
20
|
+
:balance_last_update,
|
21
|
+
:display_name,
|
22
|
+
:plaid_last_successful_update
|
23
|
+
|
24
|
+
sig { returns(T.nilable(String)) }
|
25
|
+
attr_accessor :subtype, :import_start_date, :last_fetch, :last_import
|
26
|
+
|
27
|
+
sig { returns(T.nilable(Integer)) }
|
28
|
+
attr_accessor :limit
|
29
|
+
|
30
|
+
sig do
|
31
|
+
params(
|
32
|
+
date_linked: String,
|
33
|
+
name: String,
|
34
|
+
type: String,
|
35
|
+
mask: String,
|
36
|
+
institution_name: String,
|
37
|
+
status: String,
|
38
|
+
balance: String,
|
39
|
+
currency: String,
|
40
|
+
balance_last_update: String,
|
41
|
+
display_name: String,
|
42
|
+
id: Integer,
|
43
|
+
plaid_last_successful_update: String,
|
44
|
+
last_import: T.nilable(String),
|
45
|
+
limit: T.nilable(Integer),
|
46
|
+
subtype: T.nilable(String),
|
47
|
+
import_start_date: T.nilable(String),
|
48
|
+
last_fetch: T.nilable(String),
|
49
|
+
).void
|
50
|
+
end
|
51
|
+
def initialize(date_linked:, name:, type:, mask:, institution_name:, status:, balance:, currency:,
|
52
|
+
balance_last_update:, display_name:, id:, plaid_last_successful_update:, last_import: nil, limit: nil,
|
53
|
+
subtype: nil, import_start_date: nil, last_fetch: nil)
|
54
|
+
super()
|
55
|
+
@id = id
|
56
|
+
@date_linked = date_linked
|
57
|
+
@name = name
|
58
|
+
@display_name = display_name
|
59
|
+
@type = type
|
60
|
+
@subtype = subtype
|
61
|
+
@mask = mask
|
62
|
+
@institution_name = institution_name
|
63
|
+
@status = status
|
64
|
+
@limit = limit
|
65
|
+
@balance = balance
|
66
|
+
@currency = currency
|
67
|
+
@balance_last_update = balance_last_update
|
68
|
+
@import_start_date = import_start_date
|
69
|
+
@last_import = last_import
|
70
|
+
@last_fetch = last_fetch
|
71
|
+
@plaid_last_successful_update = plaid_last_successful_update
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "recurring_expense_base"
|
5
|
+
module LunchMoney
|
6
|
+
module Objects
|
7
|
+
# https://lunchmoney.dev/#recurring-expenses-object
|
8
|
+
class RecurringExpense < RecurringExpenseBase
|
9
|
+
sig { returns(Integer) }
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
sig { returns(T.nilable(String)) }
|
13
|
+
attr_accessor :start_date, :end_date, :description, :original_name
|
14
|
+
|
15
|
+
sig { returns(String) }
|
16
|
+
attr_accessor :cadence, :billing_date, :type, :source, :created_at
|
17
|
+
|
18
|
+
sig { returns(T.nilable(Integer)) }
|
19
|
+
attr_accessor :plaid_account_id, :asset_id, :transaction_id, :category_id
|
20
|
+
|
21
|
+
sig do
|
22
|
+
params(
|
23
|
+
cadence: String,
|
24
|
+
payee: String,
|
25
|
+
amount: String,
|
26
|
+
currency: String,
|
27
|
+
billing_date: String,
|
28
|
+
type: String,
|
29
|
+
source: String,
|
30
|
+
id: Integer,
|
31
|
+
created_at: String,
|
32
|
+
category_id: T.nilable(Integer),
|
33
|
+
start_date: T.nilable(String),
|
34
|
+
end_date: T.nilable(String),
|
35
|
+
description: T.nilable(String),
|
36
|
+
original_name: T.nilable(String),
|
37
|
+
plaid_account_id: T.nilable(Integer),
|
38
|
+
asset_id: T.nilable(Integer),
|
39
|
+
transaction_id: T.nilable(Integer),
|
40
|
+
to_base: T.nilable(Number),
|
41
|
+
).void
|
42
|
+
end
|
43
|
+
def initialize(cadence:, payee:, amount:, currency:, billing_date:, type:, source:, id:, created_at:,
|
44
|
+
category_id: nil, start_date: nil, end_date: nil, description: nil, original_name: nil, plaid_account_id: nil,
|
45
|
+
asset_id: nil, transaction_id: nil, to_base: nil)
|
46
|
+
super(payee:, amount:, currency:, to_base:)
|
47
|
+
@cadence = cadence
|
48
|
+
@payee = payee
|
49
|
+
@amount = amount
|
50
|
+
@currency = currency
|
51
|
+
@billing_date = billing_date
|
52
|
+
@type = type
|
53
|
+
@source = source
|
54
|
+
@id = id
|
55
|
+
@category_id = category_id
|
56
|
+
@created_at = created_at
|
57
|
+
@start_date = start_date
|
58
|
+
@end_date = end_date
|
59
|
+
@description = description
|
60
|
+
@original_name = original_name
|
61
|
+
@plaid_account_id = plaid_account_id
|
62
|
+
@asset_id = asset_id
|
63
|
+
@transaction_id = transaction_id
|
64
|
+
@to_base = to_base
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#recurring-expenses-object
|
7
|
+
class RecurringExpenseBase < LunchMoney::Objects::Object
|
8
|
+
sig { returns(String) }
|
9
|
+
attr_accessor :payee, :currency, :amount
|
10
|
+
|
11
|
+
sig { returns(T.nilable(Number)) }
|
12
|
+
attr_accessor :to_base
|
13
|
+
|
14
|
+
sig do
|
15
|
+
params(
|
16
|
+
payee: String,
|
17
|
+
amount: String,
|
18
|
+
currency: String,
|
19
|
+
to_base: T.nilable(Number),
|
20
|
+
).void
|
21
|
+
end
|
22
|
+
def initialize(payee:, amount:, currency:, to_base:)
|
23
|
+
super()
|
24
|
+
@payee = payee
|
25
|
+
@amount = amount
|
26
|
+
@currency = currency
|
27
|
+
@to_base = to_base
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "transaction_modification_base"
|
5
|
+
|
6
|
+
module LunchMoney
|
7
|
+
module Objects
|
8
|
+
# Object used to split a transaction when updating https://lunchmoney.dev/#update-transaction
|
9
|
+
class Split < TransactionModificationBase
|
10
|
+
sig { returns(T.any(Number, String)) }
|
11
|
+
attr_accessor :amount
|
12
|
+
|
13
|
+
sig do
|
14
|
+
params(
|
15
|
+
amount: T.any(Number, String),
|
16
|
+
payee: T.nilable(String),
|
17
|
+
date: T.nilable(String),
|
18
|
+
category_id: T.nilable(Integer),
|
19
|
+
notes: T.nilable(String),
|
20
|
+
).void
|
21
|
+
end
|
22
|
+
def initialize(amount:, payee: nil, date: nil, category_id: nil, notes: nil)
|
23
|
+
super(payee:, date:, category_id:, notes:)
|
24
|
+
@amount = amount
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "tag_base"
|
5
|
+
|
6
|
+
module LunchMoney
|
7
|
+
module Objects
|
8
|
+
# https://lunchmoney.dev/#tags-object
|
9
|
+
class Tag < TagBase
|
10
|
+
sig { returns(T.nilable(String)) }
|
11
|
+
attr_accessor :description
|
12
|
+
|
13
|
+
sig { returns(T::Boolean) }
|
14
|
+
attr_accessor :archived
|
15
|
+
|
16
|
+
sig { params(id: Integer, name: String, archived: T::Boolean, description: T.nilable(String)).void }
|
17
|
+
def initialize(id:, name:, archived:, description: nil)
|
18
|
+
super(id:, name:)
|
19
|
+
@archived = archived
|
20
|
+
@description = description
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# https://lunchmoney.dev/#tags-object without some fields. This is used within field returns of other objects like
|
7
|
+
# field returns of other objects like transactions
|
8
|
+
class TagBase < LunchMoney::Objects::Object
|
9
|
+
sig { returns(Integer) }
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_accessor :name
|
14
|
+
|
15
|
+
sig { params(id: Integer, name: String).void }
|
16
|
+
def initialize(id:, name:)
|
17
|
+
super()
|
18
|
+
@id = id
|
19
|
+
@name = name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|