papierkram_api_client 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c711543eff8d01b4052e9de92dc9d3a4f436107c71c9944ab63d5943d28d73a9
4
- data.tar.gz: 156999ce0d5031096ee95cf034849bc7f3b7bf29c3321daec47cd75f228391b7
3
+ metadata.gz: a1a03790a5079d46fc57b6efa84682046fbfd4f4e916e68fd9e4132863dc07c3
4
+ data.tar.gz: b6edd7e886bcaf9a9f761fec07494c2f6e292f77b946e0fc2f2ee33b8228d60e
5
5
  SHA512:
6
- metadata.gz: 0104eda136279d4c82cf0671d1e5c64650f9eeda00a5b26813bd16f85756168747816b68a0a1c576f9a513a10d7e133b99055a9aab75240395ce0cfdc3867f2e
7
- data.tar.gz: 377a731d8eaadc2016d264390963fcb995673815a35053c5ee9ee3c1bb83b783a77fda9568db2b15149df69f8c752636521bde07009ee773c46c301dd1fa6b50
6
+ metadata.gz: 299c6bcf0f35da94d1e1e6298f2aee5cc70b4eaddc3abe2e36fd051a3286290f9182f87331debc8c79f4ddca429f4fbb14aa4a95c0276fa857177165ab7ac36f
7
+ data.tar.gz: df625c5ce0e31b68b4ebcbd80e681d58674396843c43f5631544891b6e8eeeef1e788d19b38930e3cd4555755444b5e7430ebee7610df2550d22225d136df2b5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## [0.2.2] - 2023-06-28
4
12
 
5
13
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- papierkram_api_client (0.2.2)
4
+ papierkram_api_client (0.2.3)
5
5
  faraday (~> 2.7)
6
6
  httpx (>= 0.22.5, < 0.25.0)
7
7
 
data/README.md CHANGED
@@ -77,6 +77,9 @@ Ziele:
77
77
  - [Contact::Company (Kontaktperson eines Unternehmens)](#contactcompany-kontaktperson-eines-unternehmens)
78
78
  - [alle Kontaktpersonen (eines Unternehmens)](#alle-kontaktpersonen-eines-unternehmens)
79
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)
80
83
  - [Expense::Voucher (Ausgabe Beleg)](#expensevoucher-ausgabe-beleg)
81
84
  - [alle Ausgabe Belege](#alle-ausgabe-belege)
82
85
  - [einen Ausgabe Beleg](#einen-ausgabe-beleg)
@@ -92,10 +95,20 @@ Ziele:
92
95
  - [Income::Proposition (Waren / Dienstleistungen)](#incomeproposition-waren--dienstleistungen)
93
96
  - [alle Waren / Dienstleistungen](#alle-waren--dienstleistungen)
94
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)
95
103
  - [Info](#info)
96
104
  - [Project::Project (Projekt)](#projectproject-projekt)
97
105
  - [alle Projekte](#alle-projekte)
98
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)
99
112
  - [Tracker::Task (Aufgabe)](#trackertask-aufgabe)
100
113
  - [alle Aufgaben](#alle-aufgaben)
101
114
  - [eine Aufgabe](#eine-aufgabe)
@@ -347,6 +360,41 @@ puts company.headers
347
360
  puts company.body
348
361
  ```
349
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
+
350
398
  ### Expense::Voucher (Ausgabe Beleg)
351
399
 
352
400
  Der Endpunkt `/papierkram_api/v1/endpoints/expense/vouchers` liefert Informationen über die Ausgabe Belege. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -459,6 +507,56 @@ puts proposition.headers
459
507
  puts proposition.body
460
508
  ```
461
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
+
462
560
  ### Info
463
561
 
464
562
  Der Endpunkt `lib/papierkram_api/v1/endpoints/info.rb` liefert Informationen über die API. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -493,6 +591,50 @@ puts project.headers
493
591
  puts project.body
494
592
  ```
495
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
+
496
638
  ### Tracker::Task (Aufgabe)
497
639
 
498
640
  Der Endpunkt `/papierkram_api/v1/tracker/tasks` liefert Informationen über die Aufgaben. Die Informationen werden als `Faraday::Response` zurückgegeben.
@@ -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.2'
4
+ VERSION = '0.2.3'
5
5
  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.2.2
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-06-28 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