createsend-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0742b57d7f6f0e6d955fbcfd3d18211dde6d7b8e475b0a621131afea61d182bd
4
- data.tar.gz: 1191de843ecab00ded84e2acf137df5b2b3cf47618b2d232485c2054d6f85935
3
+ metadata.gz: d58e0513321a67781e305704a3dc01d5bb2c6e92f254035c1677d142147b8049
4
+ data.tar.gz: 2516a66290fdb2b4c21d73b4fdb511996e7fa6d88cb0c1cfec1abcd1de121e72
5
5
  SHA512:
6
- metadata.gz: f2cac7d5029608c66affc4db3b667e7122bcfb2df3aa53a8aa10d6e8c2f54eb415707b7c62ed01f3a06924a13c78383fa09ef7a869947f768bb0f68d3d947f36
7
- data.tar.gz: e2b283a15be906085b3b2c8ed85adcc99927196af90128deb8e0f0afb71e60e3e1d1dff448746e3aa2c78e196ce40a5788f4b133a2dbc5b75e52420bf5c0921c
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
- Now go into your `views/*_mailer/` and add a `.json.erb` view, which defines the data attributes required by your Smart Email template. Below is an example of a password reset email. (Don't forget to declare the appropriate instance variables in your mailer)
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|no|unchanged",
42
+ "consent_to_track: "yes/no/unchanged",
31
43
  "language": "<%= @user.language %>",
32
44
  "name": "<%= @user.name %>",
33
- "reset_url": "<%= @edit_password_reset_url %>"
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
  ![made](https://s3-eu-west-1.amazonaws.com/made-assets/googleapps/google-apps.png)
40
64
 
41
- Developed and maintained by [Made Tech Ltd](https://www.madetech.com/). Key contributions:
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
- Copyright © 2016 [Made Tech Ltd](https://www.madetech.com/). It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
75
+ It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
@@ -1,3 +1,3 @@
1
1
  module CreatesendRails
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
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.0
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-18 00:00:00.000000000 Z
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: