Class: Nuntius::Subscriber
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Nuntius::Subscriber
- Includes:
- Concerns::Yamlify
- Defined in:
- app/models/nuntius/subscriber.rb
Instance Method Summary collapse
- #email ⇒ Object
- #first_name ⇒ Object
- #last_name ⇒ Object
- #link(campaign, message, tag: true) ⇒ Object
- #name ⇒ Object
- #unsubscribe_link(campaign, message) ⇒ Object
Instance Method Details
#email ⇒ Object
30 31 32 33 34 |
# File 'app/models/nuntius/subscriber.rb', line 30 def email return nuntiable.email if nuntiable.respond_to?(:email) super end |
#first_name ⇒ Object
18 19 20 21 22 |
# File 'app/models/nuntius/subscriber.rb', line 18 def first_name return nuntiable.first_name if nuntiable.respond_to?(:first_name) super end |
#last_name ⇒ Object
24 25 26 27 28 |
# File 'app/models/nuntius/subscriber.rb', line 24 def last_name return nuntiable.last_name if nuntiable.respond_to?(:last_name) super end |
#link(campaign, message, tag: true) ⇒ Object
36 37 38 39 40 |
# File 'app/models/nuntius/subscriber.rb', line 36 def link(campaign, , tag: true) link_text = campaign.["subscriber_url_text"] || I18n.t("subscriber_url_text") url = Nuntius::Engine.routes.url_helpers.subscriber_url(self, host: Nuntius.config.host(), protocol: "https") tag ? "<a href=\"#{url}\" data-nuntius-tracking=\"false\">#{link_text}</a>" : url end |
#name ⇒ Object
14 15 16 |
# File 'app/models/nuntius/subscriber.rb', line 14 def name [first_name, last_name].compact.join(" ").presence || email end |