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).
-
#sendgrid_unique_args(unique_args = {}) ⇒ Object
Sets unique args at the class level.
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.
51 52 53 |
# File 'lib/sendgrid.rb', line 51 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
66 67 68 69 |
# File 'lib/sendgrid.rb', line 66 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"}
84 85 86 |
# File 'lib/sendgrid.rb', line 84 def (texts) self. = texts end |
#sendgrid_spamcheck_maxscore(score) ⇒ Object
Sets the default spamcheck score text (must be enabled).
89 90 91 |
# File 'lib/sendgrid.rb', line 89 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>" }
77 78 79 |
# File 'lib/sendgrid.rb', line 77 def sendgrid_subscriptiontrack_text(texts) self.default_subscriptiontrack_text = texts end |
#sendgrid_unique_args(unique_args = {}) ⇒ Object
Sets unique args at the class level. Should be a hash of name, value pairs.
{ :some_unique_arg => "some_value"}
96 97 98 |
# File 'lib/sendgrid.rb', line 96 def sendgrid_unique_args(unique_args = {}) self.default_sg_unique_args = unique_args end |