dcidev_mailer 0.0.13 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +46 -10
- data/lib/dcidev_mailer/mandrill.rb +4 -3
- data/lib/dcidev_mailer/mandrill_template.rb +31 -0
- data/lib/dcidev_mailer/rails_mailer.rb +19 -36
- data/lib/dcidev_mailer.rb +54 -45
- metadata +8 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3f3f6f2bc44b3d45a845f89bc2922dfb527a8a3fd98156b444a46fb1920ef355
         | 
| 4 | 
            +
              data.tar.gz: e395df17cc4a719004e7d58b513aaa8d534032c335b82e34054380c08fa427be
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 26926484cb0021436d5a9f9d74a9927d3220f6bdea7438c9d6ba99ea104c21290fde491c60af8f413772e01df74e79cc12f6e8fa3c54d3879a7716caa9be83fd
         | 
| 7 | 
            +
              data.tar.gz: f82ebb6124f7425de9fc3b2b6bd8e09122f8514b3137dfb7e23ce31dfecf48e99c5e6dd5284f08aead7157ce8e0fce736b7445e9743c57589fe6377e16ab04a0
         | 
    
        data/README.md
    CHANGED
    
    | @@ -30,7 +30,7 @@ Add this to `config/initializer/mailer.rb` | |
| 30 30 | 
             
            ActionMailer::Base.delivery_method = :smtp
         | 
| 31 31 |  | 
| 32 32 | 
             
            # change it to your helper class name
         | 
| 33 | 
            -
            ActionMailer::Base.add_delivery_method: | 
| 33 | 
            +
            ActionMailer::Base.add_delivery_method :mandrill_mailer, MandrillMailer
         | 
| 34 34 |  | 
| 35 35 | 
             
            # uncomment if neccessary
         | 
