Class: Emailbutler::Webhooks::Mappers::Sendgrid
- Inherits:
-
Object
- Object
- Emailbutler::Webhooks::Mappers::Sendgrid
- Defined in:
- lib/emailbutler/webhooks/mappers/sendgrid.rb
Constant Summary collapse
- DELIVERABILITY_MAPPER =
{ 'processed' => 'processed', 'delivered' => 'delivered', 'open' => 'opened', 'click' => 'opened' }.freeze
Instance Method Summary collapse
-
#call(payload:) ⇒ Object
rubocop: disable Metrics/AbcSize, Metrics/CyclomaticComplexity.
Instance Method Details
#call(payload:) ⇒ Object
rubocop: disable Metrics/AbcSize, Metrics/CyclomaticComplexity
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/emailbutler/webhooks/mappers/sendgrid.rb', line 14 def call(payload:) # rubocop: disable Metrics/AbcSize, Metrics/CyclomaticComplexity payload['_json'].filter_map { || .stringify_keys! = ['smtp-id'] || ['sg_message_id'] = [1..-2] if .starts_with?('<') && .ends_with?('>') next if .nil? { message_uuid: , status: transform_status(['event']), timestamp: ['timestamp'] ? Time.at(['timestamp'].to_i).utc.to_datetime : nil } } end |