lunchmoney 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check_pipeline.yml +24 -0
- data/.github/workflows/ci.yml +1 -4
- data/.github/workflows/dependabot-rbi-updater.yml +3 -6
- data/.github/workflows/publish_gem.yml +14 -16
- data/.github/workflows/release_pipeline.yml +36 -0
- data/.rubocop.yml +5 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +19 -18
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +27 -0
- data/lib/lunchmoney/api.rb +160 -35
- data/lib/lunchmoney/calls/assets.rb +98 -0
- data/lib/lunchmoney/calls/base.rb +118 -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/errors.rb +17 -1
- data/lib/lunchmoney/objects/asset.rb +92 -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 +3 -4
- data/sorbet/rbi/gems/{minitest@5.21.2.rbi → minitest@5.22.2.rbi} +147 -144
- data/sorbet/rbi/gems/{rubocop-sorbet@0.7.6.rbi → rubocop-sorbet@0.7.7.rbi} +53 -6
- data/sorbet/rbi/gems/{rubocop@1.60.1.rbi → rubocop@1.60.2.rbi} +51 -30
- data/sorbet/rbi/gems/{toys@0.15.4.rbi → toys@0.15.5.rbi} +3 -3
- data/sorbet/rbi/gems/{webmock@3.19.1.rbi → webmock@3.20.0.rbi} +10 -10
- metadata +50 -47
- 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
- /data/sorbet/rbi/gems/{crack@0.4.5.rbi → crack@1.0.0.rbi} +0 -0
- /data/sorbet/rbi/gems/{toys-core@0.15.4.rbi → toys-core@0.15.5.rbi} +0 -0
@@ -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
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "transaction_base"
|
5
|
+
|
6
|
+
module LunchMoney
|
7
|
+
module Objects
|
8
|
+
# https://lunchmoney.dev/#transaction-object
|
9
|
+
class Transaction < TransactionBase
|
10
|
+
sig { returns(T.nilable(Integer)) }
|
11
|
+
attr_accessor :category_id,
|
12
|
+
:category_group_id,
|
13
|
+
:recurring_id,
|
14
|
+
:parent_id,
|
15
|
+
:group_id,
|
16
|
+
:external_id
|
17
|
+
|
18
|
+
sig { returns(String) }
|
19
|
+
attr_accessor :created_at,
|
20
|
+
:updated_at,
|
21
|
+
:status,
|
22
|
+
:source,
|
23
|
+
:display_name,
|
24
|
+
:account_display_name
|
25
|
+
|
26
|
+
sig { returns(T.nilable(String)) }
|
27
|
+
attr_accessor :category_name,
|
28
|
+
:category_group_name,
|
29
|
+
:original_name,
|
30
|
+
:recurring_payee,
|
31
|
+
:recurring_description,
|
32
|
+
:recurring_cadence,
|
33
|
+
:recurring_type,
|
34
|
+
:recurring_amount,
|
35
|
+
:recurring_currency,
|
36
|
+
:asset_institution_name,
|
37
|
+
:asset_name,
|
38
|
+
:asset_display_name,
|
39
|
+
:asset_status,
|
40
|
+
:plaid_account_name,
|
41
|
+
:plaid_account_mask,
|
42
|
+
:institution_name,
|
43
|
+
:plaid_account_display_name,
|
44
|
+
:plaid_metadata,
|
45
|
+
:display_notes
|
46
|
+
|
47
|
+
sig { returns(T::Boolean) }
|
48
|
+
attr_accessor :is_income, :exclude_from_budget, :exclude_from_totals, :is_pending, :has_children, :is_group
|
49
|
+
|
50
|
+
sig { returns(T::Array[LunchMoney::Objects::TagBase]) }
|
51
|
+
attr_accessor :tags
|
52
|
+
|
53
|
+
sig { returns(T.nilable(T::Array[LunchMoney::Objects::ChildTransaction])) }
|
54
|
+
attr_accessor :children
|
55
|
+
|
56
|
+
sig do
|
57
|
+
params(
|
58
|
+
id: Integer,
|
59
|
+
date: String,
|
60
|
+
amount: String,
|
61
|
+
currency: String,
|
62
|
+
to_base: Number,
|
63
|
+
payee: String,
|
64
|
+
is_income: T::Boolean,
|
65
|
+
exclude_from_budget: T::Boolean,
|
66
|
+
exclude_from_totals: T::Boolean,
|
67
|
+
created_at: String,
|
68
|
+
updated_at: String,
|
69
|
+
status: String,
|
70
|
+
is_pending: T::Boolean,
|
71
|
+
has_children: T::Boolean,
|
72
|
+
is_group: T::Boolean,
|
73
|
+
source: String,
|
74
|
+
display_name: String,
|
75
|
+
account_display_name: String,
|
76
|
+
tags: T::Array[LunchMoney::Objects::TagBase],
|
77
|
+
category_id: T.nilable(Integer),
|
78
|
+
category_name: T.nilable(String),
|
79
|
+
category_group_id: T.nilable(Integer),
|
80
|
+
category_group_name: T.nilable(String),
|
81
|
+
notes: T.nilable(String),
|
82
|
+
original_name: T.nilable(String),
|
83
|
+
recurring_id: T.nilable(Integer),
|
84
|
+
recurring_payee: T.nilable(String),
|
85
|
+
recurring_description: T.nilable(String),
|
86
|
+
recurring_cadence: T.nilable(String),
|
87
|
+
recurring_type: T.nilable(String),
|
88
|
+
recurring_amount: T.nilable(String),
|
89
|
+
recurring_currency: T.nilable(String),
|
90
|
+
parent_id: T.nilable(Integer),
|
91
|
+
group_id: T.nilable(Integer),
|
92
|
+
asset_id: T.nilable(Integer),
|
93
|
+
asset_institution_name: T.nilable(String),
|
94
|
+
asset_name: T.nilable(String),
|
95
|
+
asset_display_name: T.nilable(String),
|
96
|
+
asset_status: T.nilable(String),
|
97
|
+
plaid_account_id: T.nilable(Integer),
|
98
|
+
plaid_account_name: T.nilable(String),
|
99
|
+
plaid_account_mask: T.nilable(String),
|
100
|
+
institution_name: T.nilable(String),
|
101
|
+
plaid_account_display_name: T.nilable(String),
|
102
|
+
plaid_metadata: T.nilable(String),
|
103
|
+
display_notes: T.nilable(String),
|
104
|
+
external_id: T.nilable(Integer),
|
105
|
+
children: T.nilable(T::Array[LunchMoney::Objects::ChildTransaction]),
|
106
|
+
).void
|
107
|
+
end
|
108
|
+
def initialize(id:, date:, amount:, currency:, to_base:, payee:, is_income:, exclude_from_budget:,
|
109
|
+
exclude_from_totals:, created_at:, updated_at:, status:, is_pending:, has_children:, is_group:, source:,
|
110
|
+
display_name:, account_display_name:, tags:, category_id: nil, category_name: nil, category_group_id: nil,
|
111
|
+
category_group_name: nil, notes: nil, original_name: nil, recurring_id: nil, recurring_payee: nil,
|
112
|
+
recurring_description: nil, recurring_cadence: nil, recurring_type: nil, recurring_amount: nil,
|
113
|
+
recurring_currency: nil, parent_id: nil, group_id: nil, asset_id: nil, asset_institution_name: nil,
|
114
|
+
asset_name: nil, asset_display_name: nil, asset_status: nil, plaid_account_id: nil, plaid_account_name: nil,
|
115
|
+
plaid_account_mask: nil, institution_name: nil, plaid_account_display_name: nil, plaid_metadata: nil,
|
116
|
+
display_notes: nil, external_id: nil, children: nil)
|
117
|
+
super(id:, date:, amount:, currency:, to_base:, payee:, notes:, asset_id:, plaid_account_id:)
|
118
|
+
@is_income = is_income
|
119
|
+
@exclude_from_budget = exclude_from_budget
|
120
|
+
@exclude_from_totals = exclude_from_totals
|
121
|
+
@created_at = created_at
|
122
|
+
@updated_at = updated_at
|
123
|
+
@status = status
|
124
|
+
@is_pending = is_pending
|
125
|
+
@has_children = has_children
|
126
|
+
@is_group = is_group
|
127
|
+
@source = source
|
128
|
+
@display_name = display_name
|
129
|
+
@account_display_name = account_display_name
|
130
|
+
@tags = tags
|
131
|
+
@category_id = category_id
|
132
|
+
@category_name = category_name
|
133
|
+
@category_group_id = category_group_id
|
134
|
+
@category_group_name = category_group_name
|
135
|
+
@original_name = original_name
|
136
|
+
@recurring_id = recurring_id
|
137
|
+
@recurring_payee = recurring_payee
|
138
|
+
@recurring_description = recurring_description
|
139
|
+
@recurring_cadence = recurring_cadence
|
140
|
+
@recurring_type = recurring_type
|
141
|
+
@recurring_amount = recurring_amount
|
142
|
+
@recurring_currency = recurring_currency
|
143
|
+
@parent_id = parent_id
|
144
|
+
@group_id = group_id
|
145
|
+
@asset_institution_name = asset_institution_name
|
146
|
+
@asset_name = asset_name
|
147
|
+
@asset_display_name = asset_display_name
|
148
|
+
@asset_status = asset_status
|
149
|
+
@plaid_account_name = plaid_account_name
|
150
|
+
@plaid_account_mask = plaid_account_mask
|
151
|
+
@institution_name = institution_name
|
152
|
+
@plaid_account_display_name = plaid_account_display_name
|
153
|
+
@plaid_metadata = plaid_metadata
|
154
|
+
@display_notes = display_notes
|
155
|
+
@children = children
|
156
|
+
@external_id = external_id
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# Slimmed down version of https://lunchmoney.dev/#transaction-object used as a base for other transaction objects
|
7
|
+
class TransactionBase < LunchMoney::Objects::Object
|
8
|
+
sig { returns(Integer) }
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
sig { returns(Number) }
|
12
|
+
attr_accessor :to_base
|
13
|
+
|
14
|
+
sig { returns(T.nilable(Integer)) }
|
15
|
+
attr_accessor :asset_id, :plaid_account_id
|
16
|
+
|
17
|
+
sig { returns(String) }
|
18
|
+
attr_accessor :date,
|
19
|
+
:amount,
|
20
|
+
:currency,
|
21
|
+
:payee
|
22
|
+
|
23
|
+
sig { returns(T.nilable(String)) }
|
24
|
+
attr_accessor :notes
|
25
|
+
|
26
|
+
sig do
|
27
|
+
params(
|
28
|
+
id: Integer,
|
29
|
+
date: String,
|
30
|
+
amount: String,
|
31
|
+
currency: String,
|
32
|
+
to_base: Number,
|
33
|
+
payee: String,
|
34
|
+
notes: T.nilable(String),
|
35
|
+
asset_id: T.nilable(Integer),
|
36
|
+
plaid_account_id: T.nilable(Integer),
|
37
|
+
).void
|
38
|
+
end
|
39
|
+
def initialize(id:, date:, amount:, currency:, to_base:, payee:, notes: nil, asset_id: nil,
|
40
|
+
plaid_account_id: nil)
|
41
|
+
super()
|
42
|
+
@id = id
|
43
|
+
@date = date
|
44
|
+
@amount = amount
|
45
|
+
@currency = currency
|
46
|
+
@to_base = to_base
|
47
|
+
@payee = payee
|
48
|
+
@notes = notes
|
49
|
+
@asset_id = asset_id
|
50
|
+
@plaid_account_id = plaid_account_id
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module LunchMoney
|
5
|
+
module Objects
|
6
|
+
# Base object used for transaction objects that are used to update
|
7
|
+
# transactions https://lunchmoney.dev/#update-transaction
|
8
|
+
class TransactionModificationBase < LunchMoney::Objects::Object
|
9
|
+
sig { returns(T.nilable(String)) }
|
10
|
+
attr_accessor :payee, :date, :notes
|
11
|
+
|
12
|
+
sig { returns(T.nilable(Integer)) }
|
13
|
+
attr_accessor :category_id
|
14
|
+
|
15
|
+
sig do
|
16
|
+
params(
|
17
|
+
payee: T.nilable(String),
|
18
|
+
date: T.nilable(String),
|
19
|
+
category_id: T.nilable(Integer),
|
20
|
+
notes: T.nilable(String),
|
21
|
+
).void
|
22
|
+
end
|
23
|
+
def initialize(payee: nil, date: nil, category_id: nil, notes: nil)
|
24
|
+
super()
|
25
|
+
@payee = payee
|
26
|
+
@date = date
|
27
|
+
@category_id = category_id
|
28
|
+
@notes = notes
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 when updating a transaction https://lunchmoney.dev/#update-transaction
|
9
|
+
class UpdateTransaction < TransactionModificationBase
|
10
|
+
sig { returns(T.nilable(String)) }
|
11
|
+
attr_accessor :amount, :currency, :status, :external_id
|
12
|
+
|
13
|
+
sig { returns(T.nilable(Integer)) }
|
14
|
+
attr_accessor :asset_id, :recurring_id
|
15
|
+
|
16
|
+
sig { returns(T.nilable(T::Array[T.any(String, Integer)])) }
|
17
|
+
attr_accessor :tags
|
18
|
+
|
19
|
+
sig do
|
20
|
+
params(
|
21
|
+
tags: T.nilable(T::Array[T.any(String, Integer)]),
|
22
|
+
category_id: T.nilable(Integer),
|
23
|
+
payee: T.nilable(String),
|
24
|
+
amount: T.nilable(String),
|
25
|
+
currency: T.nilable(String),
|
26
|
+
asset_id: T.nilable(Integer),
|
27
|
+
recurring_id: T.nilable(Integer),
|
28
|
+
notes: T.nilable(String),
|
29
|
+
status: T.nilable(String),
|
30
|
+
external_id: T.nilable(String),
|
31
|
+
date: T.nilable(String),
|
32
|
+
).void
|
33
|
+
end
|
34
|
+
def initialize(tags: nil, category_id: nil, payee: nil, amount: nil, currency: nil, asset_id: nil,
|
35
|
+
recurring_id: nil, notes: nil, status: nil, external_id: nil, date: nil)
|
36
|
+
super(payee:, date:, category_id:, notes:)
|
37
|
+
@amount = amount
|
38
|
+
@tags = tags
|
39
|
+
@currency = currency
|
40
|
+
@asset_id = asset_id
|
41
|
+
@recurring_id = recurring_id
|
42
|
+
@status = status
|
43
|
+
@external_id = external_id
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|