lib/mail/notify/delivery_method.rb in mail-notify-0.0.2 vs lib/mail/notify/delivery_method.rb in mail-notify-0.0.3

- old
+ new

@@ -1,38 +1,37 @@ # frozen_string_literal: true module Mail module Notify class DeliveryMethod - attr_accessor :settings + attr_accessor :settings, :response def initialize(settings) @settings = settings end def deliver!(mail) @mail = mail - @personalisation = Personalisation.new(@mail) - initialize_params + @personalisation = Personalisation.new(mail) send_email end private def client @client ||= Notifications::Client.new(@settings[:api_key]) end - def initialize_params - @email_params = { + def email_params + { email_address: @mail.to.first, template_id: @mail[:template_id].to_s, personalisation: @personalisation.to_h } end def send_email - client.send_email(@email_params) + @response = client.send_email(email_params) end end end end