Module: SendgridEvents::ActionMailerOverride

Extended by:
ActiveSupport::Concern
Defined in:
lib/sendgrid_events/action_mailer_override.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sendgrid_email_record_attributes(attrs = nil) ⇒ Object

Returns the value of attribute sendgrid_email_record_attributes.



9
10
11
# File 'lib/sendgrid_events/action_mailer_override.rb', line 9

def sendgrid_email_record_attributes
  @sendgrid_email_record_attributes
end

Instance Method Details

#mail_with_record_email(headers = {}, &block) ⇒ Object



21
22
23
24
25
# File 'lib/sendgrid_events/action_mailer_override.rb', line 21

def mail_with_record_email(headers={}, &block)
  id = SendgridEmailRecord.create_from_headers!(headers, sendgrid_email_record_attributes).id
  uniq_args :sendgrid_events_id => id
  mail_without_record_email headers, &block
end

#uniq_args_with_merge_args(args) ⇒ Object



16
17
18
19
# File 'lib/sendgrid_events/action_mailer_override.rb', line 16

def uniq_args_with_merge_args(args)
  set_args = send_grid_header.data[:unique_args] ||= {}
  uniq_args_without_merge_args set_args.merge(args)
end