Module: SendGrid4r::REST::Webhooks::Event
- Includes:
- Request
- Included in:
- API
- Defined in:
- lib/sendgrid4r/rest/webhooks/event.rb
Overview
SendGrid Web API v3 Webhooks ParseApi
Defined Under Namespace
Classes: EventNotification
Constant Summary
Constants included
from Request
Request::BASE_URL
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Request
#create_args, #delete, #execute, #finish, #get, #patch, #post, #process_array_params, #process_url_params, #put
Class Method Details
.create_event_notification(resp) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/sendgrid4r/rest/webhooks/event.rb', line 24
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) ⇒ Object
14
15
16
|
# File 'lib/sendgrid4r/rest/webhooks/event.rb', line 14
def self.url_event(path)
"#{BASE_URL}/user/webhooks/event/#{path}"
end
|
Instance Method Details
#get_settings_event_notification(&block) ⇒ Object
34
35
36
37
|
# File 'lib/sendgrid4r/rest/webhooks/event.rb', line 34
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) ⇒ Object
39
40
41
42
|
# File 'lib/sendgrid4r/rest/webhooks/event.rb', line 39
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) ⇒ Object
44
45
46
47
|
# File 'lib/sendgrid4r/rest/webhooks/event.rb', line 44
def test_settings_event_notification(url:, &block)
params = { url: url }
post(@auth, Event.url_event(:test), params, &block)
end
|