Sha256: cf31bbf2fdaea9f72cbc85257ed66785abcd0005d716ebbef2ff16291ed631b8

Contents?: true

Size: 490 Bytes

Versions: 5

Compression:

Stored size: 490 Bytes

Contents

module Mailkick
  module UrlHelper
    def mailkick_unsubscribe_url(email: nil, user: nil, list: nil, **options)
      email ||= controller.try(:message).try(:to).try(:first)

      Mailkick::Engine.routes.url_helpers.url_for(
        (ActionMailer::Base.default_url_options || {}).merge(options).merge(
          controller: "mailkick/subscriptions",
          action: "unsubscribe",
          id: Mailkick.generate_token(email, user: user, list: list)
        )
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mailkick-0.4.3 lib/mailkick/url_helper.rb
mailkick-0.4.2 lib/mailkick/url_helper.rb
mailkick-0.4.1 app/helpers/mailkick/url_helper.rb
mailkick-0.4.0 app/helpers/mailkick/url_helper.rb
mailkick-0.3.1 app/helpers/mailkick/url_helper.rb