class Pokey::Sendgrid::Hook
Reference: sendgrid.com/docs/API_Reference/Webhooks/event.html
Public Instance Methods
categories()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 43 def categories [] end
data()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 22 def data data = base_data case data["event"] # Delivery events when "bounce", "deferred", "delivered", "dropped", "processed" data.merge!({ "smtp-id" => smtp_id }) # Engagement events when "click", "open", "spamreport", "unsubscribe" data.merge!({ "useragent" => user_agents.sample, "ip" => Faker::Internet.ip_v4_address }) end data.merge!(unique_args) data end
destination()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 10 def destination "http://localhost:3000/api/sendgrid/events" end
http_method()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 18 def http_method :post end
interval()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 14 def interval 5 end
unique_args()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 47 def unique_args {} end
Protected Instance Methods
base_data()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 53 def base_data { "timestamp" => Time.now.to_i, "category" => categories.sample, "event" => sendgrid_events.sample, "email" => Faker::Internet.email } end
sendgrid_events()
click to toggle source
# File lib/pokey/sendgrid/hook.rb, line 62 def sendgrid_events [ "processed", "dropped", "delivered", "deferred", "bounce", "open", "click", "spamreport", "unsubscribe", "group_unsubscribe", "group_resubscribe" ] end