Sha256: 2fefe71cb844215fd9167414160bf922b8a3d9bce59d17559c2872a9364a081a
Contents?: true
Size: 833 Bytes
Versions: 1
Compression:
Stored size: 833 Bytes
Contents
class EmailEvents::Service::ParseSmtpResponseForProviderId < EmailEvents::Service include Virtus.model attribute :mail_message attribute :raw_response attribute :sent_email_data_class def call # parse the response using the applicable SmtpResponse adapter provider_id = parsed_response.provider_message_id return if provider_id.nil? # find our SentEmailData from our own UUID and store the provider id sent_email_data = sent_email_data_class.find_by_uuid(message_uuid) sent_email_data.update_attribute(:provider_message_id, provider_id) end private def response_class EmailEvents.adapter.const_get('SmtpResponse') end def parsed_response @parsed_response = response_class.new(raw_response) end def message_uuid mail_message.message_id.match(/(.+)\@uuid/)[1] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
email_events-1.0 | lib/email_events/services/parse_smtp_response_for_provider_id.rb |