simply_notify 0.2.3 → 0.2.4
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 +16 -1
- data/lib/generators/notifier_generator.rb +5 -5
- data/lib/simply_notify/version.rb +1 -1
- data/lib/simply_notify.rb +3 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5b4244495f2ac47c52152ec79694745257fd34
|
4
|
+
data.tar.gz: d95a4cdb60ea6fcf69f9d39a166bb1eb17931174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57c11f7cfbd7bfe25d08193ba4044c0ac41865a26cc4c1d9634840fcc3e70fa2555cca40fdfb01ffc5b7b959e4aa4f25438d73bbae4b60afa5b12eccda3f4447
|
7
|
+
data.tar.gz: 4388741dd0e97054231051e609fa0a170bdac345bc0ba4beafa566a448b132c7224a2d13393dbda0a6f5bdfc881fd4f57277f78ac6b09a3dbc9d3cd8598db7b4
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Create the model and views using the generator:
|
|
27
27
|
rails generate notifier
|
28
28
|
|
29
29
|
|
30
|
-
Place a call in the controller
|
30
|
+
Place a call in the controller in which you want notifications to be created. For example, if you want each user to be notified when an assignment is created, use a call such as this:
|
31
31
|
|
32
32
|
@users = User.all
|
33
33
|
@users.each do |u|
|
@@ -35,6 +35,21 @@ Place a call in the controller where notifications should be created to loop thr
|
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
|
+
Add config SMTP code to appropriate environments. For example, sending emails from a gmail account:
|
39
|
+
|
40
|
+
# SMTP Config
|
41
|
+
config.action_mailer.delivery_method = :smtp
|
42
|
+
config.action_mailer.perform_deliveries = true
|
43
|
+
config.action_mailer.smtp_settings = {
|
44
|
+
address: 'smtp.gmail.com',
|
45
|
+
port: 587,
|
46
|
+
domain: 'gmail.com',
|
47
|
+
user_name: 'YOUR_USERNAME@gmail.com',
|
48
|
+
password: 'YOUR_PASSWORD',
|
49
|
+
authentication: 'plain',
|
50
|
+
enable_starttls_auto: true }
|
51
|
+
|
52
|
+
|
38
53
|
## Contributing
|
39
54
|
|
40
55
|
Bug reports and pull requests are welcome on GitHub at https://github.com/tylerlichten/simply_notify.
|
@@ -5,7 +5,7 @@ class NotifierGenerator < Rails::Generators::Base
|
|
5
5
|
desc "This generator creates the Model and Views"
|
6
6
|
|
7
7
|
def create_model_file
|
8
|
-
create_file "app/
|
8
|
+
create_file "app/mailers/notifier.rb", "require 'simply_notify'"
|
9
9
|
end
|
10
10
|
|
11
11
|
def create_html_view_file
|
@@ -16,9 +16,9 @@ class NotifierGenerator < Rails::Generators::Base
|
|
16
16
|
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
|
17
17
|
</head>
|
18
18
|
<body>
|
19
|
-
<h1>Hello
|
19
|
+
<h1>Hello</h1>
|
20
20
|
<p>
|
21
|
-
|
21
|
+
A new assignment has been posted! Please visit the course website.<br>
|
22
22
|
Thanks.<br>
|
23
23
|
</p>
|
24
24
|
</body>
|
@@ -27,8 +27,8 @@ class NotifierGenerator < Rails::Generators::Base
|
|
27
27
|
|
28
28
|
def create_text_view_file
|
29
29
|
create_file "app/views/notifier/new_notification.text.erb",
|
30
|
-
"Hello
|
31
|
-
|
30
|
+
"Hello,
|
31
|
+
A new assignment has been posted! Please visit the course website.
|
32
32
|
Thanks."
|
33
33
|
end
|
34
34
|
end
|
data/lib/simply_notify.rb
CHANGED
@@ -2,12 +2,10 @@ require "simply_notify/version"
|
|
2
2
|
require "action_mailer"
|
3
3
|
|
4
4
|
class Notifier < ActionMailer::Base
|
5
|
-
default from: '
|
5
|
+
default from: 'brandeisapprenticeship@gmail.com'
|
6
6
|
|
7
7
|
def new_notification(recipient)
|
8
|
-
|
9
|
-
|
10
|
-
subject: 'New Notification',
|
11
|
-
content_type: 'text/html')
|
8
|
+
mail(to: recipient,
|
9
|
+
subject: 'New Notification')
|
12
10
|
end
|
13
11
|
end
|