class Sespool::Bounce
Public Class Methods
new(raw_data)
click to toggle source
# File lib/sespool/bounce.rb, line 7 def initialize(raw_data) message = JSON.parse(JSON.parse(raw_data).fetch('Message')) @_mail_data = message.fetch('mail') @_bounce_data = message.fetch('bounce') end
Public Instance Methods
bounced_recipients()
click to toggle source
# File lib/sespool/bounce.rb, line 33 def bounced_recipients @_bounced_recipients ||= @_bounce_data.fetch('bouncedRecipients').map { |recipient| Recipient.new( recipient.fetch('emailAddress'), recipient.fetch('status'), recipient.fetch('diagnosticCode'), recipient.fetch('action') ) } end
feedback_id()
click to toggle source
# File lib/sespool/bounce.rb, line 25 def feedback_id @_bounce_data.fetch('feedbackId') end
mail()
click to toggle source
# File lib/sespool/bounce.rb, line 44 def mail @_mail ||= Mail.new( @_mail_data.fetch('timestamp'), @_mail_data.fetch('source'), @_mail_data.fetch('messageId'), @_mail_data.fetch('destination') ) end
reporting_mta()
click to toggle source
# File lib/sespool/bounce.rb, line 21 def reporting_mta @_bounce_data.fetch('reportingMTA') end
sub_type()
click to toggle source
# File lib/sespool/bounce.rb, line 17 def sub_type @_bounce_data.fetch('bounceSubType') end
timestamp()
click to toggle source
# File lib/sespool/bounce.rb, line 29 def timestamp Time.parse(@_bounce_data.fetch('timestamp')) end
type()
click to toggle source
# File lib/sespool/bounce.rb, line 13 def type @_bounce_data.fetch('bounceType') end