lunchmoney 1.1.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 +13 -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 +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/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 +19 -16
- /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: a66d419d272f25d940cb0ad8a5f5962b85aa3cb74deee1486e3f7ed9caf9f8ac
|
4
|
+
data.tar.gz: bd656eac78fd93d9979e3a86ab639f7f880f2e74fd2fb3a0e64889a7df8e6086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d756dda147ed0c8cb492c2be68d40772a0d182513fbef4cdc326c7a5644b16f23e8a7ee5bb0228e030d6f16b9c8b396b1fd3cedc9bdfd9d389bdd9bddef37721
|
7
|
+
data.tar.gz: c9899675f397835b813d864db59db9e311cb1f99422349c901f8676a409bd22ce8be0a42e8bdc8c6ad77f341c23f7b67436966c4e10b09cc95eb9d8838dd3432
|
@@ -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: mmenanno/lunchmoney/.github/workflows/dependabot-rbi-updater.yml@main
|
17
|
+
secrets: inherit
|
18
|
+
|
19
|
+
ci:
|
20
|
+
needs: update-rbis
|
21
|
+
if: always() && contains(needs.*.result, 'skipped')
|
22
|
+
name: "CI"
|
23
|
+
uses: mmenanno/lunchmoney/.github/workflows/ci.yml@main
|
24
|
+
secrets: inherit
|
data/.github/workflows/ci.yml
CHANGED
@@ -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
|
|
@@ -1,32 +1,29 @@
|
|
1
1
|
name: Publish Gem
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
workflow_call:
|
5
|
+
workflow_dispatch:
|
6
|
+
|
7
7
|
jobs:
|
8
8
|
build:
|
9
9
|
name: Build & Release Gem
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
environment: rubygems
|
12
12
|
|
13
|
+
permissions:
|
14
|
+
contents: write
|
15
|
+
id-token: write
|
16
|
+
|
13
17
|
steps:
|
18
|
+
# Set up
|
14
19
|
- uses: actions/checkout@v4
|
15
|
-
|
16
20
|
- name: Set up Ruby
|
17
21
|
uses: ruby/setup-ruby@v1
|
18
22
|
with:
|
19
|
-
ruby-version: 3.3.0
|
20
23
|
bundler-cache: true
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
chmod 0600 $HOME/.gem/credentials
|
27
|
-
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
-
gem build *.gemspec
|
29
|
-
gem push *.gem
|
30
|
-
env:
|
31
|
-
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
24
|
+
ruby-version: ruby
|
25
|
+
|
26
|
+
# Release
|
27
|
+
- name: Publish to RubyGems
|
28
|
+
uses: rubygems/release-gem@v1
|
32
29
|
|
@@ -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: mmenanno/lunchmoney/.github/workflows/ci.yml@main
|
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/.rubocop.yml
CHANGED
@@ -22,16 +22,19 @@ Sorbet/FalseSigil:
|
|
22
22
|
Sorbet/StrictSigil:
|
23
23
|
Enabled: true
|
24
24
|
Exclude:
|
25
|
-
- "test/*"
|
26
25
|
- ".toys/**/*"
|
27
26
|
|
28
27
|
Sorbet/ForbidTStruct:
|
28
|
+
# Context for why this is preferable https://github.com/Shopify/rubocop-sorbet/pull/178#issuecomment-1739924189
|
29
29
|
Enabled: true
|
30
|
-
|
30
|
+
|
31
31
|
|
32
32
|
Sorbet/RedundantExtendTSig:
|
33
33
|
Enabled: true
|
34
34
|
|
35
|
+
Sorbet/ForbidTUnsafe:
|
36
|
+
Enabled: true
|
37
|
+
|
35
38
|
Minitest:
|
36
39
|
Enabled: true
|
37
40
|
|
data/Gemfile
CHANGED
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.1)
|
5
5
|
activesupport (>= 6.1)
|
6
6
|
faraday (>= 1.0.0)
|
7
7
|
sorbet-runtime (>= 0.5)
|
@@ -31,7 +31,8 @@ GEM
|
|
31
31
|
coderay (1.1.3)
|
32
32
|
concurrent-ruby (1.2.3)
|
33
33
|
connection_pool (2.4.1)
|
34
|
-
crack (0.
|
34
|
+
crack (1.0.0)
|
35
|
+
bigdecimal
|
35
36
|
rexml
|
36
37
|
dotenv (2.8.1)
|
37
38
|
drb (2.2.0)
|
@@ -47,7 +48,7 @@ GEM
|
|
47
48
|
json (2.7.1)
|
48
49
|
language_server-protocol (3.17.0.3)
|
49
50
|
method_source (1.0.0)
|
50
|
-
minitest (5.
|
51
|
+
minitest (5.22.2)
|
51
52
|
mocha (2.1.0)
|
52
53
|
ruby2_keywords (>= 0.0.5)
|
53
54
|
mutex_m (0.2.0)
|
@@ -75,7 +76,7 @@ GEM
|
|
75
76
|
sorbet-runtime (>= 0.5.9204)
|
76
77
|
regexp_parser (2.9.0)
|
77
78
|
rexml (3.2.6)
|
78
|
-
rubocop (1.60.
|
79
|
+
rubocop (1.60.2)
|
79
80
|
json (~> 2.3)
|
80
81
|
language_server-protocol (>= 3.17.0)
|
81
82
|
parallel (~> 1.10)
|
@@ -98,18 +99,18 @@ GEM
|
|
98
99
|
rubocop-ast (>= 1.30.0, < 2.0)
|
99
100
|
rubocop-shopify (2.14.0)
|
100
101
|
rubocop (~> 1.51)
|
101
|
-
rubocop-sorbet (0.7.
|
102
|
+
rubocop-sorbet (0.7.7)
|
102
103
|
rubocop (>= 0.90.0)
|
103
104
|
ruby-progressbar (1.13.0)
|
104
105
|
ruby2_keywords (0.0.5)
|
105
|
-
sorbet (0.5.
|
106
|
-
sorbet-static (= 0.5.
|
107
|
-
sorbet-runtime (0.5.
|
108
|
-
sorbet-static (0.5.
|
109
|
-
sorbet-static (0.5.
|
110
|
-
sorbet-static-and-runtime (0.5.
|
111
|
-
sorbet (= 0.5.
|
112
|
-
sorbet-runtime (= 0.5.
|
106
|
+
sorbet (0.5.11247)
|
107
|
+
sorbet-static (= 0.5.11247)
|
108
|
+
sorbet-runtime (0.5.11247)
|
109
|
+
sorbet-static (0.5.11247-universal-darwin)
|
110
|
+
sorbet-static (0.5.11247-x86_64-linux)
|
111
|
+
sorbet-static-and-runtime (0.5.11247)
|
112
|
+
sorbet (= 0.5.11247)
|
113
|
+
sorbet-runtime (= 0.5.11247)
|
113
114
|
spoom (1.2.4)
|
114
115
|
erubi (>= 1.10.0)
|
115
116
|
sorbet-static-and-runtime (>= 0.5.10187)
|
@@ -127,15 +128,15 @@ GEM
|
|
127
128
|
thor (>= 1.2.0)
|
128
129
|
yard-sorbet
|
129
130
|
thor (1.3.0)
|
130
|
-
toys (0.15.
|
131
|
-
toys-core (= 0.15.
|
132
|
-
toys-core (0.15.
|
131
|
+
toys (0.15.5)
|
132
|
+
toys-core (= 0.15.5)
|
133
|
+
toys-core (0.15.5)
|
133
134
|
tzinfo (2.0.6)
|
134
135
|
concurrent-ruby (~> 1.0)
|
135
136
|
unicode-display_width (2.5.0)
|
136
137
|
uri (0.13.0)
|
137
138
|
vcr (6.2.0)
|
138
|
-
webmock (3.
|
139
|
+
webmock (3.20.0)
|
139
140
|
addressable (>= 2.8.0)
|
140
141
|
crack (>= 0.3.2)
|
141
142
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -154,7 +155,7 @@ DEPENDENCIES
|
|
154
155
|
appraisal
|
155
156
|
dotenv
|
156
157
|
lunchmoney!
|
157
|
-
minitest (~> 5.
|
158
|
+
minitest (~> 5.22)
|
158
159
|
mocha (~> 2.1.0)
|
159
160
|
pry-sorbet (~> 0.2)
|
160
161
|
rubocop-minitest
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
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
8
|
|
9
|
-
Documentation is still a work in process, but you can find the yard docs for this gem [here](https://halorrr.github.io/lunchmoney/) as well as some write ups of the basics below.
|
9
|
+
Documentation is still a work in process, but you can find the yard docs for this gem [here](https://halorrr.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://halorrr.github.io/lunchmoney/LunchMoney/Api.html).
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
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/"
|
data/lib/lunchmoney/errors.rb
CHANGED
@@ -2,7 +2,23 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module LunchMoney
|
5
|
-
# This class is used to represent errors returned directly from the LunchMoney API
|
5
|
+
# This class is used to represent errors returned directly from the LunchMoney API. This class has been set up to act
|
6
|
+
# like an array, delegating a lot of common array getter methods directly to messages for you.
|
7
|
+
# @example
|
8
|
+
# api = LunchMoney::Api.new
|
9
|
+
# response = api.categories
|
10
|
+
#
|
11
|
+
# response.class
|
12
|
+
# => LunchMoney::Errors
|
13
|
+
#
|
14
|
+
# response.first
|
15
|
+
# => "Some error returned by the API"
|
16
|
+
#
|
17
|
+
# response.empty?
|
18
|
+
# => false
|
19
|
+
#
|
20
|
+
# response[0]
|
21
|
+
# => "Some error returned by the API"
|
6
22
|
class Errors
|
7
23
|
sig { returns(T::Array[String]) }
|
8
24
|
attr_accessor :messages
|
data/lib/lunchmoney/version.rb
CHANGED
data/lunchmoney.gemspec
CHANGED
@@ -5,18 +5,17 @@ require_relative "lib/lunchmoney/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "lunchmoney"
|
7
7
|
spec.version = LunchMoney::VERSION
|
8
|
-
spec.author = "@
|
9
|
-
spec.email = "halorrr@gmail.com"
|
8
|
+
spec.author = "@mmenanno"
|
10
9
|
|
11
10
|
spec.summary = "LunchMoney API client library."
|
12
|
-
spec.homepage = "https://github.com/
|
11
|
+
spec.homepage = "https://github.com/mmenanno/lunchmoney"
|
13
12
|
spec.required_ruby_version = ">= 3.1"
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
16
15
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
-
spec.metadata["documentation_uri"] = "https://
|
18
|
+
spec.metadata["documentation_uri"] = "https://mmenanno.github.io/lunchmoney/"
|
20
19
|
spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"
|
21
20
|
|
22
21
|
# Specify which files should be added to the gem when it is released.
|