Class: Juno::Webhooks

Inherits:
Resource show all
Defined in:
lib/juno/webhooks.rb

Class Method Summary collapse

Methods inherited from Resource

delete, get, patch, post, put

Class Method Details

.create(body) ⇒ Object



4
5
6
# File 'lib/juno/webhooks.rb', line 4

def create(body)
  post('/notifications/webhooks', body)
end

.event_typesObject



24
25
26
# File 'lib/juno/webhooks.rb', line 24

def event_types
  get('/notifications/event-types')
end

.listObject



8
9
10
# File 'lib/juno/webhooks.rb', line 8

def list
  get('/notifications/webhooks')
end

.remove(id) ⇒ Object



20
21
22
# File 'lib/juno/webhooks.rb', line 20

def remove(id)
  delete("/notifications/webhooks/#{id}")
end

.show(id) ⇒ Object



12
13
14
# File 'lib/juno/webhooks.rb', line 12

def show(id)
  get("/notifications/webhooks/#{id}")
end

.update(id, body) ⇒ Object



16
17
18
# File 'lib/juno/webhooks.rb', line 16

def update(id, body)
  patch("/notifications/webhooks/#{id}", body)
end

.valid_signature?(signature, secret, payload) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/juno/webhooks.rb', line 28

def valid_signature?(signature, secret, payload)
  our_signature = OpenSSL::HMAC.hexdigest('SHA256', secret, payload)

  our_signature.eql?(signature)
end