ses_api-rails 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -22
- data/lib/ses_api/rails/api.rb +2 -2
- data/lib/ses_api/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4de9daf34f95efa8b7df130f3aa60a03a4ff19a8
|
4
|
+
data.tar.gz: 55dc920bb50c3a435040e9556d3c66a08bd92b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dc9fc30d9186dc9eaea6293447522ef1bd2ffeb7cca7114dbabdce90d4271dc4e20ee39d3d7f36fb78a77c6b0eb82e9443667a1441e092e7e958138e343a14e
|
7
|
+
data.tar.gz: ece94310d777f0ae08604db59014caa008be02fdf4989387c208e3322327a51d7c995b6dd9a35071293c32c84d30a07a927e7aa5a2e24ba79cc0824b9294bb31
|
data/README.md
CHANGED
@@ -4,9 +4,11 @@ Basic SES API integration with Rails specifically for transaction based emails -
|
|
4
4
|
## Install the SES API Rails gem
|
5
5
|
```
|
6
6
|
# Gemfile
|
7
|
-
gem 'ses_api-rails'
|
7
|
+
gem 'ses_api-rails'
|
8
|
+
```
|
9
|
+
```
|
10
|
+
bundle install
|
8
11
|
```
|
9
|
-
`bundle install`
|
10
12
|
|
11
13
|
## High Level Integration Details
|
12
14
|
1. Create an initializer file defining your AWS credentials as constants
|
@@ -54,8 +56,8 @@ gem 'ses_api-rails', git: 'https://github.com/cickes/ses_api-rails.git'
|
|
54
56
|
gem 'figaro'
|
55
57
|
```
|
56
58
|
```
|
57
|
-
|
58
|
-
|
59
|
+
bundle install
|
60
|
+
figaro install
|
59
61
|
```
|
60
62
|
```
|
61
63
|
# config/application.yml
|
@@ -79,23 +81,25 @@ gem 'ses_api-rails', git: 'https://github.com/cickes/ses_api-rails.git'
|
|
79
81
|
3. Create a Mailer that subclasses the SesApi::Rails::Mailer
|
80
82
|
`rails g mailer ContactMailer`
|
81
83
|
If you are only sending email from the Amazon Ses Api, you can subclass the ApplicationMailer. Otherwise subclass the Mailer that will use the Ses delivery method.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
84
|
+
|
85
|
+
Using the Amazon Ses API as the only delivery method application-wide
|
86
|
+
```
|
87
|
+
# app/mailers/application_mailer.rb
|
88
|
+
class ApplicationMailer < SesApi::Rails::Mailer
|
89
|
+
default from: "from@example.com"
|
90
|
+
layout 'mailer'
|
91
|
+
end
|
92
|
+
```
|
93
|
+
```
|
94
|
+
# app/mailers/contact_mailer.rb
|
95
|
+
class ContactMailer < ApplicationMailer
|
96
|
+
...
|
97
|
+
def contact
|
98
|
+
mail to: "you@example.com", subject: "Via Ses"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
99
103
|
Create a mailer view(s)
|
100
104
|
```
|
101
105
|
# app/views/contact_mailer/contact.html.erb
|
@@ -129,5 +133,5 @@ gem 'ses_api-rails', git: 'https://github.com/cickes/ses_api-rails.git'
|
|
129
133
|
Is the library included? One way to do so is to autoload all library sub-directories:
|
130
134
|
`config.autoload_paths += Dir["#{config.root}/lib/**/"]`
|
131
135
|
|
132
|
-
Is the time correct?
|
136
|
+
Is the time correct? Recommend ntp or another time snychronization method.
|
133
137
|
|
data/lib/ses_api/rails/api.rb
CHANGED
@@ -55,8 +55,8 @@ module SesApi
|
|
55
55
|
|
56
56
|
def create_payload
|
57
57
|
to = mail.to.each_with_index.map { |email, i| "&Destination.ToAddresses.member.#{i+1}=#{CGI::escape(email)}"}.join
|
58
|
-
cc = mail.cc.each_with_index.map { |email, i| "&Destination.
|
59
|
-
bcc = mail.bcc.each_with_index.map { |email, i| "&Destination.
|
58
|
+
cc = mail.cc.each_with_index.map { |email, i| "&Destination.CcAddresses.member.#{i+1}=#{CGI::escape(email)}"}.join if mail.cc.present?
|
59
|
+
bcc = mail.bcc.each_with_index.map { |email, i| "&Destination.BccAddresses.member.#{i+1}=#{CGI::escape(email)}"}.join if mail.bcc.present?
|
60
60
|
from = "&Source=#{CGI::escape(mail.from[0])}"
|
61
61
|
subject = "&Message.Subject.Data=#{CGI::escape(mail.subject)}"
|
62
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ses_api-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Ickes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|