papierkram_api_client 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +2 -2
- data/README.md +56 -13
- data/UPGRADING.md +45 -0
- data/lib/papierkram_api/v1/validators/expense_voucher.rb +2 -2
- data/lib/papierkram_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c99716d33a07425d28d28395d3f428e2a3b3340faac0d5cf7a3bdd7a6d28cfd9
|
4
|
+
data.tar.gz: ce4b47ad13476cc988f326a337de4e5e5b2e7e90d94346c5cb2b1ec9cca30a21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8bca55f782b372ac64ef98eaa0a0a1c4d70e5ab558e3d123d53b356081550bd1f2e6a82a1d0d12a023dd457323780e673768c3572e8333227369edef2b497b
|
7
|
+
data.tar.gz: 4bc2662091a4a6df9574227a4101929f38dfb6fce877dfe01d5f263ea3707a3c01c307c198cfae51768858e53053343a8b015285e7484f340afd6feea940b8d8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
Schema for new entries:
|
4
|
+
|
5
|
+
```markdown
|
6
|
+
- [#<PR_NUMBER>](https://github.com/simonneutert/papierkram_api_client/pull/<PR_NUMBER>) Description. [@<username>](https://github.com/<username>)
|
7
|
+
```
|
8
|
+
|
9
|
+
## [0.4.2] - 2024-02-04
|
10
|
+
|
11
|
+
- [#114](https://github.com/simonneutert/papierkram_api_client/pull/114) Public API of Papierkram changed, adapt your implementation of `vat_rate` attribute, please. [@simonneutert](https://github.com/simonneutert)
|
12
|
+
|
13
|
+
Please see [UPGRADING.md](UPGRADING.md) for more information.
|
14
|
+
|
15
|
+
## [0.4.1] - 2024-01-26
|
4
16
|
|
5
17
|
- [#111](https://github.com/simonneutert/papierkram_api_client/pull/111) Updates dependencies via bundler. [@simonneutert](https://github.com/simonneutert)
|
6
18
|
- [#110](https://github.com/simonneutert/papierkram_api_client/pull/110) Adds debug option to shoot against localhost:3000. [@simonneutert](https://github.com/simonneutert)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
papierkram_api_client (0.4.
|
4
|
+
papierkram_api_client (0.4.2)
|
5
5
|
faraday (~> 2.7)
|
6
6
|
faraday-multipart (= 1.0.4)
|
7
7
|
httpx (>= 0.22.5, < 1.3.0)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
faraday-net_http (3.0.2)
|
26
26
|
hashdiff (1.1.0)
|
27
27
|
http-2-next (1.0.3)
|
28
|
-
httpx (1.2.
|
28
|
+
httpx (1.2.2)
|
29
29
|
http-2-next (>= 1.0.3)
|
30
30
|
json (2.7.1)
|
31
31
|
language_server-protocol (3.17.0.3)
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Ruby](https://github.com/simonneutert/papierkram_api_client/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/simonneutert/papierkram_api_client/actions/workflows/main.yml)
|
4
4
|
|
5
|
-
Der erste ~~illegale~~ inoffizielle API Client in [Ruby](https://www.ruby-lang.org/de/) für [Papierkram.de](https://www.papierkram.de) als [Gem](https://rubygems.org/gems/papierkram_api_client)
|
5
|
+
Der erste ~~illegale~~ inoffizielle API Client in [Ruby](https://www.ruby-lang.org/de/) für [Papierkram.de](https://www.papierkram.de) als [Gem](https://rubygems.org/gems/papierkram_api_client) für dein Projekt!
|
6
6
|
|
7
7
|
<div align="center">
|
8
8
|
<img src="logo.svg" alt="PAC Logo, Zunge leckt an Karl Klammer und zieht Daten aus dem Papierkram-Account wie Frosch die Fliege vom Teich" width="300">
|
@@ -158,6 +158,7 @@ Ziele:
|
|
158
158
|
- [Development / Mitentwickeln](#development--mitentwickeln)
|
159
159
|
- [Localhost 3000! 🤫](#localhost-3000-)
|
160
160
|
- [Contributing](#contributing)
|
161
|
+
- [Releasing](#releasing)
|
161
162
|
- [License](#license)
|
162
163
|
|
163
164
|
## Installation
|
@@ -215,6 +216,8 @@ client = PapierkramApi::Client.new('subdomain', "SUPER-LONG-API-KEY")
|
|
215
216
|
|
216
217
|
Oder es werden die Umgebungsvariablen `PAPIERKRAM_API_SUBDOMAIN` und `PAPIERKRAM_API_KEY` gesetzt und der Client ohne Argumente initialisiert.
|
217
218
|
|
219
|
+
Ich kann dir wärmstes https://direnv.net/ empfehlen, um die Umgebungsvariablen zu setzen. 🤓
|
220
|
+
|
218
221
|
```ruby
|
219
222
|
# usage with environment variables
|
220
223
|
client = PapierkramApi::Client.new
|
@@ -502,13 +505,13 @@ voucher = client.expense_vouchers.create(
|
|
502
505
|
{
|
503
506
|
amount: 150.8,
|
504
507
|
name: "restaurant bill",
|
505
|
-
vat_rate:
|
508
|
+
vat_rate: 0.19,
|
506
509
|
category: "Bewirtungskosten"
|
507
510
|
},
|
508
511
|
{
|
509
512
|
amount: 15,
|
510
513
|
name: "tip",
|
511
|
-
vat_rate:
|
514
|
+
vat_rate: 0.19,
|
512
515
|
category: "Bewirtungskosten"
|
513
516
|
}
|
514
517
|
]
|
@@ -528,7 +531,7 @@ voucher = client.expense_vouchers.update_by(
|
|
528
531
|
{
|
529
532
|
amount: 170.8,
|
530
533
|
name: "restaurant bill",
|
531
|
-
vat_rate:
|
534
|
+
vat_rate: 0.19,
|
532
535
|
category: "Bewirtungskosten",
|
533
536
|
billing: null,
|
534
537
|
depreciation: null
|
@@ -536,7 +539,7 @@ voucher = client.expense_vouchers.update_by(
|
|
536
539
|
{
|
537
540
|
amount: 15,
|
538
541
|
name: "tip",
|
539
|
-
vat_rate:
|
542
|
+
vat_rate: 0.19,
|
540
543
|
category: "Bewirtungskosten"
|
541
544
|
}
|
542
545
|
]
|
@@ -695,7 +698,7 @@ invoice = client.income_invoices.create(
|
|
695
698
|
description: 'Anlieferung der neuen Möbel',
|
696
699
|
quantity: 1.25,
|
697
700
|
unit: 'Stunden',
|
698
|
-
vat_rate:
|
701
|
+
vat_rate: 0.19,
|
699
702
|
price: 100
|
700
703
|
},
|
701
704
|
{
|
@@ -703,7 +706,7 @@ invoice = client.income_invoices.create(
|
|
703
706
|
description: 'Bestuhlung des Bürogebäudes',
|
704
707
|
quantity: 1.25,
|
705
708
|
unit: 'Arbeitstage',
|
706
|
-
vat_rate:
|
709
|
+
vat_rate: 0.19,
|
707
710
|
price: 800
|
708
711
|
},
|
709
712
|
{
|
@@ -711,7 +714,7 @@ invoice = client.income_invoices.create(
|
|
711
714
|
description: 'Neue Bürostühle',
|
712
715
|
quantity: 200,
|
713
716
|
unit: 'Stühle',
|
714
|
-
vat_rate:
|
717
|
+
vat_rate: 0.19,
|
715
718
|
price: 125
|
716
719
|
}
|
717
720
|
]
|
@@ -732,7 +735,7 @@ response = client.income_invoices.update_by(
|
|
732
735
|
description: 'Anlieferung der neuen Möbel',
|
733
736
|
quantity: 1.5,
|
734
737
|
unit: 'Stunden',
|
735
|
-
vat_rate:
|
738
|
+
vat_rate: 0.19,
|
736
739
|
price: 100
|
737
740
|
},
|
738
741
|
{
|
@@ -740,7 +743,7 @@ response = client.income_invoices.update_by(
|
|
740
743
|
description: 'Bestuhlung des Bürogebäudes',
|
741
744
|
quantity: 1.5,
|
742
745
|
unit: 'Arbeitstage',
|
743
|
-
vat_rate:
|
746
|
+
vat_rate: 0.19,
|
744
747
|
price: 800
|
745
748
|
},
|
746
749
|
{
|
@@ -748,7 +751,7 @@ response = client.income_invoices.update_by(
|
|
748
751
|
description: 'Neue Bürostühle',
|
749
752
|
quantity: 200,
|
750
753
|
unit: 'Stühle',
|
751
|
-
vat_rate:
|
754
|
+
vat_rate: 0.19,
|
752
755
|
price: 125
|
753
756
|
}
|
754
757
|
]
|
@@ -866,7 +869,7 @@ proposition = client.income_propositions.create(
|
|
866
869
|
time_unit: 'hour',
|
867
870
|
proposition_type: 'service',
|
868
871
|
price: '150.0',
|
869
|
-
vat_rate:
|
872
|
+
vat_rate: 0.19
|
870
873
|
)
|
871
874
|
puts proposition.headers
|
872
875
|
puts proposition.body
|
@@ -880,7 +883,7 @@ Siehe [Propositions#create](lib/papierkram_api/v1/endpoints/income/propositions.
|
|
880
883
|
client.income_propositions.update_by(
|
881
884
|
id: 1,
|
882
885
|
name: 'Software design',
|
883
|
-
vat_rate:
|
886
|
+
vat_rate: 0.19 # verpflichtend bei Änderung
|
884
887
|
)
|
885
888
|
```
|
886
889
|
|
@@ -1256,14 +1259,37 @@ puts pdf
|
|
1256
1259
|
|
1257
1260
|
## Development / Mitentwickeln
|
1258
1261
|
|
1262
|
+
🇬🇧/🇺🇸
|
1263
|
+
|
1259
1264
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
1260
1265
|
|
1261
1266
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
1262
1267
|
|
1268
|
+
You need to have at least the following environment variables set to run the tests:
|
1269
|
+
|
1270
|
+
- `MT_COMPAT=true` or `export MT_COMPAT=true` (when in .envrc)
|
1271
|
+
|
1272
|
+
Please, see the [`.envrc.sample`](.envrc.sample) file for more (https://direnv.net/).
|
1273
|
+
|
1274
|
+
🇩🇪
|
1275
|
+
|
1276
|
+
Nachdem du das Repository überprüft hast, führe `bin/setup` aus, um Abhängigkeiten zu installieren. Anschließend führe `rake test` aus, um die Tests durchzuführen. Du kannst auch `bin/console` ausführen, um eine interaktive Konsole zu starten und Experimente durchzuführen.
|
1277
|
+
|
1278
|
+
Um dieses Gem auf deinem lokalen Rechner zu installieren, führe `bundle exec rake install` aus. Um eine neue Version zu veröffentlichen, aktualisiere die Versionsnummer in `version.rb` und führe dann `bundle exec rake release` aus. Dadurch wird ein Git-Tag für die Version erstellt, Git-Commits und das erstellte Tag werden gepusht, und die `.gem`-Datei wird nach [rubygems.org](https://rubygems.org) gepusht.
|
1279
|
+
|
1280
|
+
Um die Tests auszuführen, muss die Umgebungsvariable `MT_COMPAT=true` gesetzt sein.
|
1281
|
+
|
1282
|
+
Bitte, schaue in die Datei [`.envrc.sample`](.envrc.sample) für mehr Details (https://direnv.net/).
|
1283
|
+
|
1263
1284
|
### Localhost 3000! 🤫
|
1264
1285
|
|
1286
|
+
Es gibt Menschen da draußen, die können gegen direkt gegen die Papierkram API entwickeln. 🤯
|
1287
|
+
Und wie das geht, verrate ich hier allen Lesern! 🤫
|
1288
|
+
|
1265
1289
|
`DEBUG_LOCALHOST=true bin/console`
|
1266
1290
|
|
1291
|
+
siehe: [test/test_api_v1_client.rb](test/test_api_v1_client.rb)
|
1292
|
+
|
1267
1293
|
OR to make it stick:
|
1268
1294
|
- Set `export DEBUG_LOCALHOST=true` in your `.env` or `.envrc` file.
|
1269
1295
|
- Enjoy the magic: `bin/setup && bin/console` 🎉
|
@@ -1280,6 +1306,23 @@ Bitte achte darauf, dass du die Tests ausführst und die Tests dann auch grün s
|
|
1280
1306
|
|
1281
1307
|
Wenn du unsicher bist, sprich mich an oder erstelle ein Issue. Ich helfe dir gerne weiter. 🤗
|
1282
1308
|
|
1309
|
+
## Releasing
|
1310
|
+
|
1311
|
+
1. checkout `main`
|
1312
|
+
2. close the changelog
|
1313
|
+
3. Set the correct/desired version number in `version.rb` and run `bundle install` just for sure
|
1314
|
+
4. commit if needed
|
1315
|
+
5. `bundle exec rake release`
|
1316
|
+
|
1317
|
+
After a successful release, the gem is pushed to [rubygems.org](https://rubygems.org/gems/papierkram_api_client).
|
1318
|
+
|
1319
|
+
Here are the steps you need to take after a successful release:
|
1320
|
+
|
1321
|
+
1. edit `lib/papierkram_api_client/version.rb` and bump the version number to the next patch version
|
1322
|
+
2. run `bundle install`
|
1323
|
+
3. open the changelog again
|
1324
|
+
4. commit and push the changes
|
1325
|
+
|
1283
1326
|
## License
|
1284
1327
|
|
1285
1328
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/UPGRADING.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1
|
+
## From 0.4.2 onwards
|
2
|
+
|
3
|
+
`vat_rate` attribute of line_items, were Strings, like "19%", but the public API of Papierkram changed and expects Floats/Decimals like `0.19`. Please update your code accordingly.
|
4
|
+
|
5
|
+
**Create an invoice:**
|
6
|
+
|
7
|
+
see [Invoices#create](lib/papierkram_api/v1/endpoints/income/invoices.rb) for possible params.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
invoice = client.income_invoices.create(
|
11
|
+
name: 'Neuausstattung des Büros',
|
12
|
+
supply_date: '01.01.2024 - 14.01.2024',
|
13
|
+
document_date: '2024-01-15',
|
14
|
+
payment_term_id: 46,
|
15
|
+
customer_id: 3,
|
16
|
+
project_id: 15,
|
17
|
+
line_items: [
|
18
|
+
{
|
19
|
+
name: 'Anlieferung',
|
20
|
+
description: 'Anlieferung der neuen Möbel',
|
21
|
+
quantity: 1.25,
|
22
|
+
unit: 'Stunden',
|
23
|
+
vat_rate: 0.19, # << here >>
|
24
|
+
price: 100
|
25
|
+
},
|
26
|
+
{
|
27
|
+
name: 'Bestuhlung',
|
28
|
+
description: 'Bestuhlung des Bürogebäudes',
|
29
|
+
quantity: 1.25,
|
30
|
+
unit: 'Arbeitstage',
|
31
|
+
vat_rate: 0.19, # << here >>
|
32
|
+
price: 800
|
33
|
+
},
|
34
|
+
{
|
35
|
+
name: 'Büroartikel',
|
36
|
+
description: 'Neue Bürostühle',
|
37
|
+
quantity: 200,
|
38
|
+
unit: 'Stühle',
|
39
|
+
vat_rate: 0.19, # << here >>
|
40
|
+
price: 125
|
41
|
+
}
|
42
|
+
]
|
43
|
+
)
|
44
|
+
```
|
45
|
+
|
1
46
|
## From 0.3 to 0.4
|
2
47
|
|
3
48
|
Some endpoints are calling `update` have changed. Instead of `update_by(id: 123, attributes: { ... })` you now use keywords e.g. `update_by(id: 123, name: 'New name')`.
|
@@ -68,7 +68,7 @@ module PapierkramApi
|
|
68
68
|
name: 'restaurant bill',
|
69
69
|
amount: 150.8,
|
70
70
|
category: 'Bewirtungskosten',
|
71
|
-
vat_rate:
|
71
|
+
vat_rate: 0.19,
|
72
72
|
billing: nil,
|
73
73
|
depreciation: nil
|
74
74
|
},
|
@@ -76,7 +76,7 @@ module PapierkramApi
|
|
76
76
|
name: 'tip',
|
77
77
|
amount: 15,
|
78
78
|
category: 'Bewirtungskosten',
|
79
|
-
vat_rate:
|
79
|
+
vat_rate: 0.19,
|
80
80
|
billing: nil,
|
81
81
|
depreciation: nil
|
82
82
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papierkram_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Neutert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|