module SendGrid4r::REST::Webhooks::Event

SendGrid Web API v3 Webhooks ParseApi

Constants

EventNotification

Public Class Methods

create_event_notification(resp) click to toggle source
# File lib/sendgrid4r/rest/webhooks/event.rb, line 23
def self.create_event_notification(resp)
  return resp if resp.nil?
  EventNotification.new(
    resp['enabled'], resp['url'], resp['group_resubscribe'],
    resp['delivered'], resp['group_unsubscribe'], resp['spam_report'],
    resp['bounce'], resp['deferred'], resp['unsubscribe'],
    resp['processed'], resp['open'], resp['click'], resp['dropped']
  )
end
url_event(path) click to toggle source
# File lib/sendgrid4r/rest/webhooks/event.rb, line 13
def self.url_event(path)
  "#{BASE_URL}/user/webhooks/event/#{path}"
end

Public Instance Methods

get_settings_event_notification(&block) click to toggle source
# File lib/sendgrid4r/rest/webhooks/event.rb, line 33
def get_settings_event_notification(&block)
  resp = get(@auth, Event.url_event(:settings), &block)
  finish(resp, @raw_resp) { |r| Event.create_event_notification(r) }
end
patch_settings_event_notification(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/webhooks/event.rb, line 38
def patch_settings_event_notification(params:, &block)
  resp = patch(@auth, Event.url_event(:settings), params.to_h, &block)
  finish(resp, @raw_resp) { |r| Event.create_event_notification(r) }
end
test_settings_event_notification(url:, &block) click to toggle source
# File lib/sendgrid4r/rest/webhooks/event.rb, line 43
def test_settings_event_notification(url:, &block)
  params = { url: url }
  post(@auth, Event.url_event(:test), params, &block)
end