Class: Pokey::Sendgrid::Hook
- Inherits:
-
Hook
- Object
- Hook
- Pokey::Sendgrid::Hook
- Includes:
- MockData
- Defined in:
- lib/pokey/sendgrid/hook.rb
Overview
Instance Method Summary collapse
- #categories ⇒ Object
- #data ⇒ Object
- #destination ⇒ Object
- #http_method ⇒ Object
- #interval ⇒ Object
- #unique_args ⇒ Object
Methods included from MockData
Instance Method Details
#categories ⇒ Object
43 44 45 |
# File 'lib/pokey/sendgrid/hook.rb', line 43 def categories [] end |
#data ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
10 11 12 |
# File 'lib/pokey/sendgrid/hook.rb', line 10 def destination "http://localhost:3000/api/sendgrid/events" end |
#http_method ⇒ Object
18 19 20 |
# File 'lib/pokey/sendgrid/hook.rb', line 18 def http_method :post end |
#interval ⇒ Object
14 15 16 |
# File 'lib/pokey/sendgrid/hook.rb', line 14 def interval 5 end |
#unique_args ⇒ Object
47 48 49 |
# File 'lib/pokey/sendgrid/hook.rb', line 47 def unique_args {} end |