lunchmoney 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +7 -0
- data/.github/workflows/check_pipeline.yml +24 -0
- data/.github/workflows/ci.yml +11 -6
- data/.github/workflows/dependabot-rbi-updater.yml +3 -6
- data/.github/workflows/release_pipeline.yml +36 -0
- data/.mdlrc +4 -0
- data/.rubocop.yml +6 -2
- data/.simplecov +30 -0
- data/.toys/.toys.rb +1 -0
- data/.toys/coverage.rb +5 -0
- data/.toys/mdl.rb +5 -0
- data/Gemfile +4 -1
- data/Gemfile.lock +47 -18
- data/LICENSE +1 -1
- data/README.md +5 -3
- data/Rakefile +27 -0
- data/lib/lunchmoney/api.rb +126 -1
- data/lib/lunchmoney/calls/base.rb +8 -2
- data/lib/lunchmoney/errors.rb +17 -1
- data/lib/lunchmoney/objects/asset.rb +1 -0
- data/lib/lunchmoney/objects/object.rb +3 -1
- data/lib/lunchmoney/version.rb +1 -1
- data/lunchmoney.gemspec +3 -4
- data/sorbet/rbi/gems/chef-utils@18.4.2.rbi +8 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +376 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +127 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +3271 -0
- data/sorbet/rbi/gems/mdl@0.13.0.rbi +444 -0
- data/sorbet/rbi/gems/{minitest@5.21.2.rbi → minitest@5.22.2.rbi} +147 -144
- data/sorbet/rbi/gems/mixlib-cli@2.1.8.rbi +313 -0
- data/sorbet/rbi/gems/mixlib-config@3.0.27.rbi +580 -0
- data/sorbet/rbi/gems/mixlib-shellout@3.2.7.rbi +628 -0
- 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/simplecov-html@0.12.3.rbi +216 -0
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2148 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +238 -0
- data/sorbet/rbi/gems/tomlrb@2.0.3.rbi +8 -0
- 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 +36 -18
- data/.DS_Store +0 -0
- data/.github/workflows/publish_gem.yml +0 -32
- /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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b24d3bbcd5e93161548921e2c39deac79d1b4970352a702c8386cf4e7f6f7b
|
4
|
+
data.tar.gz: 3c9277f552499d51bee728241fca6ad0c2aeba7224d4819d2dc1df8456ab8adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5791261da74adce58b20ea6d554777ea05ce3f9c170677284e5226575f5a90a5900ed2b29d0f9367cb718da12ce979020b676aa372441a0b0380771577960703
|
7
|
+
data.tar.gz: 46bab5cdf01ef0aae51ee89650257c237467a95ddde546c7772c907aa43ca43ad09743c466f363cd0c984109f23993b84900d708aab8e9b5485c1e22e67011d1
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Check Pipeline
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches-ignore:
|
6
|
+
- main
|
7
|
+
paths-ignore:
|
8
|
+
- ".gitignore"
|
9
|
+
- "README.md"
|
10
|
+
tags-ignore:
|
11
|
+
- v*
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
update-rbis:
|
15
|
+
name: RBI Updater
|
16
|
+
uses: ./.github/workflows/dependabot-rbi-updater.yml
|
17
|
+
secrets: inherit
|
18
|
+
|
19
|
+
ci:
|
20
|
+
needs: update-rbis
|
21
|
+
if: always() && contains(needs.*.result, 'skipped')
|
22
|
+
name: "CI"
|
23
|
+
uses: ./.github/workflows/ci.yml
|
24
|
+
secrets: inherit
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
3
|
on:
|
4
|
-
push:
|
5
|
-
paths-ignore:
|
6
|
-
- ".gitignore"
|
7
|
-
- "README.md"
|
8
4
|
workflow_dispatch:
|
5
|
+
workflow_call:
|
9
6
|
schedule:
|
10
7
|
# Every day at 9pm
|
11
8
|
- cron: '0 21 * * *'
|
@@ -44,15 +41,23 @@ jobs:
|
|
44
41
|
-
|
45
42
|
name: Check for DSL rbi updates
|
46
43
|
run: bin/tapioca dsl --verify
|
44
|
+
-
|
45
|
+
name: Markdown Lint
|
46
|
+
run: bin/toys mdl
|
47
47
|
-
|
48
48
|
name: Run Tests (Using Cassettes)
|
49
49
|
if: ${{ ! endsWith(matrix.ruby-version, '3.3') }}
|
50
50
|
run: bin/toys test
|
51
51
|
-
|
52
|
-
name: Run Tests (With Remote Calls)
|
52
|
+
name: Run Tests (With Remote Calls & Coverage Report)
|
53
53
|
if: ${{ endsWith(matrix.ruby-version, '3.3') }}
|
54
|
-
|
54
|
+
uses: paambaati/codeclimate-action@v5.0.0
|
55
55
|
env:
|
56
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
56
57
|
REMOTE_TESTS_ENABLED: ${{ vars.REMOTE_TESTS_ENABLED }}
|
57
58
|
LUNCHMONEY_TOKEN: ${{ secrets.LUNCHMONEY_TOKEN }}
|
59
|
+
with:
|
60
|
+
coverageCommand: bin/toys test
|
61
|
+
coverageLocations: |
|
62
|
+
${{ github.workspace }}/coverage/coverage.json:simplecov
|
58
63
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
name: Dependabot RBI Updater
|
2
2
|
on:
|
3
|
-
|
4
|
-
paths:
|
5
|
-
- 'Gemfile.lock'
|
6
|
-
- 'Gemfile'
|
3
|
+
workflow_call:
|
7
4
|
|
8
5
|
jobs:
|
9
6
|
update-rbis:
|
@@ -32,12 +29,12 @@ jobs:
|
|
32
29
|
git config --local user.name "Dependabot RBI Updater"
|
33
30
|
git config --local user.email action@github.com
|
34
31
|
git add sorbet/*
|
35
|
-
git commit -m "[dependabot skip] Update RBIs"
|
32
|
+
git diff-index --cached --quiet HEAD || git commit -m "[dependabot skip] Update RBIs"
|
36
33
|
-
|
37
34
|
name: Push changes
|
38
35
|
uses: ad-m/github-push-action@v0.8.0
|
39
36
|
with:
|
40
37
|
github_token: ${{ secrets.LUNCHMONEY_PAT_TOKEN }}
|
41
|
-
branch: ${{ github.
|
38
|
+
branch: ${{ github.ref }}
|
42
39
|
|
43
40
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Release Pipeline
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
tags:
|
7
|
+
- v*
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
ci:
|
11
|
+
name: "CI"
|
12
|
+
uses: ./.github/workflows/ci.yml
|
13
|
+
secrets: inherit
|
14
|
+
release:
|
15
|
+
needs: ci
|
16
|
+
if: always() && !contains(needs.*.result, 'failed') && !contains(needs.*.result, 'cancelled')
|
17
|
+
name: Build & Release Gem
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
environment: rubygems
|
20
|
+
|
21
|
+
permissions:
|
22
|
+
contents: write
|
23
|
+
id-token: write
|
24
|
+
|
25
|
+
steps:
|
26
|
+
# Set up
|
27
|
+
- uses: actions/checkout@v4
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
bundler-cache: true
|
32
|
+
ruby-version: ruby
|
33
|
+
|
34
|
+
# Release
|
35
|
+
- name: Publish to RubyGems
|
36
|
+
uses: rubygems/release-gem@v1
|
data/.mdlrc
ADDED
data/.rubocop.yml
CHANGED
@@ -11,6 +11,7 @@ AllCops:
|
|
11
11
|
NewCops: enable
|
12
12
|
Exclude:
|
13
13
|
- "sorbet/**/*"
|
14
|
+
- ".mdlrc"
|
14
15
|
|
15
16
|
Sorbet:
|
16
17
|
Enabled: true
|
@@ -22,16 +23,19 @@ Sorbet/FalseSigil:
|
|
22
23
|
Sorbet/StrictSigil:
|
23
24
|
Enabled: true
|
24
25
|
Exclude:
|
25
|
-
- "test/*"
|
26
26
|
- ".toys/**/*"
|
27
27
|
|
28
28
|
Sorbet/ForbidTStruct:
|
29
|
+
# Context for why this is preferable https://github.com/Shopify/rubocop-sorbet/pull/178#issuecomment-1739924189
|
29
30
|
Enabled: true
|
30
|
-
|
31
|
+
|
31
32
|
|
32
33
|
Sorbet/RedundantExtendTSig:
|
33
34
|
Enabled: true
|
34
35
|
|
36
|
+
Sorbet/ForbidTUnsafe:
|
37
|
+
Enabled: true
|
38
|
+
|
35
39
|
Minitest:
|
36
40
|
Enabled: true
|
37
41
|
|
data/.simplecov
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "simplecov_json_formatter"
|
4
|
+
|
5
|
+
SimpleCov.formatter = if ENV.fetch("CI", false)
|
6
|
+
SimpleCov::Formatter::JSONFormatter
|
7
|
+
else
|
8
|
+
SimpleCov::Formatter::HTMLFormatter
|
9
|
+
end
|
10
|
+
|
11
|
+
SimpleCov.minimum_coverage(95)
|
12
|
+
SimpleCov.maximum_coverage_drop(1)
|
13
|
+
SimpleCov.start do
|
14
|
+
enable_coverage :branch
|
15
|
+
primary_coverage :branch
|
16
|
+
|
17
|
+
add_filter "/test/"
|
18
|
+
|
19
|
+
add_group "Calls", "lib/lunchmoney/calls"
|
20
|
+
add_group "Objects", "lib/lunchmoney/objects"
|
21
|
+
add_group "Core Files", [
|
22
|
+
"lib/lunchmoney.rb",
|
23
|
+
"lib/lunchmoney/api.rb",
|
24
|
+
"lib/lunchmoney/configuration.rb",
|
25
|
+
"lib/lunchmoney/errors.rb",
|
26
|
+
"lib/lunchmoney/exceptions.rb",
|
27
|
+
"lib/lunchmoney/validators.rb",
|
28
|
+
"lib/lunchmoney/version.rb",
|
29
|
+
]
|
30
|
+
end
|
data/.toys/.toys.rb
CHANGED
data/.toys/coverage.rb
ADDED
data/.toys/mdl.rb
ADDED
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gemspec
|
|
7
7
|
|
8
8
|
# Specify development dependencies here
|
9
9
|
gem "toys"
|
10
|
-
gem "minitest", "~> 5.
|
10
|
+
gem "minitest", "~> 5.22", require: false
|
11
11
|
gem "mocha", "~> 2.1.0", require: false
|
12
12
|
gem "webmock", require: false
|
13
13
|
gem "vcr", require: false
|
@@ -23,3 +23,6 @@ gem "dotenv"
|
|
23
23
|
gem "yard", require: false
|
24
24
|
gem "yard-sorbet", require: false
|
25
25
|
gem "appraisal", require: false
|
26
|
+
gem "simplecov", require: false
|
27
|
+
gem "simplecov_json_formatter", require: false
|
28
|
+
gem "mdl", require: false
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lunchmoney (1.1.
|
4
|
+
lunchmoney (1.1.2)
|
5
5
|
activesupport (>= 6.1)
|
6
6
|
faraday (>= 1.0.0)
|
7
7
|
sorbet-runtime (>= 0.5)
|
@@ -28,11 +28,15 @@ GEM
|
|
28
28
|
ast (2.4.2)
|
29
29
|
base64 (0.2.0)
|
30
30
|
bigdecimal (3.1.6)
|
31
|
+
chef-utils (18.4.2)
|
32
|
+
concurrent-ruby
|
31
33
|
coderay (1.1.3)
|
32
34
|
concurrent-ruby (1.2.3)
|
33
35
|
connection_pool (2.4.1)
|
34
|
-
crack (0.
|
36
|
+
crack (1.0.0)
|
37
|
+
bigdecimal
|
35
38
|
rexml
|
39
|
+
docile (1.4.0)
|
36
40
|
dotenv (2.8.1)
|
37
41
|
drb (2.2.0)
|
38
42
|
ruby2_keywords
|
@@ -45,9 +49,24 @@ GEM
|
|
45
49
|
i18n (1.14.1)
|
46
50
|
concurrent-ruby (~> 1.0)
|
47
51
|
json (2.7.1)
|
52
|
+
kramdown (2.4.0)
|
53
|
+
rexml
|
54
|
+
kramdown-parser-gfm (1.1.0)
|
55
|
+
kramdown (~> 2.0)
|
48
56
|
language_server-protocol (3.17.0.3)
|
57
|
+
mdl (0.13.0)
|
58
|
+
kramdown (~> 2.3)
|
59
|
+
kramdown-parser-gfm (~> 1.1)
|
60
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
61
|
+
mixlib-config (>= 2.2.1, < 4)
|
62
|
+
mixlib-shellout
|
49
63
|
method_source (1.0.0)
|
50
|
-
minitest (5.
|
64
|
+
minitest (5.22.2)
|
65
|
+
mixlib-cli (2.1.8)
|
66
|
+
mixlib-config (3.0.27)
|
67
|
+
tomlrb
|
68
|
+
mixlib-shellout (3.2.7)
|
69
|
+
chef-utils
|
51
70
|
mocha (2.1.0)
|
52
71
|
ruby2_keywords (>= 0.0.5)
|
53
72
|
mutex_m (0.2.0)
|
@@ -75,7 +94,7 @@ GEM
|
|
75
94
|
sorbet-runtime (>= 0.5.9204)
|
76
95
|
regexp_parser (2.9.0)
|
77
96
|
rexml (3.2.6)
|
78
|
-
rubocop (1.60.
|
97
|
+
rubocop (1.60.2)
|
79
98
|
json (~> 2.3)
|
80
99
|
language_server-protocol (>= 3.17.0)
|
81
100
|
parallel (~> 1.10)
|
@@ -98,18 +117,24 @@ GEM
|
|
98
117
|
rubocop-ast (>= 1.30.0, < 2.0)
|
99
118
|
rubocop-shopify (2.14.0)
|
100
119
|
rubocop (~> 1.51)
|
101
|
-
rubocop-sorbet (0.7.
|
120
|
+
rubocop-sorbet (0.7.7)
|
102
121
|
rubocop (>= 0.90.0)
|
103
122
|
ruby-progressbar (1.13.0)
|
104
123
|
ruby2_keywords (0.0.5)
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
sorbet-
|
124
|
+
simplecov (0.22.0)
|
125
|
+
docile (~> 1.1)
|
126
|
+
simplecov-html (~> 0.11)
|
127
|
+
simplecov_json_formatter (~> 0.1)
|
128
|
+
simplecov-html (0.12.3)
|
129
|
+
simplecov_json_formatter (0.1.4)
|
130
|
+
sorbet (0.5.11247)
|
131
|
+
sorbet-static (= 0.5.11247)
|
132
|
+
sorbet-runtime (0.5.11247)
|
133
|
+
sorbet-static (0.5.11247-universal-darwin)
|
134
|
+
sorbet-static (0.5.11247-x86_64-linux)
|
135
|
+
sorbet-static-and-runtime (0.5.11247)
|
136
|
+
sorbet (= 0.5.11247)
|
137
|
+
sorbet-runtime (= 0.5.11247)
|
113
138
|
spoom (1.2.4)
|
114
139
|
erubi (>= 1.10.0)
|
115
140
|
sorbet-static-and-runtime (>= 0.5.10187)
|
@@ -127,15 +152,16 @@ GEM
|
|
127
152
|
thor (>= 1.2.0)
|
128
153
|
yard-sorbet
|
129
154
|
thor (1.3.0)
|
130
|
-
|
131
|
-
|
132
|
-
|
155
|
+
tomlrb (2.0.3)
|
156
|
+
toys (0.15.5)
|
157
|
+
toys-core (= 0.15.5)
|
158
|
+
toys-core (0.15.5)
|
133
159
|
tzinfo (2.0.6)
|
134
160
|
concurrent-ruby (~> 1.0)
|
135
161
|
unicode-display_width (2.5.0)
|
136
162
|
uri (0.13.0)
|
137
163
|
vcr (6.2.0)
|
138
|
-
webmock (3.
|
164
|
+
webmock (3.20.0)
|
139
165
|
addressable (>= 2.8.0)
|
140
166
|
crack (>= 0.3.2)
|
141
167
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -154,13 +180,16 @@ DEPENDENCIES
|
|
154
180
|
appraisal
|
155
181
|
dotenv
|
156
182
|
lunchmoney!
|
157
|
-
|
183
|
+
mdl
|
184
|
+
minitest (~> 5.22)
|
158
185
|
mocha (~> 2.1.0)
|
159
186
|
pry-sorbet (~> 0.2)
|
160
187
|
rubocop-minitest
|
161
188
|
rubocop-rails
|
162
189
|
rubocop-shopify
|
163
190
|
rubocop-sorbet
|
191
|
+
simplecov
|
192
|
+
simplecov_json_formatter
|
164
193
|
sorbet-static-and-runtime
|
165
194
|
spoom
|
166
195
|
tapioca
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# lunchmoney
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/lunchmoney.svg)](https://badge.fury.io/rb/lunchmoney)
|
4
|
-
[![CI](https://github.com/
|
5
|
-
[![Yard Docs](https://github.com/
|
4
|
+
[![CI](https://github.com/mmenanno/lunchmoney/actions/workflows/ci.yml/badge.svg)](https://github.com/mmenanno/lunchmoney/actions/workflows/ci.yml)
|
5
|
+
[![Yard Docs](https://github.com/mmenanno/lunchmoney/actions/workflows/build_and_publish_yard_docs.yml/badge.svg)](https://github.com/mmenanno/lunchmoney/actions/workflows/build_and_publish_yard_docs.yml)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/6e84458e8cf831e6a6fa/maintainability)](https://codeclimate.com/github/mmenanno/lunchmoney/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/6e84458e8cf831e6a6fa/test_coverage)](https://codeclimate.com/github/mmenanno/lunchmoney/test_coverage)
|
6
8
|
|
7
9
|
This gem is a API client library of the [LunchMoney API](https://lunchmoney.dev/) for the wonderful [LunchMoney](http://lunchmoney.app/) web app for personal finance & budgeting.
|
8
10
|
|
9
|
-
Documentation is still a work in process, but you can find the yard docs for this gem [here](https://
|
11
|
+
Documentation is still a work in process, but you can find the yard docs for this gem [here](https://mmenanno.github.io/lunchmoney/) as well as some write ups of the basics below. An example of every call is listed on the [Api class in the yard docs](https://mmenanno.github.io/lunchmoney/LunchMoney/Api.html).
|
10
12
|
|
11
13
|
## Usage
|
12
14
|
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'toys' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("toys", "toys")
|
data/lib/lunchmoney/api.rb
CHANGED
@@ -17,9 +17,12 @@ require_relative "calls/plaid_accounts"
|
|
17
17
|
require_relative "calls/crypto"
|
18
18
|
|
19
19
|
module LunchMoney
|
20
|
-
# The main API class that a user should interface through
|
20
|
+
# The main API class that a user should interface through. The method of any individual call is delegated through here
|
21
21
|
# so that it is never necessary to go through things like `LunchMoney::Calls::Users.new.user` instead you can directly
|
22
22
|
# call the endpoint with LunchMoney::Api.new.user and it will be delegated to the correct call.
|
23
|
+
# @example
|
24
|
+
# api = LunchMoney::Api.new
|
25
|
+
# api.categories # This will be delegated to LunchMoney::Calls::Categories#categories
|
23
26
|
class Api
|
24
27
|
sig { returns(T.nilable(String)) }
|
25
28
|
attr_reader :api_key
|
@@ -31,6 +34,10 @@ module LunchMoney
|
|
31
34
|
|
32
35
|
delegate :me, to: :user_calls
|
33
36
|
|
37
|
+
# All [user call types](https://lunchmoney.dev/#user) come through here.
|
38
|
+
# @example [Get User](https://lunchmoney.dev/#get-user)
|
39
|
+
# api = LunchMoney::Api.new
|
40
|
+
# api.me
|
34
41
|
sig { returns(LunchMoney::Calls::Base) }
|
35
42
|
def user_calls
|
36
43
|
with_valid_api_key do
|
@@ -48,6 +55,32 @@ module LunchMoney
|
|
48
55
|
:force_delete_category,
|
49
56
|
to: :category_calls
|
50
57
|
|
58
|
+
# All [category call types](https://lunchmoney.dev/#categories) come through here. Reference the docs for
|
59
|
+
# available parameters for each call
|
60
|
+
# @example [Get All Categories](https://lunchmoney.dev/#get-all-categories)
|
61
|
+
# api = LunchMoney::Api.new
|
62
|
+
# api.categories
|
63
|
+
# @example [Get Single Category](https://lunchmoney.dev/#get-single-category)
|
64
|
+
# api = LunchMoney::Api.new
|
65
|
+
# api.category(1234567)
|
66
|
+
# @example [Create Category](https://lunchmoney.dev/#create-category)
|
67
|
+
# api = LunchMoney::Api.new
|
68
|
+
# api.create_category(name: "New Category Name")
|
69
|
+
# @example [Create Category Group](https://lunchmoney.dev/#create-category-group)
|
70
|
+
# api = LunchMoney::Api.new
|
71
|
+
# api.create_category_group(name: "New Category Group Name")
|
72
|
+
# @example [Update Category](https://lunchmoney.dev/#update-category)
|
73
|
+
# api = LunchMoney::Api.new
|
74
|
+
# api.update_category(1234567, "Updated Category Name")
|
75
|
+
# @example [Add to Category Group](https://lunchmoney.dev/#add-to-category-group)
|
76
|
+
# api = LunchMoney::Api.new
|
77
|
+
# api.add_to_category_group(7654321, category_ids: [1234567], new_categories: ["Another Category"])
|
78
|
+
# @example [Delete Category](https://lunchmoney.dev/#delete-category)
|
79
|
+
# api = LunchMoney::Api.new
|
80
|
+
# api.delete_category(1234567)
|
81
|
+
# @example [Force Delete Category](https://lunchmoney.dev/#force-delete-category)
|
82
|
+
# api = LunchMoney::Api.new
|
83
|
+
# api.force_delete_category(1234567)
|
51
84
|
sig { returns(LunchMoney::Calls::Base) }
|
52
85
|
def category_calls
|
53
86
|
with_valid_api_key do
|
@@ -57,6 +90,10 @@ module LunchMoney
|
|
57
90
|
|
58
91
|
delegate :tags, to: :tag_calls
|
59
92
|
|
93
|
+
# All [tags call types](https://lunchmoney.dev/#tags) come through here.
|
94
|
+
# @example [Get All Tags](https://lunchmoney.dev/#get-all-tags)
|
95
|
+
# api = LunchMoney::Api.new
|
96
|
+
# api.tags
|
60
97
|
sig { returns(LunchMoney::Calls::Base) }
|
61
98
|
def tag_calls
|
62
99
|
with_valid_api_key do
|
@@ -74,6 +111,52 @@ module LunchMoney
|
|
74
111
|
:delete_transaction_group,
|
75
112
|
to: :transaction_calls
|
76
113
|
|
114
|
+
# All [transaction call types](https://lunchmoney.dev/#transactions) come through here.
|
115
|
+
# @example [Get All Transactions](https://lunchmoney.dev/#get-all-transactions)
|
116
|
+
# api = LunchMoney::Api.new
|
117
|
+
# api.transactions
|
118
|
+
# @example [Get Single Transaction](https://lunchmoney.dev/#get-single-transaction)
|
119
|
+
# api = LunchMoney::Api.new
|
120
|
+
# api.transaction(123456789)
|
121
|
+
# @example [Insert Transactions](https://lunchmoney.dev/#insert-transactions)
|
122
|
+
# api = LunchMoney::Api.new
|
123
|
+
# transaction = LunchMoney::Objects::UpdateTransaction.new(
|
124
|
+
# date: "2024-01-01",
|
125
|
+
# amount: "10.99",
|
126
|
+
# payee: "Example Payee",
|
127
|
+
# currency: "cad",
|
128
|
+
# status: "cleared"
|
129
|
+
# )
|
130
|
+
# api.insert_transactions([transaction])
|
131
|
+
# @example Regular [Update Transactions](https://lunchmoney.dev/#update-transactions)
|
132
|
+
# api = LunchMoney::Api.new
|
133
|
+
# transaction = LunchMoney::Objects::UpdateTransaction.new(
|
134
|
+
# date: "2024-01-01",
|
135
|
+
# amount: "10.99",
|
136
|
+
# payee: "Example Payee",
|
137
|
+
# currency: "cad",
|
138
|
+
# status: "cleared"
|
139
|
+
# )
|
140
|
+
# api.update_transaction(123456789, transaction: transaction)
|
141
|
+
# @example Split [Update Transactions](https://lunchmoney.dev/#update-transactions)
|
142
|
+
# api = LunchMoney::Api.new
|
143
|
+
# split = [
|
144
|
+
# LunchMoney::Objects::Split.new(amount: "10.00"),
|
145
|
+
# LunchMoney::Objects::Split.new(amount: "47.54"),
|
146
|
+
# ]
|
147
|
+
# api.update_transaction(12345678, split: split)
|
148
|
+
# @example [Unsplit Transactions](https://lunchmoney.dev/#unsplit-transactions)
|
149
|
+
# api = LunchMoney::Api.new
|
150
|
+
# api.unsplit_transaction([123456789])
|
151
|
+
# @example [Get Transaction Group](https://lunchmoney.dev/#get-transaction-group)
|
152
|
+
# api = LunchMoney::Api.new
|
153
|
+
# api.transaction_group(987654321)
|
154
|
+
# @example [Create Transaction Group](https://lunchmoney.dev/#create-transaction-group)
|
155
|
+
# api = LunchMoney::Api.new
|
156
|
+
# api.create_transaction_group(date: "2024-01-01", payee: "Group", transactions: [123456789, 987654321])
|
157
|
+
# @example [Delete Transaction Group](https://lunchmoney.dev/#delete-transaction-group)
|
158
|
+
# api = LunchMoney::Api.new
|
159
|
+
# api.delete_transaction_group(905483362)
|
77
160
|
sig { returns(LunchMoney::Calls::Base) }
|
78
161
|
def transaction_calls
|
79
162
|
with_valid_api_key do
|
@@ -86,6 +169,10 @@ module LunchMoney
|
|
86
169
|
|
87
170
|
delegate :recurring_expenses, to: :recurring_expense_calls
|
88
171
|
|
172
|
+
# All [recurring expenses call types](https://lunchmoney.dev/#recurring-expenses) come through here.
|
173
|
+
# @example [Get Recurring Expenses](https://lunchmoney.dev/#get-recurring-expenses)
|
174
|
+
# api = LunchMoney::Api.new
|
175
|
+
# api.recurring_expenses
|
89
176
|
sig { returns(LunchMoney::Calls::Base) }
|
90
177
|
def recurring_expense_calls
|
91
178
|
with_valid_api_key do
|
@@ -98,6 +185,16 @@ module LunchMoney
|
|
98
185
|
|
99
186
|
delegate :budgets, :upsert_budget, :remove_budget, to: :budget_calls
|
100
187
|
|
188
|
+
# All [budget call types](https://lunchmoney.dev/#budget) come through here.
|
189
|
+
# @example [Get Budget Summary](https://lunchmoney.dev/#get-budget-summary)
|
190
|
+
# api = LunchMoney::Api.new
|
191
|
+
# api.budgets(start_date: "2023-01-01", end_date: "2024-01-01")
|
192
|
+
# @example [Upsert Budget](https://lunchmoney.dev/#upsert-budget)
|
193
|
+
# api = LunchMoney::Api.new
|
194
|
+
# api.upsert_budget(start_date: "2023-01-01", category_id: 777052, amount: 400.99)
|
195
|
+
# @example [Remove Budget(https://lunchmoney.dev/#remove-budget)
|
196
|
+
# api = LunchMoney::Api.new
|
197
|
+
# api.remove_budget(start_date: "2023-01-01", category_id: 777052)
|
101
198
|
sig { returns(LunchMoney::Calls::Base) }
|
102
199
|
def budget_calls
|
103
200
|
with_valid_api_key do
|
@@ -107,6 +204,20 @@ module LunchMoney
|
|
107
204
|
|
108
205
|
delegate :assets, :create_asset, :update_asset, to: :asset_calls
|
109
206
|
|
207
|
+
# All [assets call types](https://lunchmoney.dev/#assets) come through here.
|
208
|
+
# @example [Get All Assets](https://lunchmoney.dev/#get-all-assets)
|
209
|
+
# api = LunchMoney::Api.new
|
210
|
+
# api.assets
|
211
|
+
# @example [Create Asset](https://lunchmoney.dev/#create-asset)
|
212
|
+
# api = LunchMoney::Api.new
|
213
|
+
# api.create_asset(
|
214
|
+
# type_name: "cash",
|
215
|
+
# name: "Create Asset Test",
|
216
|
+
# balance: "10.00",
|
217
|
+
# )
|
218
|
+
# @example [Update Asset](https://lunchmoney.dev/#update-asset)
|
219
|
+
# api = LunchMoney::Api.new
|
220
|
+
# api.update_asset(93746, balance: "99.99")
|
110
221
|
sig { returns(LunchMoney::Calls::Base) }
|
111
222
|
def asset_calls
|
112
223
|
with_valid_api_key do
|
@@ -116,6 +227,13 @@ module LunchMoney
|
|
116
227
|
|
117
228
|
delegate :plaid_accounts, :plaid_accounts_fetch, to: :plaid_account_calls
|
118
229
|
|
230
|
+
# All [Plaid accounts call types](https://lunchmoney.dev/#plaid-accounts) come through here.
|
231
|
+
# @example [Get All Plaid Accounts](https://lunchmoney.dev/#get-all-plaid-accounts)
|
232
|
+
# api = LunchMoney::Api.new
|
233
|
+
# api.plaid_accounts
|
234
|
+
# @example [Trigger Fetch from Plaid](https://lunchmoney.dev/#trigger-fetch-from-plaid)
|
235
|
+
# api = LunchMoney::Api.new
|
236
|
+
# api.plaid_accounts_fetch
|
119
237
|
sig { returns(LunchMoney::Calls::Base) }
|
120
238
|
def plaid_account_calls
|
121
239
|
with_valid_api_key do
|
@@ -128,6 +246,13 @@ module LunchMoney
|
|
128
246
|
|
129
247
|
delegate :crypto, :update_crypto, to: :crypto_calls
|
130
248
|
|
249
|
+
# All [crypto call types](https://lunchmoney.dev/#crypto) come through here.
|
250
|
+
# @example [Get All Crypto](https://lunchmoney.dev/#get-all-crypto)
|
251
|
+
# api = LunchMoney::Api.new
|
252
|
+
# api.crypto
|
253
|
+
# @example [Update Manual Crypto Asset](https://lunchmoney.dev/#update-manual-crypto-asset)
|
254
|
+
# api = LunchMoney::Api.new
|
255
|
+
# api.update_crypto(1234567, name: "New Crypto Name")
|
131
256
|
sig { returns(LunchMoney::Calls::Base) }
|
132
257
|
def crypto_calls
|
133
258
|
with_valid_api_key do
|
@@ -4,9 +4,15 @@
|
|
4
4
|
require_relative "../errors"
|
5
5
|
|
6
6
|
module LunchMoney
|
7
|
-
# Namespace for API call classes
|
7
|
+
# Namespace for all API call classes. The methods on these classes should not typically be accessed directly.
|
8
|
+
# Instead they should be accessed through `LunchMoney::Api` instances, which will handle delegating the methods to
|
9
|
+
# the appropriate Calls class.
|
10
|
+
# @example
|
11
|
+
# api = LunchMoney::Api.new
|
12
|
+
# api.categories # This will be delegated to LunchMoney::Calls::Categories#categories
|
8
13
|
module Calls
|
9
|
-
# Base class for all API call types
|
14
|
+
# Base class for all API call types. Containing the base methods got HTTP call types like GET / POST / PUT / DELETE
|
15
|
+
# as well as the general error handler
|
10
16
|
class Base
|
11
17
|
# Base URL used for API calls
|
12
18
|
BASE_URL = "https://dev.lunchmoney.app/v1/"
|