Class: Notisend::Resources::Webhooks

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

Overview

Message webhooks: /email/messages_webhooks

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Notisend::Resources::Base

Instance Method Details

#create(title:, url:, kinds:, events:) ⇒ Object



7
8
9
# File 'lib/notisend/resources/webhooks.rb', line 7

def create(title:, url:, kinds:, events:)
  client.post(email_path('messages_webhooks'), { title:, url:, kinds:, events: })
end

#delete(id:) ⇒ Object



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

def delete(id:)
  client.delete(email_path('messages_webhooks', id))
end

#eventsObject



32
33
34
# File 'lib/notisend/resources/webhooks.rb', line 32

def events
  client.get(email_path('messages_webhooks', 'events'))
end

#get(id:) ⇒ Object



15
16
17
# File 'lib/notisend/resources/webhooks.rb', line 15

def get(id:)
  client.get(email_path('messages_webhooks', id))
end

#kindsObject



28
29
30
# File 'lib/notisend/resources/webhooks.rb', line 28

def kinds
  client.get(email_path('messages_webhooks', 'kinds'))
end

#list(page_number: nil, page_size: nil) ⇒ Object



11
12
13
# File 'lib/notisend/resources/webhooks.rb', line 11

def list(page_number: nil, page_size: nil)
  paginated(email_path('messages_webhooks'), page_params(page_number:, page_size:))
end

#update(id:, title: nil, url: nil, kinds: nil, events: nil, status: nil) ⇒ Object



19
20
21
22
# File 'lib/notisend/resources/webhooks.rb', line 19

def update(id:, title: nil, url: nil, kinds: nil, events: nil, status: nil)
  payload = { title:, url:, kinds:, events:, status: }.compact
  client.patch(email_path('messages_webhooks', id), payload)
end