-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Gem with additional Template and Recipient Functionality (round 2) #28
Commits on Oct 19, 2015
-
Jake Yesbeck committed
Oct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for a129e27 - Browse repository at this point
Copy the full SHA a129e27View commit details -
This will add filters to the smtpapi gem: https://github.com/sendgrid/smtpapi-ruby The template_id will be passed in like other attributes to mail Example: ``` mail = SendGrid::Mail.new do |m| m.to = '[email protected]' m.from = '[email protected]' m.subject = 'Hello world!' m.text = 'I heard you like pineapple.' m.template_id = 1234 end ```
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for ce97bb1 - Browse repository at this point
Copy the full SHA ce97bb1View commit details -
To help encapsulate the substitution logic for templates and how they correlate with email recipients, this model has been introduced. The benefit is now something like this is possible: ```ruby template = Template.new(TEMPLATE_ID) users = User.find(['[email protected]', '[email protected]']) users.each do |user| recipient = Recipient.new(user) recipient.add_substitution(:name, user.name) recipient.add_substitution(:location, user.location) template.add_recipient(recipient) end ``` The next step will be to integrate the `Recipient` and `Template` with `Mail`.
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 942bea1 - Browse repository at this point
Copy the full SHA 942bea1View commit details -
Wrong variable names for x-smtpapi header
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 417d012 - Browse repository at this point
Copy the full SHA 417d012View commit details -
Fail on initialization instead of silently on output
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 88a1bf3 - Browse repository at this point
Copy the full SHA 88a1bf3View commit details -
Bug with substitution calling in template and change to association
This will add an accessor for the template without an initialization through a template_id
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 0a82049 - Browse repository at this point
Copy the full SHA 0a82049View commit details -
Jake Yesbeck committed
Oct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 9970702 - Browse repository at this point
Copy the full SHA 9970702View commit details -
This is the final piece of abstracting recipients, templates and the sending of mail. The use of this would look like: ```ruby users = User.where(email: ['[email protected]', '[email protected]']) recipients = [] users.each do |user| recipient = SendGrid::Recipient.new(user.email) recipient.add_substitution('first_name', user.first_name) recipient.add_substitution('city', user.city) recipients << recipient end template = SendGrid::Template.new('MY_TEMPLATE_ID') client = SendGrid::Client.new(api_user: my_user, api_key: my_key) mail_defaults = { from: '[email protected]', html: '<h1>I like email</h1>', text: 'I like email' subject: 'Email is great', } mailer = TemplateMailer.new(client, template, recipients) mailer.mail(mail_defaults) ```
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for aa93e11 - Browse repository at this point
Copy the full SHA aa93e11View commit details -
Make sure substitutions are not constantly overwritten
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 0ad3426 - Browse repository at this point
Copy the full SHA 0ad3426View commit details -
Explanitory comment about how to use template mailer
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for dbb4454 - Browse repository at this point
Copy the full SHA dbb4454View commit details -
Update README to remove employee who no longer works at SendGrid
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for ebe0dcf - Browse repository at this point
Copy the full SHA ebe0dcfView commit details -
Update README with new Template pattern
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 531c748 - Browse repository at this point
Copy the full SHA 531c748View commit details -
Make spec suite pass with two code paths together
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 9163914 - Browse repository at this point
Copy the full SHA 9163914View commit details -
Conform to new require pattern
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for e92ebd8 - Browse repository at this point
Copy the full SHA e92ebd8View commit details -
Enable use of template with Mail object
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 3bd805f - Browse repository at this point
Copy the full SHA 3bd805fView commit details -
New spec asserting initialize can take a block
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for c02d195 - Browse repository at this point
Copy the full SHA c02d195View commit details -
Update README with additional template usages
Jake Yesbeck committedOct 19, 2015 Configuration menu - View commit details
-
Copy full SHA for 439f899 - Browse repository at this point
Copy the full SHA 439f899View commit details