Class: Sendgrid::Template
- Inherits:
-
Object
- Object
- Sendgrid::Template
- Defined in:
- lib/sendgrid/template.rb
Instance Attribute Summary collapse
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #get_id(name, locale) ⇒ Object
-
#initialize(templates) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(templates) ⇒ Template
Returns a new instance of Template.
6 7 8 |
# File 'lib/sendgrid/template.rb', line 6 def initialize(templates) @templates = templates end |
Instance Attribute Details
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
4 5 6 |
# File 'lib/sendgrid/template.rb', line 4 def templates @templates end |
Instance Method Details
#get_id(name, locale) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/sendgrid/template.rb', line 10 def get_id(name, locale) [locale, :en].each do |lang| output = @templates.try(:[], name).try(:[], lang) return output if output end raise "No SendGrid template with #{name}, #{locale} nor :en as fallback" end |