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.
34 35 36 |
# File 'lib/sendgrid.rb', line 34 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
49 50 51 52 |
# File 'lib/sendgrid.rb', line 49 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"}
67 68 69 |
# File 'lib/sendgrid.rb', line 67 def (texts) self. = texts end |
#sendgrid_spamcheck_maxscore(score) ⇒ Object
Sets the default spamcheck score text (must be enabled).
72 73 74 |
# File 'lib/sendgrid.rb', line 72 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>" }
60 61 62 |
# File 'lib/sendgrid.rb', line 60 def sendgrid_subscriptiontrack_text(texts) self.default_subscriptiontrack_text = texts end |