Sha256: 3fd926016a173f5871865c78dec0ba106101c1dde87c5fbe48de91ab1e39148f
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
# -*- encoding: utf-8 -*- module SendGrid4r::REST # # SendGrid Web API v3 Webhooks # module Webhooks # # SendGrid Web API v3 Webhooks ParseApi # module Event include Request def self.url_event(path) "#{BASE_URL}/user/webhooks/event/#{path}" end EventNotification = Struct.new( :enabled, :url, :group_resubscribe, :delivered, :group_unsubscribe, :spam_report, :bounce, :deferred, :unsubscribe, :processed, :open, :click, :dropped ) 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 def get_settings_event_notification(&block) resp = get(@auth, Event.url_event(:settings), &block) Event.create_event_notification(resp) end def patch_settings_event_notification(params:, &block) resp = patch(@auth, Event.url_event(:settings), params.to_h, &block) Event.create_event_notification(resp) end def test_settings_event_notification(url:, &block) params = { url: url } post(@auth, Event.url_event(:test), params, &block) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sendgrid4r-1.11.0 | lib/sendgrid4r/rest/webhooks/event.rb |
sendgrid4r-1.10.0 | lib/sendgrid4r/rest/webhooks/event.rb |