papierkram_api_client 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7efda340be625d91834f22276f4e95767a7d06621bb7d4e8ab6cbb7a503c40f0
4
- data.tar.gz: dad2650ea0bf6cc8339988ff4e5ab4265e26bad4c203398166d14296db415cdd
3
+ metadata.gz: a1a03790a5079d46fc57b6efa84682046fbfd4f4e916e68fd9e4132863dc07c3
4
+ data.tar.gz: b6edd7e886bcaf9a9f761fec07494c2f6e292f77b946e0fc2f2ee33b8228d60e
5
5
  SHA512:
6
- metadata.gz: '039f293aa1bcf2da3ba920cae9d63ff014a674764f76302f5f318cc89763df94518d69ddc61a105fcd0b13bff487e1a8196ead1a6e32f8e405f26cfb2a54096f'
7
- data.tar.gz: 41344eba19e9d4d76fca686ec05f8f0724fb38caeb0b08397e54ac2a0464fda1a58d3d7e7118a92c5d5eef7b4f5cf3d9dfd52fd7bbeaf0641f4844b983748eb4
6
+ metadata.gz: 299c6bcf0f35da94d1e1e6298f2aee5cc70b4eaddc3abe2e36fd051a3286290f9182f87331debc8c79f4ddca429f4fbb14aa4a95c0276fa857177165ab7ac36f
7
+ data.tar.gz: df625c5ce0e31b68b4ebcbd80e681d58674396843c43f5631544891b6e8eeeef1e788d19b38930e3cd4555755444b5e7430ebee7610df2550d22225d136df2b5
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  require:
2
2
  - rubocop-minitest
3
+ - rubocop-performance
4
+ - rubocop-rake
3
5
 
4
6
  AllCops:
5
7
  NewCops: enable
@@ -29,3 +31,10 @@ Metrics/ParameterLists:
29
31
  Max: 8
30
32
  Exclude:
31
33
  - "lib/api/v1/**/*"
