Sha256: 919840a281a6be5756b9d74101ec2d801d97f9cde0f3f6729885730916596f85

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

module AhoyEmail
  class Tracker
    attr_reader :message

    def initialize(message)
      @message = message
    end

    def perform
      if message.perform_deliveries && (data_header = message["Ahoy-Message"])
        Safely.safely do
          data = JSON.parse(data_header.to_s).symbolize_keys
          data[:message] = message
          AhoyEmail.track_method.call(data)
        end
      end
    ensure
      message["Ahoy-Message"] = nil if message["Ahoy-Message"]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ahoy_email-1.0.0 lib/ahoy_email/tracker.rb