createsend-rails 0.4.0 → 0.4.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 +30 -6
- data/lib/createsend-rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58e0513321a67781e305704a3dc01d5bb2c6e92f254035c1677d142147b8049
|
4
|
+
data.tar.gz: 2516a66290fdb2b4c21d73b4fdb511996e7fa6d88cb0c1cfec1abcd1de121e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73d6ee3225d6025e16a06062fc057baffc28ad7ea4be36aeacb0077549d628750cc82f0b85f59ddfcb26578a8babc328e02474c7bc45dfa63e27ea060560563
|
7
|
+
data.tar.gz: 353d27149bee6df0c6c0192ee1bfaaeee9979052f159dead47d7a2ebad749d66322e371274e88a08527ecaaf869abaacb5985992fc91e0bc67b2eba964f63323
|
data/README.md
CHANGED
@@ -22,30 +22,54 @@ config.action_mailer.create_send_settings = {
|
|
22
22
|
api_key: 'INSERT_API_KEY'
|
23
23
|
}
|
24
24
|
```
|
25
|
-
|
25
|
+
|
26
|
+
Once that's done, you can create a simple example Mailer :
|
27
|
+
```ruby
|
28
|
+
class UserMailer < ApplicationMailer
|
29
|
+
def user_registered
|
30
|
+
@user = params[:user]
|
31
|
+
mail to: @user.email
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
Now go into your `views/user_mailer/` and add a `user_registered.json.erb` view, which defines the data attributes required by your Smart Email template. Below is an example of a user activation email. Here, `@user` references the instance variable of the UserMailer we created.
|
26
38
|
|
27
39
|
```json
|
28
40
|
{
|
29
41
|
"smart_email_id": "SMART_EMAIL_ID",
|
30
|
-
"consent_to_track: "yes
|
42
|
+
"consent_to_track: "yes/no/unchanged",
|
31
43
|
"language": "<%= @user.language %>",
|
32
44
|
"name": "<%= @user.name %>",
|
33
|
-
"
|
45
|
+
"token": "<%= @user.confirmation_token %>"
|
34
46
|
}
|
35
47
|
```
|
36
48
|
|
49
|
+
You can now trigger the email from anywhere you want, for example in an `after_create` callback on your User model :
|
50
|
+
```ruby
|
51
|
+
class User < ApplicationRecord
|
52
|
+
after_create :send_activation_mail
|
53
|
+
...
|
54
|
+
|
55
|
+
def send_activation_mail # The user we pass with the method 'with' is the one we receive in the mailer through params[:user]
|
56
|
+
UserMailer.with(user: self).user_registered.deliver_later
|
57
|
+
end
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
37
61
|
## Credits
|
38
62
|
|
39
63
|

|
40
64
|
|
41
|
-
|
65
|
+
Initialy developed by [Made Tech Ltd](https://www.madetech.com/). Key contributions:
|
42
66
|
|
43
67
|
|
44
68
|
* [Andrew Scott](https://github.com/askl56)
|
45
69
|
* [Rory MacDonald](https://github.com/rorymacdonald)
|
46
70
|
* [Seb Ashton](https://github.com/SebAshton)
|
47
|
-
* [Martin Vandersteen](https://github.com/MartinVandersteen)
|
71
|
+
* [Martin Vandersteen](https://github.com/MartinVandersteen) from [Koalect](https://www.koalect.com/)
|
48
72
|
|
49
73
|
|
50
74
|
## License
|
51
|
-
|
75
|
+
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: createsend-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Scott
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-10-
|
12
|
+
date: 2018-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -189,7 +189,8 @@ files:
|
|
189
189
|
- spec/createsend_rails/smart_email_formatter_spec.rb
|
190
190
|
- spec/spec_helper.rb
|
191
191
|
homepage: https://github.com/MartinVandersteen/createsend-rails
|
192
|
-
licenses:
|
192
|
+
licenses:
|
193
|
+
- MIT
|
193
194
|
metadata: {}
|
194
195
|
post_install_message:
|
195
196
|
rdoc_options:
|