Class: WebhookEvent
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- WebhookEvent
- Defined in:
- app/models/webhook_event.rb
Overview
== Schema Information
Table name: webhook_events
Database name: primary
id :integer not null, primary key
attempt :string
bounce_type :string
category :string is an Array
email :string
event :string
ip :string
reason :string
response :string
status :string
string :string
timestamp :datetime
url :string
useragent :string
created_at :datetime not null
updated_at :datetime not null
asm_group_id :string
communication_recipient_id :integer
creator_id :integer
sg_event_id :string
sg_message_id :string
smtp_id :string
unique_id :string
updater_id :integer
Indexes
index_webhook_events_on_created_at (created_at) USING brin
Constant Summary collapse
- EVENTS =
{ "processed" => "Message has been received and is ready to be delivered", "deferred" => "Recipient's email server temporarily rejected message", "delivered" => "Message has been successfully delivered", "opened" => "Recipient has opened the message", "clicked" => "Recipient clicked on a link within the message", "bounced" => "Receiving server could not or would not accept message, see individual email for bounce reason", "dropped" => "Message rejected by email server before attempting delivery, see individual email for drop reason", "spammed" => "Recipient marked message as spam", "unsubscribed" => "Recipient clicked on message's unsubscribe link" }
Belongs to collapse
Class Method Summary collapse
-
.with_customer ⇒ ActiveRecord::Relation<WebhookEvent>
A relation of WebhookEvents that are with customer.
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.with_customer ⇒ ActiveRecord::Relation<WebhookEvent>
A relation of WebhookEvents that are with customer. Active Record Scope
51 52 53 54 |
# File 'app/models/webhook_event.rb', line 51 scope :with_customer, -> { joins("left join subscribers on subscribers.id = campaign_deliveries.subscriber_id left outer JOIN contact_points on contact_points.id = (select max(id) from contact_points where contact_points.detail = subscribers.email_address) left outer JOIN parties contacts on contacts.id = contact_points.party_id and contacts.type = 'Contact' left outer JOIN parties customers on customers.id = coalesce(contacts.customer_id, contact_points.party_id)") } |
Instance Method Details
#communication_recipient ⇒ CommunicationRecipient
49 |
# File 'app/models/webhook_event.rb', line 49 belongs_to :communication_recipient, optional: true |