Module: Resend::Events

Defined in:
lib/resend/events.rb

Overview

events api wrapper

Class Method Summary collapse

Class Method Details

.create(params = {}) ⇒ Object



8
9
10
# File 'lib/resend/events.rb', line 8

def create(params = {})
  Resend::Request.new("events", params, "post").perform
end

.get(identifier = "") ⇒ Object

resend.com/docs/api-reference/events/get-event identifier can be a UUID or an event name (e.g. “user.signed_up”)



14
15
16
17
# File 'lib/resend/events.rb', line 14

def get(identifier = "")
  path = "events/#{CGI.escape(identifier.to_s)}"
  Resend::Request.new(path, {}, "get").perform
end

.list(params = {}) ⇒ Object



40
41
42
43
# File 'lib/resend/events.rb', line 40

def list(params = {})
  path = Resend::PaginationHelper.build_paginated_path("events", params)
  Resend::Request.new(path, {}, "get").perform
end

.remove(identifier = "") ⇒ Object

resend.com/docs/api-reference/events/delete-event identifier can be a UUID or an event name (e.g. “user.signed_up”)



29
30
31
32
# File 'lib/resend/events.rb', line 29

def remove(identifier = "")
  path = "events/#{CGI.escape(identifier.to_s)}"
  Resend::Request.new(path, {}, "delete").perform
end

.send(params = {}) ⇒ Object



35
36
37
# File 'lib/resend/events.rb', line 35

def send(params = {})
  Resend::Request.new("events/send", params, "post").perform
end

.update(params = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/resend/events.rb', line 20

def update(params = {})
  identifier = params[:identifier]
  path = "events/#{CGI.escape(identifier.to_s)}"
  payload = params.reject { |k, _| k == :identifier }
  Resend::Request.new(path, payload, "patch").perform
end