papierkram_api_client 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop +2 -1
- data/.rubocop.yml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +29 -24
- data/README.md +316 -11
- data/lib/papierkram_api/client.rb +4 -0
- data/lib/papierkram_api/v1/business_intelligence/base.rb +9 -0
- data/lib/papierkram_api/v1/endpoints/expense/vouchers.rb +150 -0
- data/lib/papierkram_api/v1/endpoints/income/invoices.rb +154 -8
- data/lib/papierkram_api/v1/endpoints/income/propositions.rb +3 -2
- data/lib/papierkram_api_client/version.rb +1 -1
- data/lib/papierkram_api_client.rb +1 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc4d14d9a0135d202a4e8b793c39e2e07bc793227805066d58d763b4d0ba83f
|
4
|
+
data.tar.gz: c908db9d494df6eaa1b893eef0b72963c653382294188c2954b279f2135aea2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37d01c1402b38859b9cf189f9b40173f5801a553d772111fcaf9e198aa0c5e0b88db1d85ada4ef739e73097c658b305ad2a4940fc9ed5f0050c55cdac0038a1e
|
7
|
+
data.tar.gz: dc0260d1cded8a6a9aa14c415acda652adab27cf70f1764d9726c776923a1d0625243733a3ecfeb845b563534695ce88683afcc2449674ef030d8eb7389f05b3
|
data/.rubocop
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
--server
|
1
|
+
--server
|
2
|
+
--parallel
|
data/.rubocop.yml
CHANGED
@@ -10,15 +10,15 @@ AllCops:
|
|
10
10
|
- "vendor/**/*"
|
11
11
|
- "papierkram_api_client.gemspec"
|
12
12
|
|
13
|
+
Layout/LineLength:
|
14
|
+
Exclude:
|
15
|
+
- "test/cassettes/**/*"
|
16
|
+
|
13
17
|
Metrics/BlockLength:
|
14
18
|
Enabled: true
|
15
19
|
Exclude:
|
16
20
|
- "test/**/*"
|
17
21
|
|
18
|
-
Layout/LineLength:
|
19
|
-
Exclude:
|
20
|
-
- "test/cassettes/**/*"
|
21
|
-
|
22
22
|
Metrics/MethodLength:
|
23
23
|
Max: 16
|
24
24
|
CountAsOne:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [next] - yyyy-mm-dd
|
4
|
+
|
5
|
+
- [#111](https://github.com/simonneutert/papierkram_api_client/pull/111) Updates dependencies via bundler. [@simonneutert](https://github.com/simonneutert)
|
6
|
+
- [#110](https://github.com/simonneutert/papierkram_api_client/pull/110) Adds debug option to shoot against localhost:3000. [@simonneutert](https://github.com/simonneutert)
|
7
|
+
- [#109](https://github.com/simonneutert/papierkram_api_client/pull/109) Housekeeping. [@simonneutert](https://github.com/simonneutert)
|
8
|
+
- [#108](https://github.com/simonneutert/papierkram_api_client/pull/108) Fixes bug in `Income::Invoice.deliver`. [@simonneutert](https://github.com/simonneutert)
|
9
|
+
- [#101](https://github.com/simonneutert/papierkram_api_client/pull/101) Adds DEPRECATION WARNING 🚨 of experimental Business Intelligence Module. [@simonneutert](https://github.com/simonneutert)
|
10
|
+
- [#100](https://github.com/simonneutert/papierkram_api_client/pull/100) Writing endpoints for (income) invoices. [@simonneutert](https://github.com/simonneutert)
|
11
|
+
- [#99](https://github.com/simonneutert/papierkram_api_client/pull/99) Writing endpoints for (income/expense) vouchers. [@simonneutert](https://github.com/simonneutert)
|
12
|
+
- [#93](https://github.com/simonneutert/papierkram_api_client/pull/93) Fresh set of most endpoints got get_all actions. [@simonneutert](https://github.com/simonneutert)
|
13
|
+
|
3
14
|
## [0.4.0] - 2023-12-02
|
4
15
|
|
5
16
|
### Changes (BREAKING! ⚠️)
|
data/Gemfile
CHANGED
@@ -5,13 +5,13 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in papierkram_api_client.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'minitest', '~> 5.
|
8
|
+
gem 'minitest', '~> 5.21'
|
9
9
|
gem 'minitest-vcr', '~> 1.4'
|
10
10
|
gem 'pry', '~> 0.14.2'
|
11
11
|
gem 'rake', '~> 13.1'
|
12
|
-
gem 'rubocop', '~> 1.
|
13
|
-
gem 'rubocop-minitest', '~> 0.
|
14
|
-
gem 'rubocop-performance', '~> 1.
|
12
|
+
gem 'rubocop', '~> 1.60', require: false
|
13
|
+
gem 'rubocop-minitest', '~> 0.34.5', require: false
|
14
|
+
gem 'rubocop-performance', '~> 1.20', require: false
|
15
15
|
gem 'rubocop-rake', '~> 0.6.0', require: false
|
16
16
|
gem 'vcr', '~> 6.2'
|
17
17
|
gem 'webmock', '~> 3.19'
|
data/Gemfile.lock
CHANGED
@@ -1,57 +1,61 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
papierkram_api_client (0.4.
|
4
|
+
papierkram_api_client (0.4.1)
|
5
5
|
faraday (~> 2.7)
|
6
|
-
|
6
|
+
faraday-multipart (= 1.0.4)
|
7
|
+
httpx (>= 0.22.5, < 1.3.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
addressable (2.8.
|
12
|
+
addressable (2.8.6)
|
12
13
|
public_suffix (>= 2.0.2, < 6.0)
|
13
14
|
ast (2.4.2)
|
14
15
|
base64 (0.2.0)
|
15
16
|
coderay (1.1.3)
|
16
17
|
crack (0.4.5)
|
17
18
|
rexml
|
18
|
-
faraday (2.
|
19
|
+
faraday (2.8.1)
|
19
20
|
base64
|
20
21
|
faraday-net_http (>= 2.0, < 3.1)
|
21
22
|
ruby2_keywords (>= 0.0.4)
|
23
|
+
faraday-multipart (1.0.4)
|
24
|
+
multipart-post (~> 2)
|
22
25
|
faraday-net_http (3.0.2)
|
23
|
-
hashdiff (1.0
|
24
|
-
http-2-next (1.0.
|
25
|
-
httpx (1.1
|
26
|
-
http-2-next (>= 1.0.
|
27
|
-
json (2.7.
|
26
|
+
hashdiff (1.1.0)
|
27
|
+
http-2-next (1.0.3)
|
28
|
+
httpx (1.2.1)
|
29
|
+
http-2-next (>= 1.0.3)
|
30
|
+
json (2.7.1)
|
28
31
|
language_server-protocol (3.17.0.3)
|
29
32
|
method_source (1.0.0)
|
30
33
|
minispec-metadata (2.0.0)
|
31
34
|
minitest
|
32
|
-
minitest (5.
|
35
|
+
minitest (5.21.2)
|
33
36
|
minitest-vcr (1.4.0)
|
34
37
|
minispec-metadata (~> 2.0)
|
35
38
|
minitest (>= 4.7.5)
|
36
39
|
vcr (>= 2.9)
|
37
|
-
|
38
|
-
|
40
|
+
multipart-post (2.3.0)
|
41
|
+
parallel (1.24.0)
|
42
|
+
parser (3.3.0.5)
|
39
43
|
ast (~> 2.4.1)
|
40
44
|
racc
|
41
45
|
pry (0.14.2)
|
42
46
|
coderay (~> 1.1)
|
43
47
|
method_source (~> 1.0)
|
44
|
-
public_suffix (5.0.
|
48
|
+
public_suffix (5.0.4)
|
45
49
|
racc (1.7.3)
|
46
50
|
rainbow (3.1.1)
|
47
51
|
rake (13.1.0)
|
48
|
-
regexp_parser (2.
|
52
|
+
regexp_parser (2.9.0)
|
49
53
|
rexml (3.2.6)
|
50
|
-
rubocop (1.
|
54
|
+
rubocop (1.60.2)
|
51
55
|
json (~> 2.3)
|
52
56
|
language_server-protocol (>= 3.17.0)
|
53
57
|
parallel (~> 1.10)
|
54
|
-
parser (>= 3.
|
58
|
+
parser (>= 3.3.0.2)
|
55
59
|
rainbow (>= 2.2.2, < 4.0)
|
56
60
|
regexp_parser (>= 1.8, < 3.0)
|
57
61
|
rexml (>= 3.2.5, < 4.0)
|
@@ -60,11 +64,12 @@ GEM
|
|
60
64
|
unicode-display_width (>= 2.4.0, < 3.0)
|
61
65
|
rubocop-ast (1.30.0)
|
62
66
|
parser (>= 3.2.1.0)
|
63
|
-
rubocop-minitest (0.
|
67
|
+
rubocop-minitest (0.34.5)
|
64
68
|
rubocop (>= 1.39, < 2.0)
|
65
|
-
|
66
|
-
|
67
|
-
rubocop
|
69
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
70
|
+
rubocop-performance (1.20.2)
|
71
|
+
rubocop (>= 1.48.1, < 2.0)
|
72
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
68
73
|
rubocop-rake (0.6.0)
|
69
74
|
rubocop (~> 1.0)
|
70
75
|
ruby-progressbar (1.13.0)
|
@@ -82,14 +87,14 @@ PLATFORMS
|
|
82
87
|
x86_64-linux
|
83
88
|
|
84
89
|
DEPENDENCIES
|
85
|
-
minitest (~> 5.
|
90
|
+
minitest (~> 5.21)
|
86
91
|
minitest-vcr (~> 1.4)
|
87
92
|
papierkram_api_client!
|
88
93
|
pry (~> 0.14.2)
|
89
94
|
rake (~> 13.1)
|
90
|
-
rubocop (~> 1.
|
91
|
-
rubocop-minitest (~> 0.
|
92
|
-
rubocop-performance (~> 1.
|
95
|
+
rubocop (~> 1.60)
|
96
|
+
rubocop-minitest (~> 0.34.5)
|
97
|
+
rubocop-performance (~> 1.20)
|
93
98
|
rubocop-rake (~> 0.6.0)
|
94
99
|
vcr (~> 6.2)
|
95
100
|
webmock (~> 3.19)
|
data/README.md
CHANGED
@@ -10,9 +10,8 @@ Der erste ~~illegale~~ inoffizielle API Client in [Ruby](https://www.ruby-lang.o
|
|
10
10
|
|
11
11
|
---
|
12
12
|
|
13
|
-
**
|
14
|
-
|
15
|
-
Das Gleiche, nur in grün, also für [NodeJS](https://github.com/simonneutert/papierkram-api-client). Und als Mega-Baustelle 😬
|
13
|
+
**Aufruf zur Mitarbeit für NodeJS/JavaScript 🫠**
|
14
|
+
Das Gleiche, nur in grün, also für [NodeJS ein Papierkram Api Client](https://github.com/simonneutert/papierkram-api-client) 😬
|
16
15
|
|
17
16
|
---
|
18
17
|
|
@@ -26,6 +25,9 @@ Schau in [UPGRADING.md](UPGRADING.md), 💃🕺!
|
|
26
25
|
Hier geht es zu den [offiziellen API Docs](https://demo.papierkram.de/api/v1/api-docs/index.html).
|
27
26
|
Schau bitte dort um alle Rückgabefelder/-werte zu checken, bis ich (oder du mit deiner Zeit und Hingabe) die Dokumentation hier komplett habe.
|
28
27
|
|
28
|
+
**WENN DU PROBLEME HAST,** bitte ich dich erstmal die [offiziellen API Docs](https://demo.papierkram.de/api/v1/api-docs/index.html) zu durchstöbern. Dann lohnt es sich hier die Beispiele (weiter unten) zu lesen und von dort sowohl mal in die Methoden im Code zu springen, oder noch besser in die Tests schauen.
|
29
|
+
Wenn du dann immer noch nicht weiterkommst, kannst du gerne einen Issue erstellen. Poste dabei so viele Informationen wie möglich, damit ich dir bestmöglich weiterhelfen kann. Achte dabei bitte darauf, dass du keine privaten Daten postest. 🙏
|
30
|
+
|
29
31
|
---
|
30
32
|
|
31
33
|
## Aktuell unterstützte Endpunkte der Papierkram API (V1)<!-- omit in toc -->
|
@@ -40,9 +42,11 @@ Schau bitte dort um alle Rückgabefelder/-werte zu checken, bis ich (oder du mit
|
|
40
42
|
- [x] Income::PaymentTerms (Zahlungsbedingungen)
|
41
43
|
- [x] Income::Proposition (Waren / Dienstleistungen)
|
42
44
|
- [x] Info
|
45
|
+
- [ ] Settings::CustomAttribute (Datenfelder)
|
43
46
|
- [x] Project (Projekte)
|
44
47
|
- [x] Tracker::Task (Aufgaben)
|
45
48
|
- [x] Tracker::TimeEntry (Zeiterfassung)
|
49
|
+
- [ ] User
|
46
50
|
|
47
51
|
## Was, wie, warum?<!-- omit in toc -->
|
48
52
|
|
@@ -83,6 +87,16 @@ Ziele:
|
|
83
87
|
- [alle Ausgabe Belege](#alle-ausgabe-belege)
|
84
88
|
- [einen Ausgabe Beleg](#einen-ausgabe-beleg)
|
85
89
|
- [einen Ausgabe Beleg als PDF](#einen-ausgabe-beleg-als-pdf)
|
90
|
+
- [einen Ausgabe Beleg erstellen](#einen-ausgabe-beleg-erstellen)
|
91
|
+
- [einen Ausgabe Beleg aktualisieren](#einen-ausgabe-beleg-aktualisieren)
|
92
|
+
- [einen Ausgabe Beleg löschen](#einen-ausgabe-beleg-löschen)
|
93
|
+
- [einen Ausgabe Beleg archivieren](#einen-ausgabe-beleg-archivieren)
|
94
|
+
- [einen Ausgabe Beleg unarchivieren](#einen-ausgabe-beleg-unarchivieren)
|
95
|
+
- [einen Ausgabe Beleg stornieren](#einen-ausgabe-beleg-stornieren)
|
96
|
+
- [einen Ausgabe Beleg rückwirkend stornieren](#einen-ausgabe-beleg-rückwirkend-stornieren)
|
97
|
+
- [einen Ausgabe Beleg als bezahlt markieren](#einen-ausgabe-beleg-als-bezahlt-markieren)
|
98
|
+
- [einem Ausgabe Beleg ein Dokument hinzufügen](#einem-ausgabe-beleg-ein-dokument-hinzufügen)
|
99
|
+
- [einem Ausgabe Beleg ein Dokument entfernen](#einem-ausgabe-beleg-ein-dokument-entfernen)
|
86
100
|
- [Income::Estimate (Angebot)](#incomeestimate-angebot)
|
87
101
|
- [alle Angebote](#alle-angebote)
|
88
102
|
- [ein Angebot](#ein-angebot)
|
@@ -91,6 +105,13 @@ Ziele:
|
|
91
105
|
- [alle Rechnungen](#alle-rechnungen)
|
92
106
|
- [eine Rechnung](#eine-rechnung)
|
93
107
|
- [eine Rechnung als PDF](#eine-rechnung-als-pdf)
|
108
|
+
- [eine Rechnung erstellen](#eine-rechnung-erstellen)
|
109
|
+
- [eine Rechnung aktualisieren](#eine-rechnung-aktualisieren)
|
110
|
+
- [eine Rechnung löschen](#eine-rechnung-löschen)
|
111
|
+
- [eine Rechnung archivieren](#eine-rechnung-archivieren)
|
112
|
+
- [eine Rechnung unarchivieren](#eine-rechnung-unarchivieren)
|
113
|
+
- [eine Rechnung stornieren](#eine-rechnung-stornieren)
|
114
|
+
- [eine Rechnung verschicken](#eine-rechnung-verschicken)
|
94
115
|
- [Income::PaymentTerms (Zahlungsbedingungen)](#incomepaymentterms-zahlungsbedingungen)
|
95
116
|
- [eine Zahlungsbedingung](#eine-zahlungsbedingung)
|
96
117
|
- [alle Zahlungsbedingungen](#alle-zahlungsbedingungen)
|
@@ -134,7 +155,8 @@ Ziele:
|
|
134
155
|
- [alle Ausgaben eines Monats nach Kategorie gefiltert nach Steuersatz](#alle-ausgaben-eines-monats-nach-kategorie-gefiltert-nach-steuersatz)
|
135
156
|
- [Helpers](#helpers)
|
136
157
|
- [Generiere ein PDF aus Response](#generiere-ein-pdf-aus-response)
|
137
|
-
- [Development](#development)
|
158
|
+
- [Development / Mitentwickeln](#development--mitentwickeln)
|
159
|
+
- [Localhost 3000! 🤫](#localhost-3000-)
|
138
160
|
- [Contributing](#contributing)
|
139
161
|
- [License](#license)
|
140
162
|
|
@@ -340,7 +362,7 @@ Siehe [Companies#create_customer](lib/papierkram_api/v1/endpoints/contact/compan
|
|
340
362
|
|
341
363
|
```ruby
|
342
364
|
company = client.contact_companies.update_by(
|
343
|
-
id: 1,
|
365
|
+
id: 1,
|
344
366
|
name: 'Test GmbH'
|
345
367
|
)
|
346
368
|
puts company.headers
|
@@ -459,6 +481,142 @@ puts PapierkramApi::V1::Helpers::PdfFromResponse.new(voucher).to_pdf
|
|
459
481
|
# => {response: Faraday::Response, path_to_pdf_file: 'path/to/tempfile_pdf.pdf'}
|
460
482
|
```
|
461
483
|
|
484
|
+
#### einen Ausgabe Beleg erstellen
|
485
|
+
|
486
|
+
Siehe [Vouchers#create](lib/papierkram_api/v1/endpoints/expense/vouchers.rb) für mögliche Parameter.
|
487
|
+
|
488
|
+
```ruby
|
489
|
+
voucher = client.expense_vouchers.create(
|
490
|
+
name: "Restaurant visit",
|
491
|
+
due_date: "2020-06-30",
|
492
|
+
document_date: "2020-06-14",
|
493
|
+
description: "Took customer for dinner.",
|
494
|
+
entertainment_reason: "sales meeting",
|
495
|
+
flagged: true,
|
496
|
+
provenance: "domestic",
|
497
|
+
entertainment_persons: [
|
498
|
+
"Carl Customer"
|
499
|
+
],
|
500
|
+
creditor_id: 85,
|
501
|
+
line_items: [
|
502
|
+
{
|
503
|
+
amount: 150.8,
|
504
|
+
name: "restaurant bill",
|
505
|
+
vat_rate: "19%",
|
506
|
+
category: "Bewirtungskosten"
|
507
|
+
},
|
508
|
+
{
|
509
|
+
amount: 15,
|
510
|
+
name: "tip",
|
511
|
+
vat_rate: "19%",
|
512
|
+
category: "Bewirtungskosten"
|
513
|
+
}
|
514
|
+
]
|
515
|
+
)
|
516
|
+
```
|
517
|
+
|
518
|
+
#### einen Ausgabe Beleg aktualisieren
|
519
|
+
|
520
|
+
Siehe [Vouchers#update_by](lib/papierkram_api/v1/endpoints/expense/vouchers.rb) für mögliche Parameter.
|
521
|
+
|
522
|
+
```ruby
|
523
|
+
voucher = client.expense_vouchers.update_by(
|
524
|
+
id: 1,
|
525
|
+
document_date: "2020-06-13",
|
526
|
+
creditor_id: 102,
|
527
|
+
line_items: [
|
528
|
+
{
|
529
|
+
amount: 170.8,
|
530
|
+
name: "restaurant bill",
|
531
|
+
vat_rate: "19%",
|
532
|
+
category: "Bewirtungskosten",
|
533
|
+
billing: null,
|
534
|
+
depreciation: null
|
535
|
+
},
|
536
|
+
{
|
537
|
+
amount: 15,
|
538
|
+
name: "tip",
|
539
|
+
vat_rate: "19%",
|
540
|
+
category: "Bewirtungskosten"
|
541
|
+
}
|
542
|
+
]
|
543
|
+
)
|
544
|
+
```
|
545
|
+
|
546
|
+
#### einen Ausgabe Beleg löschen
|
547
|
+
|
548
|
+
```ruby
|
549
|
+
voucher = client.expense_vouchers.delete_by(id: 1)
|
550
|
+
```
|
551
|
+
|
552
|
+
#### einen Ausgabe Beleg archivieren
|
553
|
+
|
554
|
+
```ruby
|
555
|
+
voucher = client.expense_vouchers.archive_by(id: 1)
|
556
|
+
```
|
557
|
+
|
558
|
+
#### einen Ausgabe Beleg unarchivieren
|
559
|
+
|
560
|
+
```ruby
|
561
|
+
voucher = client.expense_vouchers.unarchive_by(id: 1)
|
562
|
+
```
|
563
|
+
|
564
|
+
#### einen Ausgabe Beleg stornieren
|
565
|
+
|
566
|
+
```ruby
|
567
|
+
voucher = client.expense_vouchers.cancel_by(id: 1)
|
568
|
+
```
|
569
|
+
|
570
|
+
#### einen Ausgabe Beleg rückwirkend stornieren
|
571
|
+
|
572
|
+
```ruby
|
573
|
+
voucher = client.expense_vouchers.cancel_with_reverse_entry_by(id: 1)
|
574
|
+
```
|
575
|
+
|
576
|
+
#### einen Ausgabe Beleg als bezahlt markieren
|
577
|
+
|
578
|
+
Siehe [Vouchers#mark_as_paid_by](lib/papierkram_api/v1/endpoints/expense/vouchers.rb) für mögliche Parameter.
|
579
|
+
|
580
|
+
```ruby
|
581
|
+
voucher = client.expense_vouchers.mark_as_paid_by(
|
582
|
+
id: 1,
|
583
|
+
value: 119.0
|
584
|
+
)
|
585
|
+
```
|
586
|
+
|
587
|
+
#### einem Ausgabe Beleg ein Dokument hinzufügen
|
588
|
+
|
589
|
+
Siehe [Vouchers#add_document_by](lib/papierkram_api/v1/endpoints/expense/vouchers.rb) für mögliche Parameter.
|
590
|
+
|
591
|
+
Um ein PDF hinzuzufügen:
|
592
|
+
|
593
|
+
```ruby
|
594
|
+
voucher = client.expense_vouchers.add_document_by(
|
595
|
+
id: 1,
|
596
|
+
path_to_file: 'path/to/file.pdf',
|
597
|
+
file_type: 'application/pdf'
|
598
|
+
)
|
599
|
+
```
|
600
|
+
|
601
|
+
oder mit einem Bild im jpeg Format
|
602
|
+
|
603
|
+
```ruby
|
604
|
+
voucher = client.expense_vouchers.add_document_by(
|
605
|
+
id: 1,
|
606
|
+
path_to_file: 'path/to/file.jpeg',
|
607
|
+
file_type: 'image/jpeg'
|
608
|
+
)
|
609
|
+
```
|
610
|
+
|
611
|
+
#### einem Ausgabe Beleg ein Dokument entfernen
|
612
|
+
|
613
|
+
```ruby
|
614
|
+
voucher = client.expense_vouchers.delete_document_by(
|
615
|
+
id: 1,
|
616
|
+
document_id: 1
|
617
|
+
)
|
618
|
+
```
|
619
|
+
|
462
620
|
### Income::Estimate (Angebot)
|
463
621
|
|
464
622
|
Der Endpunkt `/papierkram_api/v1/endpoints/income/estimates` liefert Informationen über die Angebote. Die Informationen werden als `Faraday::Response` zurückgegeben.
|
@@ -519,6 +677,141 @@ puts PapierkramApi::V1::Helpers::PdfFromResponse.new(invoice).to_pdf
|
|
519
677
|
# => {response: Faraday::Response, path_to_pdf_file: 'path/to/tempfile_pdf.pdf'}
|
520
678
|
```
|
521
679
|
|
680
|
+
#### eine Rechnung erstellen
|
681
|
+
|
682
|
+
Siehe [Invoices#create](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
683
|
+
|
684
|
+
```ruby
|
685
|
+
invoice = client.income_invoices.create(
|
686
|
+
name: 'Neuausstattung des Büros',
|
687
|
+
supply_date: '01.01.2024 - 14.01.2024',
|
688
|
+
document_date: '2024-01-15',
|
689
|
+
payment_term_id: 46,
|
690
|
+
customer_id: 3,
|
691
|
+
project_id: 15,
|
692
|
+
line_items: [
|
693
|
+
{
|
694
|
+
name: 'Anlieferung',
|
695
|
+
description: 'Anlieferung der neuen Möbel',
|
696
|
+
quantity: 1.25,
|
697
|
+
unit: 'Stunden',
|
698
|
+
vat_rate: '19%',
|
699
|
+
price: 100
|
700
|
+
},
|
701
|
+
{
|
702
|
+
name: 'Bestuhlung',
|
703
|
+
description: 'Bestuhlung des Bürogebäudes',
|
704
|
+
quantity: 1.25,
|
705
|
+
unit: 'Arbeitstage',
|
706
|
+
vat_rate: '19%',
|
707
|
+
price: 800
|
708
|
+
},
|
709
|
+
{
|
710
|
+
name: 'Büroartikel',
|
711
|
+
description: 'Neue Bürostühle',
|
712
|
+
quantity: 200,
|
713
|
+
unit: 'Stühle',
|
714
|
+
vat_rate: '19%',
|
715
|
+
price: 125
|
716
|
+
}
|
717
|
+
]
|
718
|
+
)
|
719
|
+
```
|
720
|
+
|
721
|
+
#### eine Rechnung aktualisieren
|
722
|
+
|
723
|
+
Siehe [Invoices#update_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
724
|
+
|
725
|
+
```ruby
|
726
|
+
response = client.income_invoices.update_by(
|
727
|
+
id: 9,
|
728
|
+
name: 'Neuausstattung eines Büros',
|
729
|
+
line_items: [
|
730
|
+
{
|
731
|
+
name: 'Anlieferung',
|
732
|
+
description: 'Anlieferung der neuen Möbel',
|
733
|
+
quantity: 1.5,
|
734
|
+
unit: 'Stunden',
|
735
|
+
vat_rate: '19%',
|
736
|
+
price: 100
|
737
|
+
},
|
738
|
+
{
|
739
|
+
name: 'Bestuhlung',
|
740
|
+
description: 'Bestuhlung des Bürogebäudes',
|
741
|
+
quantity: 1.5,
|
742
|
+
unit: 'Arbeitstage',
|
743
|
+
vat_rate: '19%',
|
744
|
+
price: 800
|
745
|
+
},
|
746
|
+
{
|
747
|
+
name: 'Büroartikel',
|
748
|
+
description: 'Neue Bürostühle',
|
749
|
+
quantity: 200,
|
750
|
+
unit: 'Stühle',
|
751
|
+
vat_rate: '19%',
|
752
|
+
price: 125
|
753
|
+
}
|
754
|
+
]
|
755
|
+
)
|
756
|
+
```
|
757
|
+
|
758
|
+
#### eine Rechnung löschen
|
759
|
+
|
760
|
+
Siehe [Invoices#delete_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
761
|
+
|
762
|
+
```ruby
|
763
|
+
invoice = client.income_invoices.delete_by(id: 1)
|
764
|
+
```
|
765
|
+
|
766
|
+
#### eine Rechnung archivieren
|
767
|
+
|
768
|
+
Siehe [Invoices#archive_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
769
|
+
|
770
|
+
```ruby
|
771
|
+
invoice = client.income_invoices.archive_by(id: 1)
|
772
|
+
```
|
773
|
+
|
774
|
+
#### eine Rechnung unarchivieren
|
775
|
+
|
776
|
+
Siehe [Invoices#unarchive_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
777
|
+
|
778
|
+
```ruby
|
779
|
+
invoice = client.income_invoices.unarchive_by(id: 1)
|
780
|
+
```
|
781
|
+
|
782
|
+
#### eine Rechnung stornieren
|
783
|
+
|
784
|
+
Siehe [Invoices#cancel_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
785
|
+
|
786
|
+
```ruby
|
787
|
+
invoice = client.income_invoices.cancel_by(id: 1)
|
788
|
+
```
|
789
|
+
|
790
|
+
#### eine Rechnung verschicken
|
791
|
+
|
792
|
+
Siehe [Invoices#send_by](lib/papierkram_api/v1/endpoints/income/invoices.rb) für mögliche Parameter.
|
793
|
+
|
794
|
+
Per E-Mail:
|
795
|
+
|
796
|
+
```ruby
|
797
|
+
invoice = client.income_invoices.deliver_by(
|
798
|
+
id: 1,
|
799
|
+
send_via: 'email',
|
800
|
+
email_recipient: "test@test.test",
|
801
|
+
email_subject: "Ich verkaufe was du brauchst",
|
802
|
+
email_body: "Sag einfach was du brauchst und ich verkaufe es dir.",
|
803
|
+
)
|
804
|
+
```
|
805
|
+
|
806
|
+
Per PDF:
|
807
|
+
|
808
|
+
```ruby
|
809
|
+
invoice = client.income_invoices.deliver_by(
|
810
|
+
id: 1,
|
811
|
+
send_via: 'pdf'
|
812
|
+
)
|
813
|
+
```
|
814
|
+
|
522
815
|
### Income::PaymentTerms (Zahlungsbedingungen)
|
523
816
|
|
524
817
|
Der Endpunkt `/papierkram_api/v1/endpoints/income/payment_terms` liefert Informationen über die Zahlungsbedingungen. Die Informationen werden als `Faraday::Response` zurückgegeben.
|
@@ -716,7 +1009,7 @@ puts task.body
|
|
716
1009
|
|
717
1010
|
#### erstelle eine Aufgabe
|
718
1011
|
|
719
|
-
|
1012
|
+
Siehe [Tasks#create](lib/papierkram_api/v1/endpoints/tracker/tasks.rb) für mögliche Parameter.
|
720
1013
|
|
721
1014
|
```ruby
|
722
1015
|
task = client.tracker_tasks.create(name: 'Aufgabe 1')
|
@@ -726,7 +1019,7 @@ puts task.body
|
|
726
1019
|
|
727
1020
|
#### aktualisiere eine Aufgabe
|
728
1021
|
|
729
|
-
|
1022
|
+
Siehe [Tasks#update_by](lib/papierkram_api/v1/endpoints/tracker/tasks.rb) für mögliche Parameter.
|
730
1023
|
|
731
1024
|
```ruby
|
732
1025
|
task = client.tracker_tasks.update_by(id: 1, name: 'Aufgabe 2' )
|
@@ -766,7 +1059,7 @@ Der Endpunkt `/papierkram_api/v1/tracker/time_entries` liefert Informationen üb
|
|
766
1059
|
|
767
1060
|
#### alle Zeiteinträge
|
768
1061
|
|
769
|
-
|
1062
|
+
Siehe [TimeEntries](lib/papierkram_api/v1/endpoints/tracker/time_entries.rb) für mögliche Parameter.
|
770
1063
|
|
771
1064
|
```ruby
|
772
1065
|
time_entries = client.tracker_time_entries.all
|
@@ -784,7 +1077,7 @@ puts time_entry.body
|
|
784
1077
|
|
785
1078
|
#### erstelle einen Zeiteintrag
|
786
1079
|
|
787
|
-
|
1080
|
+
Siehe [TimeEntries](lib/papierkram_api/v1/endpoints/tracker/time_entries.rb) für mögliche Parameter.
|
788
1081
|
|
789
1082
|
```ruby
|
790
1083
|
time_entry = client.tracker_time_entries.create(
|
@@ -799,7 +1092,7 @@ puts time_entry.body
|
|
799
1092
|
|
800
1093
|
#### aktualisiere einen Zeiteintrag
|
801
1094
|
|
802
|
-
|
1095
|
+
Siehe [TimeEntries](lib/papierkram_api/v1/endpoints/tracker/time_entries.rb) für mögliche Parameter.
|
803
1096
|
|
804
1097
|
```ruby
|
805
1098
|
time_entry = client.tracker_time_entries.update_by(
|
@@ -852,6 +1145,8 @@ quota = client.info.remaining_quota(response)
|
|
852
1145
|
|
853
1146
|
## Business Intelligence
|
854
1147
|
|
1148
|
+
> **DEPRECATED** Bitte verwende dieses Modul nicht mehr, es wird in Zukunft entfernt werden.
|
1149
|
+
|
855
1150
|
Ich lasse diesen ersten Ausflug in Auswertungen erstmal hier im Gem. Aber sollte ich die Zeit finden und weitere KPIs wichtig finden, dann gehören die Auswertungen eigentlich in ein eigenes Package.
|
856
1151
|
|
857
1152
|
TODO ergänzen wie man `SmartQueries` erstellt und verwendet.
|
@@ -860,6 +1155,8 @@ TODO ergänzen wie die Rückgabewerte von `SmartQueries` gestaltet werden sollte
|
|
860
1155
|
|
861
1156
|
### Business::Intelligence (BI) ExpenseByCategory (Ausgaben nach Kategorie)
|
862
1157
|
|
1158
|
+
> **DEPRECATED** Bitte verwende dieses Modul nicht mehr, es wird in Zukunft entfernt werden.
|
1159
|
+
|
863
1160
|
Der Endpunkt `/papierkram_api/v1/business_intelligence/expense_by_categories` liefert Informationen über die Ausgaben nach Kategorie. Die Informationen werden als `Hash` zurückgegeben.
|
864
1161
|
|
865
1162
|
#### alle Ausgaben eines Monats nach Kategorie
|
@@ -957,12 +1254,20 @@ puts pdf
|
|
957
1254
|
}
|
958
1255
|
```
|
959
1256
|
|
960
|
-
## Development
|
1257
|
+
## Development / Mitentwickeln
|
961
1258
|
|
962
1259
|
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.
|
963
1260
|
|
964
1261
|
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).
|
965
1262
|
|
1263
|
+
### Localhost 3000! 🤫
|
1264
|
+
|
1265
|
+
`DEBUG_LOCALHOST=true bin/console`
|
1266
|
+
|
1267
|
+
OR to make it stick:
|
1268
|
+
- Set `export DEBUG_LOCALHOST=true` in your `.env` or `.envrc` file.
|
1269
|
+
- Enjoy the magic: `bin/setup && bin/console` 🎉
|
1270
|
+
|
966
1271
|
## Contributing
|
967
1272
|
|
968
1273
|
Bug reports and pull requests are welcome on GitHub at https://github.com/simonneutert/papierkram_api_client.
|
@@ -23,8 +23,10 @@ module PapierkramApi
|
|
23
23
|
def build_client!
|
24
24
|
@client = Faraday.new(url: @base_url) do |config|
|
25
25
|
config.request :authorization, 'Bearer', @api_key
|
26
|
+
config.request :multipart
|
26
27
|
config.request :json
|
27
28
|
config.response :json
|
29
|
+
|
28
30
|
config.adapter :httpx
|
29
31
|
yield(config) if block_given?
|
30
32
|
end
|
@@ -103,6 +105,8 @@ module PapierkramApi
|
|
103
105
|
private
|
104
106
|
|
105
107
|
def base_url_env
|
108
|
+
return 'http://localhost:3000' if ENV.fetch('DEBUG_LOCALHOST', false).to_s == 'true'
|
109
|
+
|
106
110
|
"https://#{@subdomain}.papierkram.de"
|
107
111
|
end
|
108
112
|
end
|
@@ -15,6 +15,15 @@ module PapierkramApi
|
|
15
15
|
#
|
16
16
|
class Base
|
17
17
|
def expenses_by_category
|
18
|
+
warning = <<~MSG
|
19
|
+
[DEPRECATION] `expenses_by_category` is deprecated. #{' '}
|
20
|
+
It will be removed in a version after 0.4.0, most probably in 0.5.0.
|
21
|
+
|
22
|
+
[DEPRECATION] Support for RUBY 2.7 will be dropped#{' '}
|
23
|
+
in a version after 0.4.0, most probably in 0.5.0.
|
24
|
+
MSG
|
25
|
+
warn(warning)
|
26
|
+
|
18
27
|
@expenses_by_category ||= PapierkramApi::V1::BusinessIntelligence::ExpensesByCategory.new
|
19
28
|
end
|
20
29
|
end
|
@@ -6,6 +6,8 @@ module PapierkramApi
|
|
6
6
|
module Expense
|
7
7
|
# This class is responsible for all the API calls related to expense vouchers.
|
8
8
|
class Vouchers < PapierkramApi::V1::Endpoints::Base
|
9
|
+
ALLOWED_DIFFERENCE_REASONS = %w[sonstige mahnung teilzahlung skonto sonstige schmaelerung].freeze
|
10
|
+
|
9
11
|
def find_by(id:, pdf: false)
|
10
12
|
if pdf == true
|
11
13
|
return get("#{@url_api_path}/expense/vouchers/#{id}/pdf", nil,
|
@@ -38,6 +40,154 @@ module PapierkramApi
|
|
38
40
|
|
39
41
|
http_get("#{@url_api_path}/expense/vouchers", query)
|
40
42
|
end
|
43
|
+
|
44
|
+
def create( # rubocop:disable Metrics/ParameterLists,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
|
45
|
+
name:,
|
46
|
+
provenance:,
|
47
|
+
line_items:,
|
48
|
+
due_date: nil,
|
49
|
+
document_date: nil,
|
50
|
+
description: nil,
|
51
|
+
entertainment_reason: nil,
|
52
|
+
entertainment_persons: nil,
|
53
|
+
flagged: nil,
|
54
|
+
creditor_id: nil
|
55
|
+
)
|
56
|
+
body = {}
|
57
|
+
body[:name] = name
|
58
|
+
body[:line_items] = line_items
|
59
|
+
body[:provenance] = provenance
|
60
|
+
|
61
|
+
body[:due_date] = due_date if due_date
|
62
|
+
body[:document_date] = document_date if document_date
|
63
|
+
body[:description] = description if description
|
64
|
+
body[:entertainment_reason] = entertainment_reason if entertainment_reason
|
65
|
+
body[:entertainment_persons] = entertainment_persons if entertainment_persons
|
66
|
+
body[:flagged] = flagged if flagged
|
67
|
+
body[:creditor] = { id: creditor_id } if creditor_id
|
68
|
+
|
69
|
+
if entertainment_persons
|
70
|
+
raise ArgumentError, 'entertainment_persons must be an array' unless entertainment_persons.is_a?(Array)
|
71
|
+
|
72
|
+
unless entertainment_persons.all?(String)
|
73
|
+
raise ArgumentError,
|
74
|
+
'entertainment_persons must be an array of strings'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if line_items
|
79
|
+
raise ArgumentError, 'line_items must be an array' unless line_items.is_a?(Array)
|
80
|
+
raise ArgumentError, 'line_items must be an array of hashes' unless line_items.all?(Hash)
|
81
|
+
end
|
82
|
+
|
83
|
+
http_post("#{@url_api_path}/expense/vouchers", body)
|
84
|
+
end
|
85
|
+
|
86
|
+
def update_by( # rubocop:disable Metrics/ParameterLists,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
87
|
+
id:,
|
88
|
+
name: nil,
|
89
|
+
due_date: nil,
|
90
|
+
document_date: nil,
|
91
|
+
description: nil,
|
92
|
+
entertainment_reason: nil,
|
93
|
+
entertainment_persons: nil,
|
94
|
+
flagged: nil,
|
95
|
+
provenance: nil,
|
96
|
+
creditor_id: nil,
|
97
|
+
line_items: nil
|
98
|
+
)
|
99
|
+
body = {}
|
100
|
+
body[:name] = name if name
|
101
|
+
body[:due_date] = due_date if due_date
|
102
|
+
body[:document_date] = document_date if document_date
|
103
|
+
body[:description] = description if description
|
104
|
+
body[:entertainment_reason] = entertainment_reason if entertainment_reason
|
105
|
+
body[:entertainment_persons] = entertainment_persons if entertainment_persons
|
106
|
+
body[:flagged] = flagged if flagged
|
107
|
+
body[:provenance] = provenance if provenance
|
108
|
+
body[:creditor] = { id: creditor_id } if creditor_id
|
109
|
+
body[:line_items] = line_items if line_items
|
110
|
+
|
111
|
+
if line_items
|
112
|
+
raise ArgumentError, 'line_items must be an array' unless line_items.is_a?(Array)
|
113
|
+
raise ArgumentError, 'line_items must be an array of hashes' unless line_items.all?(Hash)
|
114
|
+
end
|
115
|
+
|
116
|
+
http_put("#{@url_api_path}/expense/vouchers/#{id}", body)
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_document_by(id:, path_to_file:, file_type:)
|
120
|
+
doc = Faraday::Multipart::FilePart.new(path_to_file, file_type)
|
121
|
+
|
122
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/documents", { file: doc })
|
123
|
+
end
|
124
|
+
|
125
|
+
def delete_document_by(id:, document_id:)
|
126
|
+
http_delete("#{@url_api_path}/expense/vouchers/#{id}/documents/#{document_id}")
|
127
|
+
end
|
128
|
+
|
129
|
+
def delete_by(id:)
|
130
|
+
http_delete("#{@url_api_path}/expense/vouchers/#{id}")
|
131
|
+
end
|
132
|
+
|
133
|
+
def archive_by(id:)
|
134
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/archive")
|
135
|
+
end
|
136
|
+
|
137
|
+
def unarchive_by(id:)
|
138
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/unarchive")
|
139
|
+
end
|
140
|
+
|
141
|
+
def cancel_by(id:)
|
142
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/cancel")
|
143
|
+
end
|
144
|
+
|
145
|
+
def cancel_with_reverse_entry_by(id:)
|
146
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/cancel_with_reverse_entry")
|
147
|
+
end
|
148
|
+
|
149
|
+
def mark_as_paid_by(
|
150
|
+
id:,
|
151
|
+
value: nil,
|
152
|
+
payment_date: nil,
|
153
|
+
banking_transaction_id: nil,
|
154
|
+
difference_reason: nil
|
155
|
+
)
|
156
|
+
unless value || banking_transaction_id
|
157
|
+
raise ArgumentError, 'either value or banking_transaction_id must be given'
|
158
|
+
end
|
159
|
+
|
160
|
+
body = {}
|
161
|
+
|
162
|
+
if value
|
163
|
+
validate_value!(value)
|
164
|
+
body[:value] = value
|
165
|
+
end
|
166
|
+
|
167
|
+
if difference_reason
|
168
|
+
validate_difference_reason!(difference_reason)
|
169
|
+
body[:difference_reason] = difference_reason
|
170
|
+
end
|
171
|
+
|
172
|
+
body[:payment_date] = payment_date if payment_date
|
173
|
+
body[:banking_transaction] = { id: banking_transaction_id } if banking_transaction_id
|
174
|
+
|
175
|
+
http_post("#{@url_api_path}/expense/vouchers/#{id}/pay", body)
|
176
|
+
end
|
177
|
+
|
178
|
+
private
|
179
|
+
|
180
|
+
def validate_value!(value)
|
181
|
+
raise ArgumentError, 'value must be a float' unless value.is_a?(Numeric)
|
182
|
+
end
|
183
|
+
|
184
|
+
def validate_difference_reason!(difference_reason)
|
185
|
+
raise ArgumentError, 'difference_reason must be a string' unless difference_reason.is_a?(String)
|
186
|
+
|
187
|
+
return if ALLOWED_DIFFERENCE_REASONS.include?(difference_reason)
|
188
|
+
|
189
|
+
raise ArgumentError, "difference_reason must be one of: #{ALLOWED_DIFFERENCE_REASONS.join(', ')}"
|
190
|
+
end
|
41
191
|
end
|
42
192
|
end
|
43
193
|
end
|
@@ -6,6 +6,8 @@ module PapierkramApi
|
|
6
6
|
module Income
|
7
7
|
# This class is responsible for all the API calls related to income invoices.
|
8
8
|
class Invoices < PapierkramApi::V1::Endpoints::Base
|
9
|
+
ALLOWED_SEND_VIA = %i[email pdf].freeze
|
10
|
+
|
9
11
|
def find_by(id:, pdf: false)
|
10
12
|
if pdf == true
|
11
13
|
return http_get(
|
@@ -18,14 +20,16 @@ module PapierkramApi
|
|
18
20
|
http_get("#{@url_api_path}/income/invoices/#{id}")
|
19
21
|
end
|
20
22
|
|
21
|
-
def all(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
def all( # rubocop:disable Metrics/CyclomaticComplexity
|
24
|
+
page: 1,
|
25
|
+
page_size: 100,
|
26
|
+
order_by: nil,
|
27
|
+
order_direction: nil,
|
28
|
+
creditor_id: nil,
|
29
|
+
project_id: nil,
|
30
|
+
document_date_range_start: nil,
|
31
|
+
document_date_range_end: nil
|
32
|
+
)
|
29
33
|
query = {
|
30
34
|
page: page,
|
31
35
|
page_size: page_size
|
@@ -42,6 +46,148 @@ module PapierkramApi
|
|
42
46
|
|
43
47
|
http_get("#{@url_api_path}/income/invoices", query)
|
44
48
|
end
|
49
|
+
|
50
|
+
def create( # rubocop:disable Metrics/ParameterLists,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
51
|
+
name:,
|
52
|
+
line_items:,
|
53
|
+
payment_term_id:,
|
54
|
+
description: nil,
|
55
|
+
flagged: nil,
|
56
|
+
document_date: nil,
|
57
|
+
supply_date: nil,
|
58
|
+
customer_id: nil,
|
59
|
+
contact_person_id: nil,
|
60
|
+
project_id: nil,
|
61
|
+
custom_template_id: nil,
|
62
|
+
billing_company: nil,
|
63
|
+
billing_department: nil,
|
64
|
+
billing_contact_person: nil,
|
65
|
+
billing_street: nil,
|
66
|
+
billing_zip: nil,
|
67
|
+
billing_city: nil,
|
68
|
+
billing_country: nil,
|
69
|
+
billing_ust_idnr: nil,
|
70
|
+
billing_email: nil
|
71
|
+
)
|
72
|
+
body = {}
|
73
|
+
body[:name] = name
|
74
|
+
body[:line_items] = line_items
|
75
|
+
body[:payment_term] = { id: payment_term_id }
|
76
|
+
body[:description] = description if description
|
77
|
+
body[:flagged] = flagged if flagged
|
78
|
+
body[:document_date] = document_date if document_date
|
79
|
+
body[:supply_date] = supply_date if supply_date
|
80
|
+
body[:customer] = { id: customer_id } if customer_id
|
81
|
+
body[:customer][:contact_person] = { id: contact_person_id } if contact_person_id
|
82
|
+
body[:customer][:project] = { id: project_id } if project_id
|
83
|
+
body[:custom_template] = { id: custom_template_id } if custom_template_id
|
84
|
+
|
85
|
+
body[:billing] = {}
|
86
|
+
body[:billing][:company] = billing_company if billing_company
|
87
|
+
body[:billing][:department] = billing_department if billing_department
|
88
|
+
body[:billing][:contact_person] = billing_contact_person if billing_contact_person
|
89
|
+
body[:billing][:street] = billing_street if billing_street
|
90
|
+
body[:billing][:zip] = billing_zip if billing_zip
|
91
|
+
body[:billing][:city] = billing_city if billing_city
|
92
|
+
body[:billing][:country] = billing_country if billing_country
|
93
|
+
body[:billing][:ust_idnr] = billing_ust_idnr if billing_ust_idnr
|
94
|
+
body[:billing][:email] = billing_email if billing_email
|
95
|
+
|
96
|
+
http_post("#{@url_api_path}/income/invoices", body)
|
97
|
+
end
|
98
|
+
|
99
|
+
def update_by( # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/ParameterLists
|
100
|
+
id:,
|
101
|
+
name: nil,
|
102
|
+
line_items: nil,
|
103
|
+
payment_term_id: nil,
|
104
|
+
description: nil,
|
105
|
+
flagged: nil,
|
106
|
+
document_date: nil,
|
107
|
+
supply_date: nil,
|
108
|
+
customer_id: nil,
|
109
|
+
contact_person_id: nil,
|
110
|
+
project_id: nil,
|
111
|
+
custom_template_id: nil,
|
112
|
+
billing_company: nil,
|
113
|
+
billing_department: nil,
|
114
|
+
billing_contact_person: nil,
|
115
|
+
billing_street: nil,
|
116
|
+
billing_zip: nil,
|
117
|
+
billing_city: nil,
|
118
|
+
billing_country: nil,
|
119
|
+
billing_ust_idnr: nil,
|
120
|
+
billing_email: nil
|
121
|
+
)
|
122
|
+
body = {}
|
123
|
+
body[:name] = name if name
|
124
|
+
body[:line_items] = line_items if line_items
|
125
|
+
body[:payment_term] = { id: payment_term_id } if payment_term_id
|
126
|
+
body[:description] = description if description
|
127
|
+
body[:flagged] = flagged if flagged
|
128
|
+
body[:document_date] = document_date if document_date
|
129
|
+
body[:supply_date] = supply_date if supply_date
|
130
|
+
body[:customer] = { id: customer_id } if customer_id
|
131
|
+
body[:customer][:contact_person] = { id: contact_person_id } if contact_person_id
|
132
|
+
body[:customer][:project] = { id: project_id } if project_id
|
133
|
+
body[:custom_template] = { id: custom_template_id } if custom_template_id
|
134
|
+
|
135
|
+
body[:billing] = {}
|
136
|
+
body[:billing][:company] = billing_company if billing_company
|
137
|
+
body[:billing][:department] = billing_department if billing_department
|
138
|
+
body[:billing][:contact_person] = billing_contact_person if billing_contact_person
|
139
|
+
body[:billing][:street] = billing_street if billing_street
|
140
|
+
body[:billing][:zip] = billing_zip if billing_zip
|
141
|
+
body[:billing][:city] = billing_city if billing_city
|
142
|
+
body[:billing][:country] = billing_country if billing_country
|
143
|
+
body[:billing][:ust_idnr] = billing_ust_idnr if billing_ust_idnr
|
144
|
+
body[:billing][:email] = billing_email if billing_email
|
145
|
+
|
146
|
+
http_put("#{@url_api_path}/income/invoices/#{id}", body)
|
147
|
+
end
|
148
|
+
|
149
|
+
def deliver_by( # rubocop:disable Metrics/AbcSize
|
150
|
+
id:,
|
151
|
+
email_recipient: nil,
|
152
|
+
email_subject: nil,
|
153
|
+
email_body: nil,
|
154
|
+
send_via: :pdf
|
155
|
+
)
|
156
|
+
|
157
|
+
raise ArgumentError, 'send_via must be :email or :pdf' unless ALLOWED_SEND_VIA.include?(send_via)
|
158
|
+
|
159
|
+
body = {}
|
160
|
+
body[:send_via] = send_via
|
161
|
+
|
162
|
+
if send_via == :email
|
163
|
+
if email_recipient.nil? || email_subject.nil? || email_body.nil?
|
164
|
+
raise ArgumentError, 'email_recipient, email_subject and email_body must be set'
|
165
|
+
end
|
166
|
+
|
167
|
+
body[:email] = {}
|
168
|
+
body[:email][:recipient] = email_recipient
|
169
|
+
body[:email][:subject] = email_subject
|
170
|
+
body[:email][:body] = email_body
|
171
|
+
end
|
172
|
+
|
173
|
+
http_post("#{@url_api_path}/income/invoices/#{id}/deliver", body)
|
174
|
+
end
|
175
|
+
|
176
|
+
def delete_by(id:)
|
177
|
+
http_delete("#{@url_api_path}/income/invoices/#{id}")
|
178
|
+
end
|
179
|
+
|
180
|
+
def archive_by(id:)
|
181
|
+
http_post("#{@url_api_path}/income/invoices/#{id}/archive")
|
182
|
+
end
|
183
|
+
|
184
|
+
def unarchive_by(id:)
|
185
|
+
http_post("#{@url_api_path}/income/invoices/#{id}/unarchive")
|
186
|
+
end
|
187
|
+
|
188
|
+
def cancel_by(id:)
|
189
|
+
http_post("#{@url_api_path}/income/invoices/#{id}/cancel")
|
190
|
+
end
|
45
191
|
end
|
46
192
|
end
|
47
193
|
end
|
@@ -27,11 +27,12 @@ module PapierkramApi
|
|
27
27
|
body = {}
|
28
28
|
body[:name] = name
|
29
29
|
body[:article_no] = article_no
|
30
|
+
|
31
|
+
body[:proposition_type] = proposition_type if proposition_type
|
30
32
|
body[:description] = description if description
|
31
33
|
body[:time_unit] = time_unit if time_unit
|
32
|
-
body[:proposition_type] = proposition_type if proposition_type
|
33
|
-
body[:price] = price if price
|
34
34
|
body[:vat_rate] = vat_rate if vat_rate
|
35
|
+
body[:price] = price if price
|
35
36
|
|
36
37
|
http_post("#{@url_api_path}/income/propositions", body)
|
37
38
|
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Neutert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-multipart
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.4
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: httpx
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +47,7 @@ dependencies:
|
|
33
47
|
version: 0.22.5
|
34
48
|
- - "<"
|
35
49
|
- !ruby/object:Gem::Version
|
36
|
-
version: 1.
|
50
|
+
version: 1.3.0
|
37
51
|
type: :runtime
|
38
52
|
prerelease: false
|
39
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +57,7 @@ dependencies:
|
|
43
57
|
version: 0.22.5
|
44
58
|
- - "<"
|
45
59
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.
|
60
|
+
version: 1.3.0
|
47
61
|
description: Papierkram API Client, um deine Buchhaltung auf das nächste Level zu
|
48
62
|
bringen.
|
49
63
|
email:
|