Module: SendGrid::ClassMethods
- Defined in:
- lib/sendgrid.rb
Instance Method Summary collapse
-
#sendgrid_category(category) ⇒ Object
Sets a default category for all emails.
-
#sendgrid_enable(*options) ⇒ Object
Enables a default option for all emails.
-
#sendgrid_footer_text(texts) ⇒ Object
Sets the default footer text (must be enabled).
-
#sendgrid_spamcheck_maxscore(score) ⇒ Object
Sets the default spamcheck score text (must be enabled).
-
#sendgrid_subscriptiontrack_text(texts) ⇒ Object
Sets the default text for subscription tracking (must be enabled).
Instance Method Details
#sendgrid_category(category) ⇒ Object
Sets a default category for all emails. :use_subject_lines has special behavior that uses the subject-line of each outgoing email for the SendGrid category. This special behavior can still be overridden by calling sendgrid_category from within a mailer method.
42 43 44 45 46 47 |
# File 'lib/sendgrid.rb', line 42 def sendgrid_category(category) if category.length > 0 && (!self.default_sg_category || self.default_sg_category.length < 1) self.default_sg_category = [] end self.default_sg_category.push(category) end |
#sendgrid_enable(*options) ⇒ Object
Enables a default option for all emails. See documentation for details.
Supported options:
-
:opentrack
-
:clicktrack
-
:ganalytics
-
:gravatar
-
:subscriptiontrack
-
:footer
-
:spamcheck
60 61 62 63 |
# File 'lib/sendgrid.rb', line 60 def sendgrid_enable(*) self. = Array.new unless self. .each { |option| self. << option if VALID_OPTIONS.include?(option) } end |
#sendgrid_footer_text(texts) ⇒ Object
Sets the default footer text (must be enabled). Should be a hash containing the html/plain text versions:
{:html => "html version", :plain => "plan text version"}
78 79 80 |
# File 'lib/sendgrid.rb', line 78 def (texts) self. = texts end |
#sendgrid_spamcheck_maxscore(score) ⇒ Object
Sets the default spamcheck score text (must be enabled).
83 84 85 |
# File 'lib/sendgrid.rb', line 83 def sendgrid_spamcheck_maxscore(score) self.default_spamcheck_score = score end |
#sendgrid_subscriptiontrack_text(texts) ⇒ Object
Sets the default text for subscription tracking (must be enabled). There are two options:
-
Add an unsubscribe link at the bottom of the email
{:html => "Unsubscribe <% here %>", :plain => "Unsubscribe here: <% %>"}
-
Replace given text with the unsubscribe link
{:replace => "<unsubscribe_link>" }
71 72 73 |
# File 'lib/sendgrid.rb', line 71 def sendgrid_subscriptiontrack_text(texts) self.default_subscriptiontrack_text = texts end |