Class: Onfleet::Webhooks

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/webhooks.rb

Overview

Webhooks make it possible for your application to be notified of important system events, as soon as these take place within Onfleet. Onfleet uses HMAC (hash-based message authentication code) with the SHA-512 hash function for additional authentication. By using the webhook secret obtained on the Onfleet dashboard, your webhook server should verify that the source of webhook requests are indeed coming from Onfleet and is associated with your organization. Any failed requests will be retried in 30-minute cycles, up to one full day. A failed request is any non-200 response that a webhook request gets from your application.

Instance Method Summary collapse

Instance Method Details

#create(config, body) ⇒ Object

ACTION: still needs to be tested



14
15
16
17
18
19
# File 'lib/resources/webhooks.rb', line 14

def create(config, body)
  method = 'post'
  path = 'webhooks'

  Onfleet.request(config, method.to_sym, path, body.to_json)
end

#delete(config, id) ⇒ Object

ACTION: still needs to be tested



30
31
32
33
34
35
# File 'lib/resources/webhooks.rb', line 30

def delete(config, id)
  method = 'delete'
  path = "webhooks/#{id}"

  Onfleet.request(config, method.to_sym, path)
end

#list(config) ⇒ Object

ACTION: still needs to be tested



22
23
24
25
26
27
# File 'lib/resources/webhooks.rb', line 22

def list(config)
  method = 'get'
  path = 'webhooks'

  Onfleet.request(config, method.to_sym, path)
end