jbr 1.0.6 → 1.0.7

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: 2a5324bd1f1d013b3c4284542e4f5fb35437174789bd8e99a05eee9a9346811e
4
- data.tar.gz: c18756f37f36bd03e476ff8e5e838418765e6a9d933bd54ff43bfebd1bd856d2
3
+ metadata.gz: 0e910cc53b4d0d49088e05481c72f0d828c97ecbea3e5c5a6a78da4d61988c7c
4
+ data.tar.gz: 8f9945fe6d165a8d6837a567433472e244f25236db495b714269454efb85a662
5
5
  SHA512:
6
- metadata.gz: f7f5b06138be3b3cf73aca22357c841be01a2dee43731369007dd67901f47128cf79ea9bc3a5170903fe21cb7c8f01791df4c24333455890cc226b7a07b96846
7
- data.tar.gz: 32520407af951f696fffb1f2107c3f40d49e42ae4e5a1c846779c8a43e74cbb04ee54a425e07c70c27e12f364522845d65e7b3ed597aef33aff5e3011ce56332
6
+ metadata.gz: f4996c8bea8e6596863240cb7caee1d59e8ade0aeaba02c059ac0ff8e770e062a94dc2ca385a399033b36f4da9a6ba0fcc8ab5c81ccb3a576f471e6b0d9d6a76
7
+ data.tar.gz: 0de414c6ece8eb9ce928c9431ed074472038efcf243d73af4262a43465fc1b128cb99f866f2d16956ff52f10a230cc05db3f54387e946f5d8fe4c01a02765d69
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.0.7] - 2026-05-26
2
+
3
+ - [New] Add Jbr::Event to parse webhook payloads
4
+
1
5
  ## [1.0.6] - 2026-05-24
2
6
 
3
7
  - [Change] Return mock.oauth_error as the message of Jbr::Error
data/README.md CHANGED
@@ -83,6 +83,17 @@ invoice.issued_at # => 2026-05-22 12:12:53
83
83
  invoice.completed_at # => 2026-05-22 14:32:53
84
84
  ```
85
85
 
86
+ ### Events
87
+
88
+ Parse the payload of a Jobber event webhook:
89
+
90
+ ```ruby
91
+ event = Jbr::Event.new data: { webHookEvent: { topic: 'JOB_CREATE', appId: 'app-1',
92
+ accountId: 'account-1', itemId: 'job-1', occurredAt: '2026-05-22T15:46:33Z' } }
93
+ event.account_id = 'account-1
94
+ event.item_id = 'job-1
95
+ ```
96
+
86
97
  ## Available mocks
87
98
 
88
99
  Use these methods to mock request to Jobber when testing an app:
data/lib/jbr/event.rb ADDED
@@ -0,0 +1,17 @@
1
+ module Jbr
2
+ class Event
3
+ # @see https://developer.getjobber.com/docs/using_jobbers_api/setting_up_webhooks
4
+ SIGNATURE_HEADER = 'X-Jobber-Hmac-SHA256'
5
+
6
+ # @param params [Hash] the payload for an event webhook.
7
+ def initialize(params = {})
8
+ @params = params
9
+ end
10
+
11
+ # @return [String] unique identifier of the event target.
12
+ def item_id = @params.dig :data, :webHookEvent, :itemId
13
+
14
+ # @return [String] unique identifier of the event account.
15
+ def account_id = @params.dig :data, :webHookEvent, :accountId
16
+ end
17
+ end
data/lib/jbr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jbr
4
- VERSION = '1.0.6'
4
+ VERSION = '1.0.7'
5
5
  end
data/lib/jbr.rb CHANGED
@@ -30,3 +30,5 @@ require 'jbr/mock/account'
30
30
  require 'jbr/mock/url'
31
31
 
32
32
  require 'jbr/mocking'
33
+
34
+ require 'jbr/event'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
@@ -27,6 +27,7 @@ files:
27
27
  - lib/jbr/client.rb
28
28
  - lib/jbr/configuration.rb
29
29
  - lib/jbr/error.rb
30
+ - lib/jbr/event.rb
30
31
  - lib/jbr/invoice.rb
31
32
  - lib/jbr/job.rb
32
33
  - lib/jbr/mock.rb