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 |
# File 'lib/sendgrid.rb', line 42 def sendgrid_category(category) self.default_sg_category = 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
57 58 59 60 |
# File 'lib/sendgrid.rb', line 57 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"}
75 76 77 |
# File 'lib/sendgrid.rb', line 75 def (texts) self. = texts end |
#sendgrid_spamcheck_maxscore(score) ⇒ Object
Sets the default spamcheck score text (must be enabled).
80 81 82 |
# File 'lib/sendgrid.rb', line 80 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>" }
68 69 70 |
# File 'lib/sendgrid.rb', line 68 def sendgrid_subscriptiontrack_text(texts) self.default_subscriptiontrack_text = texts end |