Module: Caffeinate::Helpers

Included in:
UrlHelpers
Defined in:
lib/caffeinate/helpers.rb

Overview

URL helpers for accessing the mounted Caffeinate instance.

Instance Method Summary collapse

Instance Method Details

#caffeinate_subscribe_path(subscription, **options) ⇒ Object



20
21
22
# File 'lib/caffeinate/helpers.rb', line 20

def caffeinate_subscribe_path(subscription, **options)
  Caffeinate::Engine.routes.url_helpers.subscribe_campaign_subscription_path(token: subscription.token, **options)
end

#caffeinate_subscribe_url(subscription, **options) ⇒ Object



11
12
13
14
# File 'lib/caffeinate/helpers.rb', line 11

def caffeinate_subscribe_url(subscription, **options)
  opts = (::ActionMailer::Base.default_url_options || {}).merge(options)
  Caffeinate::Engine.routes.url_helpers.subscribe_campaign_subscription_url(token: subscription.token, **opts)
end

#caffeinate_unsubscribe_path(subscription, **options) ⇒ Object



16
17
18
# File 'lib/caffeinate/helpers.rb', line 16

def caffeinate_unsubscribe_path(subscription, **options)
  Caffeinate::Engine.routes.url_helpers.unsubscribe_campaign_subscription_path(token: subscription.token, **options)
end

#caffeinate_unsubscribe_url(subscription, **options) ⇒ Object



6
7
8
9
# File 'lib/caffeinate/helpers.rb', line 6

def caffeinate_unsubscribe_url(subscription, **options)
  opts = (::ActionMailer::Base.default_url_options || {}).merge(options)
  Caffeinate::Engine.routes.url_helpers.unsubscribe_campaign_subscription_url(token: subscription.token, **opts)
end