Class: Jbr::Event
- Inherits:
-
Object
- Object
- Jbr::Event
- Defined in:
- lib/jbr/event.rb
Overview
One webhook Jobber posted, and the signature header it arrives under.
Constant Summary collapse
- SIGNATURE_HEADER =
'X-Jobber-Hmac-SHA256'
Class Method Summary collapse
-
.params_for(item_id:, account_id:) ⇒ Hash
The shape of the payload sent by Jobber to the callback URL.
Instance Method Summary collapse
-
#account_id ⇒ String
Unique identifier of the event account.
-
#initialize(params = {}) ⇒ Event
constructor
A new instance of Event.
-
#item_id ⇒ String
Unique identifier of the event target.
Constructor Details
#initialize(params = {}) ⇒ Event
Returns a new instance of Event.
8 9 10 |
# File 'lib/jbr/event.rb', line 8 def initialize(params = {}) @params = params end |
Class Method Details
.params_for(item_id:, account_id:) ⇒ Hash
Returns the shape of the payload sent by Jobber to the callback URL.
19 20 21 |
# File 'lib/jbr/event.rb', line 19 def self.params_for(item_id:, account_id:) { data: { webHookEvent: { itemId: item_id, accountId: account_id } } } end |
Instance Method Details
#account_id ⇒ String
Returns unique identifier of the event account.
16 |
# File 'lib/jbr/event.rb', line 16 def account_id = @params.dig :data, :webHookEvent, :accountId |
#item_id ⇒ String
Returns unique identifier of the event target.
13 |
# File 'lib/jbr/event.rb', line 13 def item_id = @params.dig :data, :webHookEvent, :itemId |