| 36 36 | 
             
            smtp_settings = {
         | 
| @@ -63,9 +63,9 @@ ActionMailer::Base.raise_delivery_errors = true | |
| 63 63 | 
             
            ActionMailer::Base.perform_deliveries = true
         | 
| 64 64 | 
             
            ActionMailer::Base.perform_caching = false
         | 
| 65 65 |  | 
| 66 | 
            -
            MandrillMailer.configure do |config | 
| 66 | 
            +
            MandrillMailer.configure do |config|
         | 
| 67 67 | 
             
                config.api_key = ENV["MANDRILL_SMTP_PASSWORD"]
         | 
| 68 | 
            -
                config.deliver_later_queue_name  | 
| 68 | 
            +
                config.deliver_later_queue_name :default
         | 
| 69 69 | 
             
            end
         | 
| 70 70 | 
             
            ```
         | 
| 71 71 |  | 
| @@ -82,25 +82,61 @@ class MandrillMailer | |
| 82 82 | 
             
              class << self
         | 
| 83 83 | 
             
                def send_email(customer: nil, email_template: nil, attachments: nil, description: nil)
         | 
| 84 84 | 
             
                    raise "invalid customer"if customer.nil?
         | 
| 85 | 
            -
                    raise "invalid template" if email_template.nil | 
| 85 | 
            +
                    raise "invalid template" if email_template.nil?
         | 
| 86 86 | 
             
                    begin
         | 
| 87 87 | 
             
                        response = ::DcidevMailer::Mandrill.send_email(
         | 
| 88 88 | 
             
                            subject: email_template.subject,
         | 
| 89 89 | 
             
                            html_body: MailerHelper.format_wording(email_template.wording, customer),
         | 
| 90 | 
            -
                            header_url: email_template.header.try(: | 
| 91 | 
            -
                            footer_url: email_template.footer.try(: | 
| 92 | 
            -
                            to: customer.email | 
| 90 | 
            +
                            header_url: email_template.header.try(:url),
         | 
| 91 | 
            +
                            footer_url: email_template.footer.try(:url),
         | 
| 92 | 
            +
                            # to: customer.email / can also accept string
         | 
| 93 | 
            +
                            to: [{name: "Punto Damar P", type: "to", email: "punto@privyid.tech"}],
         | 
| 93 94 | 
             
                            cc: nil, # can be a string / array
         | 
| 94 95 | 
             
                            bcc: nil, # can be a string / array
         | 
| 95 96 | 
             
                            from: ENV['DEFAULT_EMAIL_SENDER'],
         | 
| 97 | 
            +
                            from_name: ENV['DEFAULT_EMAIL_SENDER_NAME'],
         | 
| 96 98 | 
             
                            attachments: attachments,
         | 
| 97 99 | 
             
                            email_template_path: "mail/blast.html.erb"
         | 
| 98 100 | 
             
                            # specify template file location
         | 
| 99 101 | 
             
                        )
         | 
| 100 102 | 
             
                    rescue => e
         | 
| 101 | 
            -
                        error_message = "[SEND EMAIL] " + e.try(: | 
| 103 | 
            +
                        error_message = "[SEND EMAIL] " + e.try(:to_s)
         | 
| 102 104 | 
             
                    ensure
         | 
| 103 | 
            -
                         EmailHistory.create(application: customer.application, template: email_template, status: response[0]["status"] == "sent" ? : | 
| 105 | 
            +
                         EmailHistory.create(application: customer.application, template: email_template, status: response[0]["status"] == "sent" ? :sent : :failed, mail_provider_id: response[0]["_id"], form_cetak_attachment: attachments.present?, error_message: response[0]["reject_reason"]) if response.present?
         | 
| 106 | 
            +
                         ApplicationHistory.log(description: error_message || description, application: customer.application)
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
              end 
         | 
| 109 | 
            +
            end
         | 
| 110 | 
            +
            ```
         | 
| 111 | 
            +
             | 
| 112 | 
            +
             | 
| 113 | 
            +
            ### Mandrill Template Example
         | 
| 114 | 
            +
            ```ruby
         | 
| 115 | 
            +
            require 'dcidev_mailer/mandrill_template'
         | 
| 116 | 
            +
             | 
| 117 | 
            +
            class MandrillMailer
         | 
| 118 | 
            +
              class << self
         | 
| 119 | 
            +
                def send_email(customer: nil, email_template: nil, attachments: nil, description: nil)
         | 
| 120 | 
            +
                    raise "invalid customer"if customer.nil?
         | 
| 121 | 
            +
                    raise "invalid template" if email_template.nil?
         | 
| 122 | 
            +
                    begin
         | 
| 123 | 
            +
                        response = ::DcidevMailer::MandrillTemplate.send_email(
         | 
| 124 | 
            +
                            subject: email_template.subject,
         | 
| 125 | 
            +
                            header_url: email_template.header.try(:url),
         | 
| 126 | 
            +
                            footer_url: email_template.footer.try(:url),
         | 
| 127 | 
            +
                            template_name: 'customer blast',
         | 
| 128 | 
            +
                            to: [{name: "Punto Damar P", type: "to", email: "punto@privyid.tech"}],
         | 
| 129 | 
            +
                            vars: {customer_name: "Punto Damar P", bank_name: "Bang Jago"}, # template variable name configurable from mandrill dashboard
         | 
| 130 | 
            +
                            cc: nil, # can be a string / array
         | 
| 131 | 
            +
                            bcc: nil, # can be a string / array
         | 
| 132 | 
            +
                            from: ENV['DEFAULT_EMAIL_SENDER'],
         | 
| 133 | 
            +
                            from_name: ENV['DEFAULT_EMAIL_SENDER_NAME'],
         | 
| 134 | 
            +
                            attachments: attachments,
         | 
| 135 | 
            +
                        )
         | 
| 136 | 
            +
                    rescue => e
         | 
| 137 | 
            +
                        error_message = "[SEND EMAIL] " + e.try(:to_s)
         | 
| 138 | 
            +
                    ensure
         | 
| 139 | 
            +
                         EmailHistory.create(application: customer.application, template: email_template, status: response[0]["status"] == "sent" ? :sent : :failed, mail_provider_id: response[0]["_id"], form_cetak_attachment: attachments.present? , error_message : response[0]["reject_reason"]) if response.present?
         | 
| 104 140 | 
             
                         ApplicationHistory.log(description: error_message || description, application: customer.application)
         | 
| 105 141 | 
             
                  end
         | 
| 106 142 | 
             
              end 
         | 
| @@ -133,7 +169,7 @@ class MortgageMailer | |
| 133 169 | 
             
                                subject: template.subject,  
         | 
| 134 170 | 
             
                                from: ENV['DEFAULT_EMAIL_SENDER'],  
         | 
| 135 171 | 
             
                                template_path: "mail/blast.html.erb"  # specify template file location
         | 
| 136 | 
            -
                            ).deliver_now  
         | 
| 172 | 
            +
                            ).deliver_now!  
         | 
| 137 173 | 
             
                        rescue => e  
         | 
| 138 174 | 
             
                            error_message = "[SEND EMAIL] " + e.try(:to_s)  
         | 
| 139 175 | 
             
                        ensure  
         | 
| @@ -5,19 +5,20 @@ module DcidevMailer | |
| 5 5 | 
             
                    default from: ENV['DEFAULT_EMAIL_SENDER']
         | 
| 6 6 |  | 
| 7 7 | 
             
                    class << self
         | 
| 8 | 
            -
                        def send_email(subject: '', html_body: '', to: nil, cc: nil, bcc: nil, from: nil, attachments: nil, email_template_path: '', header_url: '', footer_url: '')
         | 
| 8 | 
            +
                        def send_email(subject: '', html_body: '', to: nil, cc: nil, bcc: nil, from: nil, from_name: nil, attachments: nil, email_template_path: '', header_url: '', footer_url: '')
         | 
| 9 9 | 
             
                            ac = ActionController::Base.new
         | 
| 10 10 | 
             
                            wording, images = DcidevMailer.format_image_from_html(html_body)
         | 
| 11 11 | 
             
                            locals = { wording: wording, header: nil, footer: nil }
         | 
| 12 12 | 
             
                            locals, images = DcidevMailer.format_header_footer(header_url: header_url, footer_url: footer_url, locals: locals, images: images) if header_url.present? && footer_url.present?
         | 
| 13 13 | 
             
                            html_body = ac.render_to_string(template: email_template_path, locals: locals)
         | 
| 14 14 | 
             
                            attachments = DcidevMailer.format_attachments(attachments) if attachments.present?
         | 
| 15 | 
            -
                            self.send_mail(subject, to, cc, bcc, html_body, attachments, images, from).deliver_now
         | 
| 15 | 
            +
                            self.send_mail(subject, to, cc, bcc, html_body, attachments, images, from, from_name).deliver_now
         | 
| 16 16 | 
             
                        end
         | 
| 17 17 |  | 
| 18 | 
            -
                        def send_mail(subject, to, cc, bcc, html, attachments = nil, images = nil, from = nil)
         | 
| 18 | 
            +
                        def send_mail(subject, to, cc, bcc, html, attachments = nil, images = nil, from = nil, from_name = nil)
         | 
| 19 19 | 
             
                            mandrill_mail subject: subject,
         | 
| 20 20 | 
             
                                          from: from,
         | 
| 21 | 
            +
                                          from_name: from_name,
         | 
| 21 22 | 
             
                                          # to: "dev.puntodamar@gmail.com",
         | 
| 22 23 | 
             
                                          to: to,
         | 
| 23 24 | 
             
                                          cc: cc,
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            require 'mandrill'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module DcidevMailer
         | 
| 4 | 
            +
                class MandrillTemplate < MandrillMailer::TemplateMailer
         | 
| 5 | 
            +
                    default from: ENV['DEFAULT_EMAIL_SENDER']
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                    class << self
         | 
| 8 | 
            +
                        def send_email(subject: '', to: nil, cc: nil, bcc: nil, from: nil, from_name: nil, attachments: nil, vars: nil, template_name: nil, images: nil)
         | 
| 9 | 
            +
                            raise DcidevMailer::Errors::InvalidTemplate unless template_name.present?
         | 
| 10 | 
            +
                            images = DcidevMailer.format_images(images) if images.present?
         | 
| 11 | 
            +
                            attachments = DcidevMailer.format_attachments(attachments) if attachments.present?
         | 
| 12 | 
            +
                            self.send_mail(subject, to, cc, bcc, attachments, images, from, from_name, template_name, vars).deliver_now
         | 
| 13 | 
            +
                        end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                        def send_mail(subject, to, cc, bcc, attachments = nil, images = nil, from = nil, from_name = nil, template_name = nil, vars = nil)
         | 
| 16 | 
            +
                            mandrill_mail subject: subject,
         | 
| 17 | 
            +
                                          from: from,
         | 
| 18 | 
            +
                                          from_name: from_name,
         | 
| 19 | 
            +
                                          to: to,
         | 
| 20 | 
            +
                                          cc: cc,
         | 
| 21 | 
            +
                                          bcc: bcc,
         | 
| 22 | 
            +
                                          important: true,
         | 
| 23 | 
            +
                                          inline_css: true,
         | 
| 24 | 
            +
                                          attachments: attachments,
         | 
| 25 | 
            +
                                          images: images,
         | 
| 26 | 
            +
                                          template_name: template_name,
         | 
| 27 | 
            +
                                          vars: vars
         | 
| 28 | 
            +
                        end
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
            end
         | 
| @@ -5,6 +5,7 @@ require 'mail' | |
| 5 5 | 
             
            require 'dcidev_mailer/errors/invalid_recipients'
         | 
| 6 6 | 
             
            require 'dcidev_mailer/errors/invalid_body'
         | 
| 7 7 | 
             
            require 'dcidev_mailer/errors/invalid_template'
         | 
| 8 | 
            +
             | 
| 8 9 | 
             
            module DcidevMailer
         | 
| 9 10 | 
             
              class RailsMailer < ActionMailer::Base
         | 
| 10 11 |  | 
| @@ -15,7 +16,7 @@ module DcidevMailer | |
| 15 16 | 
             
                  wording, images = DcidevMailer.format_image_from_html(html_body)
         | 
| 16 17 |  | 
| 17 18 | 
             
                  locals = { wording: wording, header: nil, footer: nil }
         | 
| 18 | 
            -
                  locals,  | 
| 19 | 
            +
                  locals, _ = DcidevMailer.format_header_footer(header_url: header_url, footer_url: footer_url, locals: locals, images: images) if header_url.present? || footer_url.present?
         | 
| 19 20 |  | 
| 20 21 | 
             
                  file_attachments = DcidevMailer.format_attachments(file_attachments) if file_attachments.present?
         | 
| 21 22 | 
             
                  if file_attachments.present?
         | 
| @@ -24,8 +25,23 @@ module DcidevMailer | |
| 24 25 | 
             
                    end
         | 
| 25 26 | 
             
                  end
         | 
| 26 27 |  | 
| 27 | 
            -
                   | 
| 28 | 
            -
             | 
| 28 | 
            +
                  begin
         | 
| 29 | 
            +
                    header_file = File.read(DcidevUtility.download_to_file(header_url))
         | 
| 30 | 
            +
                    header_mime = MimeMagic.by_magic(header_file)
         | 
| 31 | 
            +
                    attachments.inline['header'] = header_file
         | 
| 32 | 
            +
                    attachments.inline['header']['content-type'] = header_mime
         | 
| 33 | 
            +
                    attachments.inline['header']['content-id'] = '<header>'
         | 
| 34 | 
            +
                  rescue => _
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  begin
         | 
| 38 | 
            +
                    footer_file = File.read(DcidevUtility.download_to_file(footer_url))
         | 
| 39 | 
            +
                    footer_mime = MimeMagic.by_magic(footer_file)
         | 
| 40 | 
            +
                    attachments.inline['footer'] = footer_file
         | 
| 41 | 
            +
                    attachments.inline['footer']['content-type'] = footer_mime
         | 
| 42 | 
            +
                    attachments.inline['footer']['content-id'] = '<footer>'
         | 
| 43 | 
            +
                  rescue => _
         | 
| 44 | 
            +
                  end
         | 
| 29 45 |  | 
| 30 46 | 
             
                  mail(
         | 
| 31 47 | 
             
                    to: to,
         | 
| @@ -43,38 +59,5 @@ module DcidevMailer | |
| 43 59 | 
             
                    }
         | 
| 44 60 | 
             
                  end
         | 
| 45 61 | 
             
                end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
                # def self.method_missing(method_name, html_body: "", header_url: "", footer_url: "", file_attachments: nil, to: nil, cc: nil, bcc: nil, from: nil, subject: "")
         | 
| 49 | 
            -
                #   raise DcidevMailer::Errors::InvalidRecipients unless to.present?
         | 
| 50 | 
            -
                #   raise DcidevMailer::Errors::InvalidBody unless html_body.present? && html_body.is_a?(String)
         | 
| 51 | 
            -
                #   wording, images = DcidevMailer.format_image_from_html(html_body)
         | 
| 52 | 
            -
                #
         | 
| 53 | 
            -
                #   locals = { wording: wording, header: nil, footer: nil }
         | 
| 54 | 
            -
                #   locals, images = DcidevMailer.format_header_footer(header_url: header_url, footer_url: footer_url, locals: locals, images: images) if header_url.present? && footer_url.present?
         | 
| 55 | 
            -
                #
         | 
| 56 | 
            -
                #   if file_attachments.present?
         | 
| 57 | 
            -
                #     file_attachments.each do |a|
         | 
| 58 | 
            -
                #       am.attachments[a[:name].to_s] = a[:content] unless a[:content].nil?
         | 
| 59 | 
            -
                #     end
         | 
| 60 | 
            -
                #   end
         | 
| 61 | 
            -
                #
         | 
| 62 | 
            -
                #   attachments.inline['header'] = File.read(Utility.download_to_file(header_url)) rescue nil if header_url.present?
         | 
| 63 | 
            -
                #   attachments.inline['footer'] = File.read(Utility.download_to_file(footer_url)) rescue nil if footer_url.present?
         | 
| 64 | 
            -
                #
         | 
| 65 | 
            -
                #   mail(
         | 
| 66 | 
            -
                #     to: to,
         | 
| 67 | 
            -
                #     cc: cc,
         | 
| 68 | 
            -
                #     bcc: bcc,
         | 
| 69 | 
            -
                #     subject: subject,
         | 
| 70 | 
            -
                #     format: "text/html",
         | 
| 71 | 
            -
                #     from: from,
         | 
| 72 | 
            -
                #   ) do |format|
         | 
| 73 | 
            -
                #     format.html {
         | 
| 74 | 
            -
                #       render locals: locals
         | 
| 75 | 
            -
                #     }
         | 
| 76 | 
            -
                #   end
         | 
| 77 | 
            -
                # end
         | 
| 78 | 
            -
             | 
| 79 62 | 
             
              end
         | 
| 80 63 | 
             
            end
         | 
    
        data/lib/dcidev_mailer.rb
    CHANGED
    
    | @@ -1,52 +1,61 @@ | |
| 1 1 | 
             
            module DcidevMailer
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 2 | 
            +
                class << self
         | 
| 3 | 
            +
                    def format_image_from_html(html)
         | 
| 4 | 
            +
                        
         | 
| 5 | 
            +
                        images = []
         | 
| 6 | 
            +
                        body_html = Nokogiri::HTML(html)
         | 
| 7 | 
            +
                        temp = body_html
         | 
| 8 | 
            +
                        if ENV["USE_MANDRILL_MAILER"].to_i == 1
         | 
| 9 | 
            +
                            temp.search("img").each_with_index do |img, i|
         | 
| 10 | 
            +
                                cid = "body_image_#{i}"
         | 
| 11 | 
            +
                                images.push({ content: nil, encoded_content: DcidevUtility.base64_encoded_string(img["src"]), type: DcidevUtility.base64_extension(img["src"]), name: cid })
         | 
| 12 | 
            +
                                body_html.search("img")[i]["src"] = 'cid:' + cid
         | 
| 13 | 
            +
                            end
         | 
| 14 | 
            +
                        end
         | 
| 15 | 
            +
                        [body_html.search("body")[0].children.to_html, images]
         | 
| 13 16 | 
             
                    end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
                     | 
| 23 | 
            -
                     | 
| 24 | 
            -
                     | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                      extension, encoded, _ = DcidevUtility.file_url_to_base64(i[:url])
         | 
| 40 | 
            -
                      locals[i[:name].to_sym] = "cid:#{i[:name]}"
         | 
| 41 | 
            -
                      images.push({content: encoded, encoded_content: encoded, type: extension, name: i[:name]})
         | 
| 42 | 
            -
                    rescue => _
         | 
| 43 | 
            -
             | 
| 17 | 
            +
                    
         | 
| 18 | 
            +
                    def format_images(images)
         | 
| 19 | 
            +
                        formatted = []
         | 
| 20 | 
            +
                        images.each do |i|
         | 
| 21 | 
            +
                            base64 = Base64.encode64(i[:image])
         | 
| 22 | 
            +
                            formatted << {encoded_content: DcidevUtility.base64_encoded_string(base64), type: DcidevUtility.base64_extension(base64), name: i[:name]}
         | 
| 23 | 
            +
                        end
         | 
| 24 | 
            +
                        return formatted
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                    
         | 
| 27 | 
            +
                    def format_attachments(attachments)
         | 
| 28 | 
            +
                        formatted = []
         | 
| 29 | 
            +
                        attachments.each do |a|
         | 
| 30 | 
            +
                            filetype = MimeMagic.by_magic(a[:file]).type.to_s
         | 
| 31 | 
            +
                            content = a[:file].read
         | 
| 32 | 
            +
                            name = "#{a[:filename]}.#{filetype.split("/")[1]}"
         | 
| 33 | 
            +
                            att = {
         | 
| 34 | 
            +
                                content: content,
         | 
| 35 | 
            +
                                name: name,
         | 
| 36 | 
            +
                            }
         | 
| 37 | 
            +
                            
         | 
| 38 | 
            +
                            att[:type] = filetype if ENV["USE_MANDRILL_MAILER"].to_i == 0
         | 
| 39 | 
            +
                            formatted << att
         | 
| 40 | 
            +
                        end
         | 
| 41 | 
            +
                        formatted
         | 
| 44 42 | 
             
                    end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 43 | 
            +
                    
         | 
| 44 | 
            +
                    def format_header_footer(header_url: "", footer_url: "", locals: {}, images: {})
         | 
| 45 | 
            +
                        [{ name: "header", url: header_url }, { name: "footer", url: footer_url }].each do |i|
         | 
| 46 | 
            +
                            return if i[:url].nil?
         | 
| 47 | 
            +
                            begin
         | 
| 48 | 
            +
                                extension, encoded, _ = DcidevUtility.file_url_to_base64(i[:url])
         | 
| 49 | 
            +
                                locals[i[:name].to_sym] = "cid:#{i[:name]}"
         | 
| 50 | 
            +
                                images.push({ content: encoded, encoded_content: encoded, type: extension, name: i[:name] })
         | 
| 51 | 
            +
                            rescue => _
         | 
| 52 | 
            +
                            
         | 
| 53 | 
            +
                            end
         | 
| 54 | 
            +
                        end
         | 
| 55 | 
            +
                        return [locals, images]
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
                
         | 
| 47 58 | 
             
                end
         | 
| 48 59 |  | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
             | 
| 51 60 | 
             
            end
         | 
| 52 61 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: dcidev_mailer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.16
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Punto Damar P
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-04-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: mimemagic
         | 
| @@ -51,11 +51,12 @@ files: | |
| 51 51 | 
             
            - lib/dcidev_mailer/errors/invalid_recipients.rb
         | 
| 52 52 | 
             
            - lib/dcidev_mailer/errors/invalid_template.rb
         | 
| 53 53 | 
             
            - lib/dcidev_mailer/mandrill.rb
         | 
| 54 | 
            +
            - lib/dcidev_mailer/mandrill_template.rb
         | 
| 54 55 | 
             
            - lib/dcidev_mailer/rails_mailer.rb
         | 
| 55 | 
            -
            homepage:
         | 
| 56 | 
            +
            homepage: 
         | 
| 56 57 | 
             
            licenses: []
         | 
| 57 58 | 
             
            metadata: {}
         | 
| 58 | 
            -
            post_install_message:
         | 
| 59 | 
            +
            post_install_message: 
         | 
| 59 60 | 
             
            rdoc_options: []
         | 
| 60 61 | 
             
            require_paths:
         | 
| 61 62 | 
             
            - lib
         | 
| @@ -70,8 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 70 71 | 
             
                - !ruby/object:Gem::Version
         | 
| 71 72 | 
             
                  version: '0'
         | 
| 72 73 | 
             
            requirements: []
         | 
| 73 | 
            -
            rubygems_version: 3.0. | 
| 74 | 
            -
            signing_key:
         | 
| 74 | 
            +
            rubygems_version: 3.0.3.1
         | 
| 75 | 
            +
            signing_key: 
         | 
| 75 76 | 
             
            specification_version: 4
         | 
| 76 77 | 
             
            summary: Commonly used email codes
         | 
| 77 78 | 
             
            test_files: []
         |