Class: SendGrid::Template
- Inherits:
-
Object
- Object
- SendGrid::Template
- Defined in:
- lib/sendgrid/template.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
Instance Method Summary collapse
- #add_recipient(recipient) ⇒ Object
- #add_to_smtpapi(smtpapi) ⇒ Object
-
#initialize(id) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(id) ⇒ Template
7 8 9 10 |
# File 'lib/sendgrid/template.rb', line 7 def initialize(id) @id = id @recipients = [] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/sendgrid/template.rb', line 5 def id @id end |
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
5 6 7 |
# File 'lib/sendgrid/template.rb', line 5 def recipients @recipients end |
Instance Method Details
#add_recipient(recipient) ⇒ Object
12 13 14 |
# File 'lib/sendgrid/template.rb', line 12 def add_recipient(recipient) recipients << recipient end |
#add_to_smtpapi(smtpapi) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sendgrid/template.rb', line 16 def add_to_smtpapi(smtpapi) return if smtpapi.nil? smtpapi.tap do |api| api.add_filter(:templates, :enable, 1) api.add_filter(:templates, :template_id, id) recipients.each { |r| r.add_to_smtpapi(smtpapi) } end end |