class Sendgrid::Template

Attributes

templates[R]

Public Class Methods

new(templates) click to toggle source
# File lib/sendgrid/template.rb, line 6
def initialize(templates)
  @templates = templates
end

Public Instance Methods

get_id(name, locale) click to toggle source
# 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