fakturoid 1.0.0 → 1.1.0

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: 0b4689e1d86c92e1fc9b027490529ade7afecd45c22dd0fc7d4b9039d803fdd1
4
- data.tar.gz: 3eda099c2df602b70b145710454973d33b6f6dd1f707f655277e9195e986ce49
3
+ metadata.gz: 7602cad1387db4cc12302ec8a91713532f0a3c45430446873e9d7d8fa55954f0
4
+ data.tar.gz: f3921c67c2a260b6520d56f793b60dfb40a61929516c85ec083e1847b1288bf7
5
5
  SHA512:
6
- metadata.gz: 6eb472e77031c600bdb6a046dfac45f775d1b5fbb6fac0f1ed4cbb25c6287d8035b445ac3f7daa6cd2a2811a43d3931c07615d7eb5229e983e90d1926cb3e775
7
- data.tar.gz: 45171809ef6a49337ca1a581e3b1c59e2ea9247709e4f2a83e38764d4e034924aa33b726a0e5b8dd7bb3ac97e7bdbdfc47c53e752247d705f5a7ad07cbffa7d8
6
+ metadata.gz: d35907aa669e52de1559daf1d0abf83f4c83d32171572306fd99123b4af04751133f6b1e95c97c157b018a1d25aee877a344d5faa78995514fe93d71240591cc
7
+ data.tar.gz: 3832aa4a685948593f0f12424fa9ce9797e85304d67c563482b96e4d420d7ade48212967cca5a1ce4f508a671f0c6d8ea9a5e8919b2bf646096024aa416e423a
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.0-rc1
1
+ 3.3.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.1.0
2
+
3
+ - Add support for [webhooks](https://www.fakturoid.cz/api/v3/webhooks).
4
+
1
5
  ## 1.0.0
2
6
 
3
7
  - Implement Fakturoid API v3.
data/README.md CHANGED
@@ -716,6 +716,38 @@ Toggle a todo completion:
716
716
  response = client.todos.toggle_completion(todo_id)
717
717
  ```
718
718
 
719
+ ### [Webhook Resource](https://www.fakturoid.cz/api/v3/webhooks)
720
+
721
+ Get a list of all webhooks:
722
+
723
+ ```ruby
724
+ response = client.webhooks.all
725
+ ```
726
+
727
+ Get a single webhook:
728
+
729
+ ```ruby
730
+ response = client.webhooks.find(webhook_id)
731
+ ```
732
+
733
+ Create a webhook:
734
+
735
+ ```ruby
736
+ response = client.webhooks.create(webhook_url: "https://example.com/webhook", events: %w[invoice_created])
737
+ ```
738
+
739
+ Update a webhook:
740
+
741
+ ```ruby
742
+ response = client.webhooks.update(webhook_id, webhook_url: "https://example.com/webhook")
743
+ ```
744
+
745
+ Delete a webhook:
746
+
747
+ ```ruby
748
+ response = client.webhooks.delete(webhook_id)
749
+ ```
750
+
719
751
  ## Handling Errors
720
752
 
721
753
  The Fakturoid gem raises exceptions if server responds with an error.
@@ -750,6 +782,13 @@ All exceptions except `ConfigurationError` contain following attributes:
750
782
  </tbody>
751
783
  </table>
752
784
 
785
+ ## Contributing
786
+
787
+ - Make a pull request with requested changes.
788
+ - Make sure the pull request is as small as possible. If you encounter something that should be changed but is unrelated,
789
+ please make a separate pull request for that.
790
+ - Do not change the version number inside the pull request – this will be done after it is merged.
791
+
753
792
  ## Development
754
793
 
755
794
  ```sh
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fakturoid
4
+ module Api
5
+ class Webhook
6
+ include Base
7
+
8
+ def all(params = {})
9
+ request_params = Utils.permit_params(params, :page)
10
+
11
+ perform_request(HTTP_GET, "webhooks.json", request_params: request_params)
12
+ end
13
+
14
+ def find(id)
15
+ Utils.validate_numerical_id(id)
16
+ perform_request(HTTP_GET, "webhooks/#{id}.json")
17
+ end
18
+
19
+ def create(payload = {})
20
+ perform_request(HTTP_POST, "webhooks.json", payload: payload)
21
+ end
22
+
23
+ def update(id, payload = {})
24
+ Utils.validate_numerical_id(id)
25
+ perform_request(HTTP_PATCH, "webhooks/#{id}.json", payload: payload)
26
+ end
27
+
28
+ def delete(id)
29
+ Utils.validate_numerical_id(id)
30
+ perform_request(HTTP_DELETE, "webhooks/#{id}.json")
31
+ end
32
+ end
33
+ end
34
+ end
data/lib/fakturoid/api.rb CHANGED
@@ -20,6 +20,7 @@ require_relative "api/recurring_generator"
20
20
  require_relative "api/subject"
21
21
  require_relative "api/todo"
22
22
  require_relative "api/user"
23
+ require_relative "api/webhook"
23
24
 
24
25
  module Fakturoid
25
26
  module Api
@@ -90,5 +91,9 @@ module Fakturoid
90
91
  def users
91
92
  @users ||= User.new(self)
92
93
  end
94
+
95
+ def webhooks
96
+ @webhooks ||= Webhook.new(self)
97
+ end
93
98
  end
94
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fakturoid
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakturoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eda Riedl
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-03-22 00:00:00.000000000 Z
14
+ date: 2024-07-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -159,6 +159,7 @@ files:
159
159
  - lib/fakturoid/api/subject.rb
160
160
  - lib/fakturoid/api/todo.rb
161
161
  - lib/fakturoid/api/user.rb
162
+ - lib/fakturoid/api/webhook.rb
162
163
  - lib/fakturoid/client.rb
163
164
  - lib/fakturoid/config.rb
164
165
  - lib/fakturoid/oauth.rb
@@ -199,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  - !ruby/object:Gem::Version
200
201
  version: '0'
201
202
  requirements: []
202
- rubygems_version: 3.5.5
203
+ rubygems_version: 3.5.13
203
204
  signing_key:
204
205
  specification_version: 4
205
206
  summary: Ruby client for web based invoicing service www.fakturoid.cz