Class: Brightbytes::Sendgrid::Unsubscribe
- Inherits:
-
Object
- Object
- Brightbytes::Sendgrid::Unsubscribe
- Defined in:
- lib/brightbytes/sendgrid/unsubscribe.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#sendgrid ⇒ Object
readonly
Returns the value of attribute sendgrid.
Class Method Summary collapse
Instance Method Summary collapse
- #add_links ⇒ Object
-
#initialize(sendgrid, message) ⇒ Unsubscribe
constructor
A new instance of Unsubscribe.
Constructor Details
#initialize(sendgrid, message) ⇒ Unsubscribe
Returns a new instance of Unsubscribe.
19 20 21 |
# File 'lib/brightbytes/sendgrid/unsubscribe.rb', line 19 def initialize(sendgrid, ) @sendgrid, @message = sendgrid, end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
17 18 19 |
# File 'lib/brightbytes/sendgrid/unsubscribe.rb', line 17 def @message end |
#sendgrid ⇒ Object (readonly)
Returns the value of attribute sendgrid.
16 17 18 |
# File 'lib/brightbytes/sendgrid/unsubscribe.rb', line 16 def sendgrid @sendgrid end |
Class Method Details
.add_links(sendgrid, message) ⇒ Object
10 11 12 |
# File 'lib/brightbytes/sendgrid/unsubscribe.rb', line 10 def add_links(sendgrid, ) new(sendgrid, ).add_links end |
Instance Method Details
#add_links ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/brightbytes/sendgrid/unsubscribe.rb', line 23 def add_links return unless feature_active? if categories.present? sendgrid.section :unsubscribe, "<a href=\"{{unsubscribe_link}}\">Unsubscribe</a>" emails.each do |email| sendgrid.add_substitute :unsubscribe_link, unsubscribe_link(email) end else sendgrid.section :unsubscribe, '' sendgrid.add_substitute :unsubscribe_link, Array.new(emails.size, '') end end |