34
+
35
+ Metrics/ClassLength:
36
+ CountAsOne:
37
+ - "array"
38
+ - "hash"
39
+ - "heredoc"
40
+ - "method_call"
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ [0.2.3] - 2023-06-29
4
+
5
+ ### Added
6
+
7
+ - [#47](https://github.com/simonneutert/papierkram_api_client/pull/47) Adds CRUD endpoint support for income propositions. [@simonneutert](https://github.com/simonneutert)
8
+ - [#46](https://github.com/simonneutert/papierkram_api_client/pull/46) Adds CRUD endpoint support for projects. [@simonneutert](https://github.com/simonneutert)
9
+ - [#45](https://github.com/simonneutert/papierkram_api_client/pull/45) Adds CRUD endpoint support for contact companies persons. [@simonneutert](https://github.com/simonneutert)
10
+
11
+ ## [0.2.2] - 2023-06-28
12
+
13
+ ### Fixed
14
+
15
+ - [#29](https://github.com/simonneutert/papierkram_api_client/pull/29) Fixing namespaces in tests. [@simonneutert](https://github.com/simonneutert)
16
+
17
+ ### Changed
18
+
19
+ - [#24](https://github.com/simonneutert/papierkram_api_client/pull/24) Changes logo to a red version one, to match the NodeJS sister project. [@simonneutert](https://github.com/simonneutert), [@rabocalypse](https://github.com/rabocalypse)
20
+
21
+ ### Added
22
+
23
+ - [#44](https://github.com/simonneutert/papierkram_api_client/pull/44) Adds CRUD endpoint support for contact companies. [@simonneutert](https://github.com/simonneutert)
24
+ - [#22](https://github.com/simonneutert/papierkram_api_client/pull/22) Factors out VcrSanitizer and adds some more Rubocop goodness. [@simonneutert](https://github.com/simonneutert)
25
+ - [#21](https://github.com/simonneutert/papierkram_api_client/pull/21) Adds more auto-sanitizing in VCR. [@simonneutert](https://github.com/simonneutert)
26
+
3
27
  ## [0.2.1] - 2023-04-21
4
28
 
5
29
  ### Added
data/Gemfile CHANGED
@@ -5,10 +5,12 @@ 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.0'
8
+ gem 'minitest', '~> 5.18'
9
9
  gem 'minitest-vcr', '~> 1.4'
10
10
  gem 'pry', '~> 0.14.2'
11
11
  gem 'rake', '~> 13.0'
12
- gem 'rubocop', '~> 1.50'
13
- gem 'rubocop-minitest', '~> 0.30.0'
14
- gem 'vcr', '~> 6.1'
12
+ gem 'rubocop', '~> 1.53', require: false
13
+ gem 'rubocop-minitest', '~> 0.31.0', require: false
14
+ gem 'rubocop-performance', '~> 1.18', require: false
15
+ gem 'rubocop-rake', '~> 0.6.0', require: false
16
+ gem 'vcr', '~> 6.2'
data/Gemfile.lock CHANGED
@@ -1,59 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- papierkram_api_client (0.2.1)
4
+ papierkram_api_client (0.2.3)
5
5
  faraday (~> 2.7)
6
- httpx (~> 0.22.5)
6
+ httpx (>= 0.22.5, < 0.25.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.2)
12
12
  coderay (1.1.3)
13
- faraday (2.7.4)
13
+ faraday (2.7.7)
14
14
  faraday-net_http (>= 2.0, < 3.1)
15
15
  ruby2_keywords (>= 0.0.4)
16
16
  faraday-net_http (3.0.2)
17
17
  http-2-next (0.5.1)
18
- httpx (0.22.5)
18
+ httpx (0.24.0)
19
19
  http-2-next (>= 0.4.1)
20
20
  json (2.6.3)
21
+ language_server-protocol (3.17.0.3)
21
22
  method_source (1.0.0)
22
23
  minispec-metadata (2.0.0)
23
24
  minitest
24
- minitest (5.18.0)
25
+ minitest (5.18.1)
25
26
  minitest-vcr (1.4.0)
26
27
  minispec-metadata (~> 2.0)
27
28
  minitest (>= 4.7.5)
28
29
  vcr (>= 2.9)
29
- parallel (1.22.1)
30
- parser (3.2.2.0)
30
+ parallel (1.23.0)
31
+ parser (3.2.2.3)
31
32
  ast (~> 2.4.1)
33
+ racc
32
34
  pry (0.14.2)
33
35
  coderay (~> 1.1)
34
36
  method_source (~> 1.0)
37
+ racc (1.7.1)
35
38
  rainbow (3.1.1)
36
39
  rake (13.0.6)
37
- regexp_parser (2.8.0)
40
+ regexp_parser (2.8.1)
38
41
  rexml (3.2.5)
39
- rubocop (1.50.2)
42
+ rubocop (1.53.1)
40
43
  json (~> 2.3)
44
+ language_server-protocol (>= 3.17.0)
41
45
  parallel (~> 1.10)
42
- parser (>= 3.2.0.0)
46
+ parser (>= 3.2.2.3)
43
47
  rainbow (>= 2.2.2, < 4.0)
44
48
  regexp_parser (>= 1.8, < 3.0)
45
49
  rexml (>= 3.2.5, < 4.0)
46
50
  rubocop-ast (>= 1.28.0, < 2.0)
47
51
  ruby-progressbar (~> 1.7)
48
52
  unicode-display_width (>= 2.4.0, < 3.0)
49
- rubocop-ast (1.28.0)
53
+ rubocop-ast (1.29.0)
50
54
  parser (>= 3.2.1.0)
51
- rubocop-minitest (0.30.0)
55
+ rubocop-minitest (0.31.0)
52
56
  rubocop (>= 1.39, < 2.0)
57
+ rubocop-performance (1.18.0)
58
+ rubocop (>= 1.7.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
60
+ rubocop-rake (0.6.0)
61
+ rubocop (~> 1.0)
53
62
  ruby-progressbar (1.13.0)
54
63
  ruby2_keywords (0.0.5)
55
64
  unicode-display_width (2.4.2)
56
- vcr (6.1.0)
65
+ vcr (6.2.0)
57
66
 
58
67
  PLATFORMS
59
68
  arm64-darwin-22
@@ -61,14 +70,16 @@ PLATFORMS
61
70
  x86_64-linux
62
71
 
63
72
  DEPENDENCIES
64
- minitest (~> 5.0)
73
+ minitest (~> 5.18)
65
74
  minitest-vcr (~> 1.4)
66
75
  papierkram_api_client!
67
76
  pry (~> 0.14.2)
68
77
  rake (~> 13.0)
69
- rubocop (~> 1.50)
70
- rubocop-minitest (~> 0.30.0)
71
- vcr (~> 6.1)
78
+ rubocop (~> 1.53)
79
+ rubocop-minitest (~> 0.31.0)
80
+ rubocop-performance (~> 1.18)
81
+ rubocop-rake (~> 0.6.0)
82
+ vcr (~> 6.2)
72
83
 
73
84
  BUNDLED WITH
74
- 2.4.8
85
+ 2.4.12
data/README.md CHANGED
@@ -2,15 +2,15 @@
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)!
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) in dein Projekt!
6
6
 
7
- ### Hol mehr aus deinen Daten raus! Dieser Client bietet dir bald einige Features im Bereich [Business Intelligence](#business-intelligence)!<!-- omit in toc -->
7
+ <div align="center">
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">
9
+ </div>
8
10
 
9
11
  ---
10
12
 
11
- <img src="pac.svg" alt="PAC Logo, Zunge leckt an Karl Klammer und zieht Daten aus dem Papierkram-Account wie Frosch die Fliege vom Teich" width="300">
12
-
13
- Hol dir den [Papierkram API Client](https://rubygems.org/gems/papierkram_api_client) als [Ruby Gem](https://rubygems.org/gems/papierkram_api_client)!
13
+ Hol mehr aus deinen Daten raus! Dieser Client bietet dir bald einige Features im Bereich [Business Intelligence](#business-intelligence)!
14
14
 
15
15
  ---
16
16
 
@@ -31,9 +31,8 @@ Schau bitte dort um alle Rückgabefelder/-werte zu checken, bis ich die Dokument
31
31
 
32
32
  ---
33
33
 
34
- Ruby client für die Papierkram API (V1).
34
+ ## Aktuell unterstützte Endpunkte der Papierkram API (V1)<!-- omit in toc -->
35
35
 
36
- Aktuell unterstützte Endpunkte / Objekte:
37
36
 
38
37
  - [x] Banking::BankConnection
39
38
  - [x] Banking::BankTransaction
@@ -50,11 +49,10 @@ Aktuell unterstützte Endpunkte / Objekte:
50
49
 
51
50
  ## Was, wie, warum?<!-- omit in toc -->
52
51
 
53
- Papierkram.de hat nun endlich eine API Schnittstelle für die Programmierung von eigenen Anwendungen. Die Dokumentation findest du hier: [https://DEINE-SUBDOMAIN.papierkram.de/papierkram_api/v1/api-docs/index.html](https://DEINE-SUBDOMAIN.papierkram.de/papierkram_api/v1/api-docs/index.html). Dieses Projekt soll eine einfache Schnittstelle für die Papierkram API bereitstellen.
52
+ Papierkram.de hat nun eine API Schnittstelle für die Programmierung von eigenen Anwendungen. Die Dokumentation dazu findest du [hier](https://demo.papierkram.de/papierkram_api/v1/api-docs/index.html).
54
53
 
55
54
  Ziele:
56
55
 
57
- - Eine einfache als Gem verfügbare Schnittstelle für die Papierkram API.
58
56
  - Rückgabe von Hashes, Arrays, etc. statt von komplexeren Objekten (der gefürchtete DIY-Ansatz).
59
57
  - Einfach zu testen und zu erweitern.
60
58
 
@@ -71,9 +69,17 @@ Ziele:
71
69
  - [Contact::Company (Unternehmen)](#contactcompany-unternehmen)
72
70
  - [alle Unternehmen](#alle-unternehmen)
73
71
  - [ein Unternehmen](#ein-unternehmen)
72
+ - [erstelle ein Unternehmen](#erstelle-ein-unternehmen)
73
+ - [aktualisiere ein Unternehmen](#aktualisiere-ein-unternehmen)
74
+ - [lösche ein Unternehmen](#lösche-ein-unternehmen)
75
+ - [archiviere ein Unternehmen](#archiviere-ein-unternehmen)
76
+ - [unarchiviere ein Unternehmen](#unarchiviere-ein-unternehmen)
74
77
  - [Contact::Company (Kontaktperson eines Unternehmens)](#contactcompany-kontaktperson-eines-unternehmens)
75
78
  - [alle Kontaktpersonen (eines Unternehmens)](#alle-kontaktpersonen-eines-unternehmens)
76
79
  - [eine Kontaktperson (eines Unternehmens)](#eine-kontaktperson-eines-unternehmens)
80
+ - [erstelle eine Kontaktperson (eines Unternehmens)](#erstelle-eine-kontaktperson-eines-unternehmens)
81
+ - [aktualisiere eine Kontaktperson (eines Unternehmens)](#aktualisiere-eine-kontaktperson-eines-unternehmens)
82
+ - [lösche eine Kontaktperson (eines Unternehmens)](#lösche-eine-kontaktperson-eines-unternehmens)
77
83
  - [Expense::Voucher (Ausgabe Beleg)](#expensevoucher-ausgabe-beleg)
78
84
  - [alle Ausgabe Belege](#alle-ausgabe-belege)
79
85
  - [einen Ausgabe Beleg](#einen-ausgabe-beleg)
@@ -89,10 +95,20 @@ Ziele:
89
95
  - [Income::Proposition (Waren / Dienstleistungen)](#incomeproposition-waren--dienstleistungen)
90
96
  - [alle Waren / Dienstleistungen](#alle-waren--dienstleistungen)
91
97
  - [eine Ware / Dienstleistung](#eine-ware--dienstleistung)
98
+ - [eine Ware / Dienstleistung erstellen](#eine-ware--dienstleistung-erstellen)
99
+ - [eine Ware / Dienstleistung aktualisieren](#eine-ware--dienstleistung-aktualisieren)
100
+ - [eine Ware / Dienstleistung löschen](#eine-ware--dienstleistung-löschen)
101
+ - [eine Ware / Dienstleistung archivieren](#eine-ware--dienstleistung-archivieren)
102
+ - [eine Ware / Dienstleistung unarchivieren](#eine-ware--dienstleistung-unarchivieren)
92
103
  - [Info](#info)
93
104
  - [Project::Project (Projekt)](#projectproject-projekt)
94
105
  - [alle Projekte](#alle-projekte)
95
106
  - [ein Projekt](#ein-projekt)
107
+ - [erstelle ein Projekt](#erstelle-ein-projekt)
108
+ - [aktualisiere ein Projekt](#aktualisiere-ein-projekt)
109
+ - [lösche ein Projekt](#lösche-ein-projekt)
110
+ - [archiviere ein Projekt](#archiviere-ein-projekt)
111
+ - [unarchiviere ein Projekt](#unarchiviere-ein-projekt)
96
112
  - [Tracker::Task (Aufgabe)](#trackertask-aufgabe)
97
113
  - [alle Aufgaben](#alle-aufgaben)
98
114
  - [eine Aufgabe](#eine-aufgabe)
@@ -260,7 +276,7 @@ Siehe [Companies](lib/papierkram_api/v1/endpoints/contact/companies.rb) für mö
260
276
  #### alle Unternehmen
261
277
 
262
278
  ```ruby
263
- companies = client.contact.companies.all
279
+ companies = client.contact_companies.all
264
280
  puts companies.headers
265
281
  puts companies.body
266
282
  ```
@@ -268,7 +284,56 @@ puts companies.body
268
284
  #### ein Unternehmen
269
285
 
270
286
  ```ruby
271
- company = client.contact.companies.by(id: 1)
287
+ company = client.contact_companies.by(id: 1)
288
+ puts company.headers
289
+ puts company.body
290
+ ```
291
+
292
+ #### erstelle ein Unternehmen
293
+
294
+ ```ruby
295
+ # supplier
296
+ company = client.contact_companies.create_supplier(name: 'Test GmbH')
297
+ puts company.headers
298
+ puts company.body
299
+
300
+ # customer
301
+ company = client.contact_companies.create_customer(name: 'Test GmbH')
302
+ puts company.headers
303
+ puts company.body
304
+ ```
305
+
306
+ Siehe [Companies#create_customer](lib/papierkram_api/v1/endpoints/contact/companies.rb) und [Companies#create_supplier](lib/papierkram_api/v1/endpoints/contact/companies.rb) für mögliche Parameter.
307
+
308
+ #### aktualisiere ein Unternehmen
309
+
310
+ ```ruby
311
+ company = client.contact_companies
312
+ .update_by(id: 1, attributes: { name: 'Test GmbH' })
313
+ puts company.headers
314
+ puts company.body
315
+ ```
316
+
317
+ #### lösche ein Unternehmen
318
+
319
+ ```ruby
320
+ company = client.contact_companies.delete_by(id: 1)
321
+ puts company.headers
322
+ puts company.body
323
+ ```
324
+
325
+ #### archiviere ein Unternehmen
326
+
327
+ ```ruby
328
+ company = client.contact_companies.archive_by(id: 1)
329
+ puts company.headers
330
+ puts company.body
331
+ ```
332
+
333
+ #### unarchiviere ein Unternehmen
334
+
335
+ ```ruby
336
+ company = client.contact_companies.unarchive_by(id: 1)
272
337
  puts company.headers
273
338
  puts company.body
274
339
  ```
@@ -295,6 +360,41 @@ puts company.headers
295
360
  puts company.body
296
361
  ```
297
362
 
363
+ #### erstelle eine Kontaktperson (eines Unternehmens)
364
+
365
+ ```ruby
366
+ company = client.contact_companies_persons.create(
367
+ company_id: 1,
368
+ attributes: {
369
+ first_name: 'Max',
370
+ last_name: 'Mustermann'
371
+ }
372
+ )
373
+ puts company.headers
374
+ puts company.body
375
+ ```
376
+
377
+ Siehe [CompaniesPersons#create](lib/papierkram_api/v1/endpoints/contact/companies_persons.rb) für mögliche Parameter.
378
+
379
+ #### aktualisiere eine Kontaktperson (eines Unternehmens)
380
+
381
+ ```ruby
382
+ company = client.contact_companies_persons
383
+ .update_by(company_id: 1, id: 1, attributes: { first_name: 'Moritz' })
384
+ puts company.headers
385
+ puts company.body
386
+ ```
387
+
388
+ Siehe [CompaniesPersons#update_by](lib/papierkram_api/v1/endpoints/contact/companies_persons.rb) für mögliche Parameter.
389
+
390
+ #### lösche eine Kontaktperson (eines Unternehmens)
391
+
392
+ ```ruby
393
+ company = client.contact_companies_persons.delete_by(company_id: 1, id: 1)
394
+ puts company.headers
395
+ puts company.body
396
+ ```
397
+
298
398
  ### Expense::Voucher (Ausgabe Beleg)
299
399
 
300
400
  Der Endpunkt `/papierkram_api/v1/endpoints/expense/vouchers` liefert Informationen über die Ausgabe Belege. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -407,6 +507,56 @@ puts proposition.headers
407
507
  puts proposition.body
408
508
  ```
409
509
 
510
+ #### eine Ware / Dienstleistung erstellen
511
+
512
+ ```ruby
513
+ proposition = client.income_propositions.create(
514
+ name: 'Software design',
515
+ article_no: '12345',
516
+ description: 'Here, we can describe what "Software design" actually entails.',
517
+ time_unit: 'hour',
518
+ proposition_type: 'service',
519
+ price: '150.0',
520
+ vat_rate: '19%'
521
+ )
522
+ puts proposition.headers
523
+ puts proposition.body
524
+ ```
525
+
526
+ Siehe [Propositions#create](lib/papierkram_api/v1/endpoints/income/propositions.rb) für mögliche Parameter.
527
+
528
+ #### eine Ware / Dienstleistung aktualisieren
529
+
530
+ ```ruby
531
+ client.income_propositions.update_by(
532
+ id: 1,
533
+ attributes: {
534
+ name: 'Software design',
535
+ vat_rate: '19%' # verpflichtend bei Änderung
536
+ }
537
+ )
538
+ ```
539
+
540
+ Siehe [Propositions#update_by](lib/papierkram_api/v1/endpoints/income/propositions.rb) für mögliche Parameter.
541
+
542
+ #### eine Ware / Dienstleistung löschen
543
+
544
+ ```ruby
545
+ client.income_propositions.delete_by(id: 1)
546
+ ```
547
+
548
+ #### eine Ware / Dienstleistung archivieren
549
+
550
+ ```ruby
551
+ client.income_propositions.archive_by(id: 1)
552
+ ```
553
+
554
+ #### eine Ware / Dienstleistung unarchivieren
555
+
556
+ ```ruby
557
+ client.income_propositions.unarchive_by(id: 1)
558
+ ```
559
+
410
560
  ### Info
411
561
 
412
562
  Der Endpunkt `lib/papierkram_api/v1/endpoints/info.rb` liefert Informationen über die API. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -441,6 +591,50 @@ puts project.headers
441
591
  puts project.body
442
592
  ```
443
593
 
594
+ #### erstelle ein Projekt
595
+
596
+ ```ruby
597
+ project = client.projects.create(name: 'Projekt 1')
598
+ puts project.headers
599
+ puts project.body
600
+ ```
601
+
602
+ Siehe [Projects](lib/papierkram_api/v1/endpoints/projects.rb) für mögliche Parameter.
603
+
604
+ #### aktualisiere ein Projekt
605
+
606
+ ```ruby
607
+ project = client.projects.update_by(id: 1, attributes: { name: 'Projekt 2' })
608
+ puts project.headers
609
+ puts project.body
610
+ ```
611
+
612
+ Siehe [Projects](lib/papierkram_api/v1/endpoints/projects.rb) für mögliche Parameter.
613
+
614
+ #### lösche ein Projekt
615
+
616
+ ```ruby
617
+ project = client.projects.delete_by(id: 1)
618
+ puts project.headers
619
+ puts project.body
620
+ ```
621
+
622
+ #### archiviere ein Projekt
623
+
624
+ ```ruby
625
+ project = client.projects.archive_by(id: 1)
626
+ puts project.headers
627
+ puts project.body
628
+ ```
629
+
630
+ #### unarchiviere ein Projekt
631
+
632
+ ```ruby
633
+ project = client.projects.unarchive_by(id: 1)
634
+ puts project.headers
635
+ puts project.body
636
+ ```
637
+
444
638
  ### Tracker::Task (Aufgabe)
445
639
 
446
640
  Der Endpunkt `/papierkram_api/v1/tracker/tasks` liefert Informationen über die Aufgaben. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -31,55 +31,68 @@ module PapierkramApi
31
31
  end
32
32
 
33
33
  def business_intelligence
34
- @business_intelligence ||= PapierkramApi::V1::BusinessIntelligence::Base.new
34
+ @business_intelligence ||=
35
+ PapierkramApi::V1::BusinessIntelligence::Base.new
35
36
  end
36
37
 
37
38
  def banking_bank_connections
38
- @banking_bank_connections ||= PapierkramApi::V1::Endpoints::Banking::BankConnections.new(@client)
39
+ @banking_bank_connections ||=
40
+ PapierkramApi::V1::Endpoints::Banking::BankConnections.new(@client)
39
41
  end
40
42
 
41
43
  def banking_transactions
42
- @banking_transactions ||= PapierkramApi::V1::Endpoints::Banking::Transactions.new(@client)
44
+ @banking_transactions ||=
45
+ PapierkramApi::V1::Endpoints::Banking::Transactions.new(@client)
43
46
  end
44
47
 
45
48
  def contact_companies
46
- @contact_companies ||= PapierkramApi::V1::Endpoints::Contact::Companies.new(@client)
49
+ @contact_companies ||=
50
+ PapierkramApi::V1::Endpoints::Contact::Companies.new(@client)
47
51
  end
48
52
 
49
53
  def contact_companies_persons
50
- @contact_companies_persons ||= PapierkramApi::V1::Endpoints::Contact::CompaniesPersons.new(@client)
54
+ @contact_companies_persons ||=
55
+ PapierkramApi::V1::Endpoints::Contact::CompaniesPersons.new(@client)
51
56
  end
52
57
 
53
58
  def expense_vouchers
54
- @expense_vouchers ||= PapierkramApi::V1::Endpoints::Expense::Vouchers.new(@client)
59
+ @expense_vouchers ||=
60
+ PapierkramApi::V1::Endpoints::Expense::Vouchers.new(@client)
55
61
  end
56
62
 
57
63
  def income_estimates
58
- @income_estimates ||= PapierkramApi::V1::Endpoints::Income::Estimates.new(@client)
64
+ @income_estimates ||=
65
+ PapierkramApi::V1::Endpoints::Income::Estimates.new(@client)
59
66
  end
60
67
 
61
68
  def income_invoices
62
- @income_invoices ||= PapierkramApi::V1::Endpoints::Income::Invoices.new(@client)
69
+ @income_invoices ||=
70
+ PapierkramApi::V1::Endpoints::Income::Invoices.new(@client)
63
71
  end
64
72
 
65
73
  def income_propositions
66
- @income_propositions ||= PapierkramApi::V1::Endpoints::Income::Propositions.new(@client)
74
+ @income_propositions ||=
75
+ PapierkramApi::V1::Endpoints::Income::Propositions.new(@client)
67
76
  end
68
77
 
69
78
  def info
70
- @info ||= PapierkramApi::V1::Endpoints::Info.new(@client)
79
+ @info ||=
80
+ PapierkramApi::V1::Endpoints::Info.new(@client)
71
81
  end
72
82
 
73
83
  def projects
74
- @projects ||= PapierkramApi::V1::Endpoints::Projects.new(@client)
84
+ @projects ||=
85
+ PapierkramApi::V1::Endpoints::Projects.new(@client)
75
86
  end
76
87
 
77
88
  def tracker_tasks
78
- @tracker_tasks ||= PapierkramApi::V1::Endpoints::Tracker::Tasks.new(@client)
89
+ @tracker_tasks ||=
90
+ PapierkramApi::V1::Endpoints::Tracker::Tasks.new(@client)
79
91
  end
80
92
 
81
93
  def tracker_time_entries
82
- @tracker_time_entries ||= PapierkramApi::V1::Endpoints::Tracker::TimeEntries.new(@client)
94
+ @tracker_time_entries ||=
95
+ PapierkramApi::V1::Endpoints::Tracker::TimeEntries.new(@client)
83
96
  end
84
97
 
85
98
  private
@@ -18,11 +18,9 @@ module PapierkramApi
18
18
  return {} if expense_vouchers.is_a?(Array) && expense_vouchers.empty?
19
19
 
20
20
  validate_expense_vouchers!(expense_vouchers)
21
- if block_given?
22
- results(expense_vouchers, &block)
23
- else
24
- results(expense_vouchers)
25
- end
21
+ return results(expense_vouchers, &block) if block
22
+
23
+ results(expense_vouchers)
26
24
  end
27
25
 
28
26
  private
@@ -23,6 +23,143 @@ module PapierkramApi
23
23
 
24
24
  get("#{@url_api_path}/contact/companies", query)
25
25
  end
26
+
27
+ def create_supplier( # rubocop:disable Metrics/ParameterLists
28
+ name:,
29
+ phone: nil,
30
+ fax: nil,
31
+ email: nil,
32
+ delivery_method: nil,
33
+ ust_idnr: nil,
34
+ website: nil,
35
+ twitter: nil,
36
+ postal_street: nil,
37
+ postal_city: nil,
38
+ postal_zip: nil,
39
+ postal_country: nil,
40
+ physical_street: nil,
41
+ physical_city: nil,
42
+ physical_zip: nil,
43
+ physical_country: nil,
44
+ bank_blz: nil,
45
+ bank_institute: nil,
46
+ bank_account_no: nil,
47
+ bank_bic: nil,
48
+ bank_iban: nil,
49
+ notes: nil,
50
+ color: nil
51
+ )
52
+
53
+ body = {
54
+ contact_type: :supplier,
55
+ name: name,
56
+ phone: phone,
57
+ fax: fax,
58
+ email: email,
59
+ delivery_method: delivery_method,
60
+ ust_idnr: ust_idnr,
61
+ website: website,
62
+ twitter: twitter,
63
+ postal_street: postal_street,
64
+ postal_city: postal_city,
65
+ postal_zip: postal_zip,
66
+ postal_country: postal_country,
67
+ physical_street: physical_street,
68
+ physical_city: physical_city,
69
+ physical_zip: physical_zip,
70
+ physical_country: physical_country,
71
+ bank_blz: bank_blz,
72
+ bank_institute: bank_institute,
73
+ bank_account_no: bank_account_no,
74
+ bank_bic: bank_bic,
75
+ bank_iban: bank_iban,
76
+ notes: notes,
77
+ color: color
78
+ }
79
+
80
+ post("#{@url_api_path}/contact/companies", body)
81
+ end
82
+
83
+ def create_customer( # rubocop:disable Metrics/ParameterLists
84
+ name:,
85
+ phone: nil,
86
+ fax: nil,
87
+ email: nil,
88
+ delivery_method: nil,
89
+ ust_idnr: nil,
90
+ website: nil,
91
+ twitter: nil,
92
+ postal_street: nil,
93
+ postal_city: nil,
94
+ postal_zip: nil,
95
+ postal_country: nil,
96
+ physical_street: nil,
97
+ physical_city: nil,
98
+ physical_zip: nil,
99
+ physical_country: nil,
100
+ bank_blz: nil,
101
+ bank_institute: nil,
102
+ bank_account_no: nil,
103
+ bank_bic: nil,
104
+ bank_iban: nil,
105
+ notes: nil,
106
+ color: nil
107
+ )
108
+
109
+ body = {
110
+ contact_type: :customer,
111
+ name: name,
112
+ phone: phone,
113
+ fax: fax,
114
+ email: email,
115
+ delivery_method: delivery_method,
116
+ ust_idnr: ust_idnr,
117
+ website: website,
118
+ twitter: twitter,
119
+ postal_street: postal_street,
120
+ postal_city: postal_city,
121
+ postal_zip: postal_zip,
122
+ postal_country: postal_country,
123
+ physical_street: physical_street,
124
+ physical_city: physical_city,
125
+ physical_zip: physical_zip,
126
+ physical_country: physical_country,
127
+ bank_blz: bank_blz,
128
+ bank_institute: bank_institute,
129
+ bank_account_no: bank_account_no,
130
+ bank_bic: bank_bic,
131
+ bank_iban: bank_iban,
132
+ notes: notes,
133
+ color: color
134
+ }
135
+
136
+ post("#{@url_api_path}/contact/companies", body)
137
+ end
138
+
139
+ def update_by(id:, attributes: {})
140
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
141
+ raise ArgumentError, 'attributes must be a Hash' unless attributes.is_a?(Hash)
142
+
143
+ put("#{@url_api_path}/contact/companies/#{id}", attributes)
144
+ end
145
+
146
+ def delete_by(id:)
147
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
148
+
149
+ delete("#{@url_api_path}/contact/companies/#{id}")
150
+ end
151
+
152
+ def archive_by(id:)
153
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
154
+
155
+ post("#{@url_api_path}/contact/companies/#{id}/archive")
156
+ end
157
+
158
+ def unarchive_by(id:)
159
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
160
+
161
+ post("#{@url_api_path}/contact/companies/#{id}/unarchive")
162
+ end
26
163
  end
27
164
  end
28
165
  end
@@ -21,6 +21,54 @@ module PapierkramApi
21
21
 
22
22
  get("#{@url_api_path}/contact/companies/#{company_id}/persons", query)
23
23
  end
24
+
25
+ def create( # rubocop:disable Metrics/ParameterLists
26
+ company_id:,
27
+ first_name:,
28
+ last_name:,
29
+ title: nil,
30
+ salutation: nil,
31
+ position: nil,
32
+ department: nil,
33
+ email: nil,
34
+ phone: nil,
35
+ mobile: nil,
36
+ fax: nil,
37
+ skype: nil,
38
+ comment: nil
39
+ )
40
+ body = {
41
+ first_name: first_name,
42
+ last_name: last_name,
43
+ title: title,
44
+ salutation: salutation,
45
+ position: position,
46
+ department: department,
47
+ email: email,
48
+ phone: phone,
49
+ mobile: mobile,
50
+ fax: fax,
51
+ skype: skype,
52
+ comment: comment
53
+ }
54
+
55
+ post("#{@url_api_path}/contact/companies/#{company_id}/persons", body)
56
+ end
57
+
58
+ def update_by(company_id:, id:, attributes: {})
59
+ raise ArgumentError, 'attributes must be a Hash' unless attributes.is_a?(Hash)
60
+ raise ArgumentError, 'company_id must be an Integer' unless company_id.is_a?(Integer)
61
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
62
+
63
+ put("#{@url_api_path}/contact/companies/#{company_id}/persons/#{id}", attributes)
64
+ end
65
+
66
+ def delete_by(company_id:, id:)
67
+ raise ArgumentError, 'company_id must be an Integer' unless company_id.is_a?(Integer)
68
+ raise ArgumentError, 'id must be an Integer' unless id.is_a?(Integer)
69
+
70
+ delete("#{@url_api_path}/contact/companies/#{company_id}/persons/#{id}")
71
+ end
24
72
  end
25
73
  end
26
74
  end
@@ -13,6 +13,49 @@ module PapierkramApi
13
13
  def all
14
14
  get("#{@url_api_path}/income/propositions")
15
15
  end
16
+
17
+ def create(
18
+ name:,
19
+ article_no:,
20
+ description: nil,
21
+ time_unit: nil,
22
+ proposition_type: nil,
23
+ price: nil,
24
+ vat_rate: ''
25
+ )
26
+ body = {
27
+ name: name,
28
+ article_no: article_no,
29
+ description: description,
30
+ time_unit: time_unit,
31
+ proposition_type: proposition_type,
32
+ price: price,
33
+ vat_rate: vat_rate
34
+ }
35
+ post("#{@url_api_path}/income/propositions", body)
36
+ end
37
+
38
+ def update_by(id:, attributes: {})
39
+ attributes[:vat_rate] ||= attributes['vat_rate']
40
+ attributes[:vat_rate] ||= ''
41
+ if attributes[:vat_rate].empty? || !attributes[:vat_rate].include?('%')
42
+ raise ArgumentError, 'vat_rate must be a percentage and include a % sign'
43
+ end
44
+
45
+ put("#{@url_api_path}/income/propositions/#{id}", attributes)
46
+ end
47
+
48
+ def delete_by(id:)
49
+ delete("#{@url_api_path}/income/propositions/#{id}")
50
+ end
51
+
52
+ def archive_by(id:)
53
+ post("#{@url_api_path}/income/propositions/#{id}/archive")
54
+ end
55
+
56
+ def unarchive_by(id:)
57
+ post("#{@url_api_path}/income/propositions/#{id}/unarchive")
58
+ end
16
59
  end
17
60
  end
18
61
  end
@@ -20,6 +20,58 @@ module PapierkramApi
20
20
 
21
21
  get("#{@url_api_path}/projects", query)
22
22
  end
23
+
24
+ def create( # rubocop:disable Metrics/ParameterLists
25
+ name:,
26
+ customer_id:,
27
+ description: nil,
28
+ start_date: nil,
29
+ end_date: nil,
30
+ flagged: nil,
31
+ budget_type: nil,
32
+ budget_money: nil,
33
+ budget_time: nil,
34
+ budget_time_unit: nil,
35
+ color: nil,
36
+ default_proposition: {},
37
+ team_members: []
38
+ )
39
+ body = {
40
+ name: name,
41
+ description: description,
42
+ start_date: start_date,
43
+ end_date: end_date,
44
+ flagged: flagged,
45
+ budget_type: budget_type,
46
+ budget_money: budget_money,
47
+ budget_time: budget_time,
48
+ budget_time_unit: budget_time_unit,
49
+ color: color,
50
+ customer: { id: customer_id },
51
+ default_proposition: default_proposition,
52
+ team_members: team_members
53
+ }
54
+
55
+ post("#{@url_api_path}/projects", body)
56
+ end
57
+
58
+ def update_by(id:, attributes: {})
59
+ raise ArgumentError, 'attributes must be a Hash' unless attributes.is_a?(Hash)
60
+
61
+ put("#{@url_api_path}/projects/#{id}", attributes)
62
+ end
63
+
64
+ def delete_by(id:)
65
+ delete("#{@url_api_path}/projects/#{id}")
66
+ end
67
+
68
+ def archive_by(id:)
69
+ post("#{@url_api_path}/projects/#{id}/archive")
70
+ end
71
+
72
+ def unarchive_by(id:)
73
+ post("#{@url_api_path}/projects/#{id}/unarchive")
74
+ end
23
75
  end
24
76
  end
25
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PapierkramApiClient
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.3'
5
5
  end
data/logo.svg ADDED
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 1798 623" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <path d="M172,70.1L172,15.1L13.4,15.1L13.4,610.9L172,610.9L172,363C191.2,399.4 229.1,423 282.7,423C375.5,423 449.1,346.6 449.1,216.6C449.1,86.6 375.5,10.1 282.7,10.1C229.1,10.1 191.2,33.7 172,70.1ZM288.4,216.6C288.4,260.9 262.7,284.4 229.8,284.4C197,284.4 171.2,260.9 171.2,216.6C171.2,172.3 197,148.7 229.8,148.7C262.7,148.7 288.4,172.3 288.4,216.6Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
5
+ <path d="M267,276C245.9,276 228.9,258.9 228.9,237.9C228.9,216.8 245.9,199.8 267,199.8C288.1,199.8 305.1,216.8 305.1,237.9C305.1,258.9 288.1,276 267,276Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
6
+ <path d="M474.9,217.6C474.9,347.6 548.5,424 641.4,424C694.9,424 733.5,400.4 752.8,364L752.8,419L910.7,419L910.7,16.1L752.8,16.1L752.8,71.1C733.5,34.7 694.9,11.1 641.4,11.1C548.5,11.1 474.9,87.6 474.9,217.6ZM752.8,217.6C752.8,261.9 727.1,285.4 694.2,285.4C661.4,285.4 635.6,261.9 635.6,217.6C635.6,173.3 661.4,149.7 694.2,149.7C727.1,149.7 752.8,173.3 752.8,217.6Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
7
+ <path d="M734,275.8C713,275.8 695.9,258.8 695.9,237.7C695.9,216.6 713,199.6 734,199.6C755.1,199.6 772.1,216.6 772.1,237.7C772.1,258.8 755.1,275.8 734,275.8Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
8
+ <path d="M977.7,267.6L974,252.8C974,252.8 1501.5,168.6 1656.8,178.1C1744.4,183.4 1741.7,220.8 1683.5,215C1558.8,202.7 977.7,267.6 977.7,267.6Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
9
+ <path d="M935.2,217.6C935.2,346.1 1020.2,424 1140.9,424C1244.5,424 1322.4,362.6 1341.6,256.8L1173.8,256.8C1168.1,276.1 1157.4,288.3 1137.4,288.3C1113.1,288.3 1095.9,266.1 1095.9,217.6C1095.9,169 1113.1,146.8 1137.4,146.8C1157.4,146.8 1168.1,159 1173.8,178.3L1341.6,178.3C1322.4,72.6 1244.5,11.1 1140.9,11.1C1020.2,11.1 935.2,89 935.2,217.6ZM1211.4,137.8C1190.3,137.8 1173.3,120.8 1173.3,99.7C1173.3,78.7 1190.3,61.6 1211.4,61.6C1232.5,61.6 1249.5,78.7 1249.5,99.7C1249.5,120.8 1232.5,137.8 1211.4,137.8Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
10
+ <path d="M1213.8,123.6C1201.9,123.6 1192.4,114 1192.4,102.1C1192.4,90.3 1201.9,80.7 1213.8,80.7C1225.6,80.7 1235.2,90.3 1235.2,102.1C1235.2,114 1225.6,123.6 1213.8,123.6Z" style="fill:rgb(204,52,45);fill-rule:nonzero;"/>
11
+ <path d="M1747.4,90.9L1690.9,129C1686.83,131.6 1684.2,135.367 1683,140.3C1681.87,144.9 1682.4,149.167 1684.6,153.1C1686.73,156.967 1689.9,159.4 1694.1,160.4C1698.63,161.533 1702.9,160.7 1706.9,157.9L1746.8,131.1C1747.47,130.633 1747.87,130.067 1748,129.4C1748.2,128.533 1747.73,127.033 1746.6,124.9C1745.4,122.767 1744.4,121.6 1743.6,121.4C1743,121.267 1742.37,121.4 1741.7,121.8L1701.8,148.7C1700.07,149.767 1698.37,150.1 1696.7,149.7C1695.23,149.3 1694.13,148.467 1693.4,147.2C1692.67,145.867 1692.5,144.4 1692.9,142.8C1693.37,140.867 1694.4,139.333 1696,138.2L1752.5,100.1C1756.63,97.367 1760.8,96.5 1765,97.5C1768.27,98.3 1770.7,100.133 1772.3,103C1773.9,105.933 1774.27,109.167 1773.4,112.7C1772.27,117.3 1769.67,121 1765.6,123.8L1690,174.6C1685.07,177.867 1679.9,178.867 1674.5,177.6C1669.03,176.267 1664.87,173.1 1662,168.1C1659.13,163.1 1658.43,157.6 1659.9,151.6C1661.3,145.933 1664.5,141.367 1669.5,137.9L1728.6,98.2C1729.2,97.733 1729.6,97.133 1729.8,96.4C1730,95.533 1729.53,94.067 1728.4,92C1727.27,89.867 1726.27,88.7 1725.4,88.5C1724.8,88.367 1724.17,88.533 1723.5,89L1664.6,128.6C1657.2,133.6 1652.43,140.533 1650.3,149.4C1648.17,158.333 1649.2,166.567 1653.4,174.1C1657.6,181.633 1663.8,186.4 1672,188.4C1680,190.333 1687.73,188.833 1695.2,183.9L1770.7,133C1777.17,128.667 1781.33,122.7 1783.2,115.1C1784.8,108.567 1784.1,102.6 1781.1,97.2C1778.1,91.733 1773.6,88.3 1767.6,86.9C1760.53,85.167 1753.8,86.5 1747.4,90.9Z" style="fill:rgb(5,169,244);fill-rule:nonzero;"/>
12
+ </svg>
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.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Neutert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: httpx
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.22.5
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 0.25.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: 0.22.5
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.25.0
41
47
  description: Papierkram API Client, um deine Buchhaltung auf das nächste Level zu
42
48
  bringen.
43
49
  email:
@@ -50,6 +56,7 @@ files:
50
56
  - ".gitignore"
51
57
  - ".rubocop"
52
58
  - ".rubocop.yml"
59
+ - ".tool-versions"
53
60
  - CHANGELOG.md
54
61
  - Gemfile
55
62
  - Gemfile.lock
@@ -78,6 +85,7 @@ files:
78
85
  - lib/papierkram_api/v1/validators/expense_voucher.rb
79
86
  - lib/papierkram_api_client.rb
80
87
  - lib/papierkram_api_client/version.rb
88
+ - logo.svg
81
89
  - pac.svg
82
90
  - sig/papierkram_api_client.rbs
83
91
  homepage: https://github.com/simonneutert/papierkram_api_client
@@ -103,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
111
  - !ruby/object:Gem::Version
104
112
  version: '0'
105
113
  requirements: []
106
- rubygems_version: 3.4.8
114
+ rubygems_version: 3.4.14
107
115
  signing_key:
108
116
  specification_version: 4
109
117
  summary: Papierkram API Client