ses_blacklist_rails 0.0.2 → 0.0.3
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 +4 -1
- data/app/controllers/ses_blacklist_rails/api/notification_controller.rb +11 -15
- data/lib/ses_blacklist_rails/action_mail_interceptor.rb +9 -5
- data/lib/ses_blacklist_rails/version.rb +1 -1
- metadata +2 -9
- data/app/assets/config/ses_blacklist_rails_manifest.js +0 -1
- data/app/assets/stylesheets/ses_blacklist_rails/application.css +0 -15
- data/app/helpers/ses_blacklist_rails/application_helper.rb +0 -4
- data/app/jobs/ses_blacklist_rails/application_job.rb +0 -4
- data/app/mailers/ses_blacklist_rails/application_mailer.rb +0 -6
- data/app/views/layouts/ses_blacklist_rails/application.html.erb +0 -14
- data/lib/tasks/ses_blacklist_rails_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee23ea37f063312d33037cea7f9ce5c4e33ec64
|
4
|
+
data.tar.gz: 49e518db62b66d5d0f31e26a2f6dae174b1ef5d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 160af04f8a01d6938b0bf9e4c65131dc9308757888df88d0d30669ca1887dc4e108fb9e55e5419d30b6460bb7ecd66b13fec40ef0aba5c3251ceec260371e58b
|
7
|
+
data.tar.gz: 6e1f55675f4d1a8e27754e7b85db997bf9be79f59de331c45bd89bb922f3016e29f09b54d2c371281ed3a2535562fdfdaec5261157e7419a1a9870cdcfa9959d
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# SesBlacklistRails
|
2
|
-
|
2
|
+
[](https://badge.fury.io/rb/ses_blacklist_rails)
|
3
|
+
[](https://circleci.com/gh/mrdShinse/sns_blacklist_rails/tree/master)
|
4
|
+
[](https://codeclimate.com/github/mrdShinse/sns_blacklist_rails/maintainability)
|
5
|
+
[](https://gemnasium.com/github.com/mrdShinse/sns_blacklist_rails)
|
3
6
|
|
4
7
|
## Installation
|
5
8
|
Add this line to your application's `Gemfile`:
|
@@ -10,27 +10,15 @@ module SesBlacklistRails
|
|
10
10
|
case @params[:notificationType]
|
11
11
|
when 'Bounce'
|
12
12
|
@params[:bounce][:bouncedRecipients].each do |r|
|
13
|
-
|
14
|
-
notification_type: Notification.notification_types[:bounce],
|
15
|
-
email: r[:emailAddress],
|
16
|
-
log: @params
|
17
|
-
)
|
13
|
+
create_notification(r, :bounce)
|
18
14
|
end
|
19
15
|
when 'Complaint'
|
20
16
|
@params[:complaint][:complainedRecipients].each do |r|
|
21
|
-
|
22
|
-
notification_type: Notification.notification_types[:complaint],
|
23
|
-
email: r[:emailAddress],
|
24
|
-
log: @params
|
25
|
-
)
|
17
|
+
create_notification(r, :complaint)
|
26
18
|
end
|
27
19
|
when 'Delivery'
|
28
20
|
@params[:delivery][:recipients].each do |r|
|
29
|
-
|
30
|
-
notification_type: Notification.notification_types[:delivery],
|
31
|
-
email: r,
|
32
|
-
log: @params
|
33
|
-
)
|
21
|
+
create_notification(r, :delivery)
|
34
22
|
end
|
35
23
|
end
|
36
24
|
end
|
@@ -40,6 +28,14 @@ module SesBlacklistRails
|
|
40
28
|
def parse_request
|
41
29
|
@params ||= JSON.parse(request.body.read, symbolize_names: true)
|
42
30
|
end
|
31
|
+
|
32
|
+
def create_notification(recipient, type)
|
33
|
+
Notification.create(
|
34
|
+
notification_type: Notification.notification_types[type],
|
35
|
+
email: type == :delivery ? recipient : recipient[:emailAddress],
|
36
|
+
log: @params
|
37
|
+
)
|
38
|
+
end
|
43
39
|
end
|
44
40
|
end
|
45
41
|
end
|
@@ -16,10 +16,10 @@ module SesBlacklistRails
|
|
16
16
|
end
|
17
17
|
|
18
18
|
unless SesBlacklistRails.send_compliant
|
19
|
-
|
20
|
-
message.to.reject!(
|
21
|
-
message.cc.reject!(
|
22
|
-
message.bcc.reject!(
|
19
|
+
validate_compliant = ->(email) { SesBlacklistRails::Notification.compliant.find_by(email: email) }
|
20
|
+
message.to.reject!(validate_compliant)
|
21
|
+
message.cc.reject!(validate_compliant)
|
22
|
+
message.bcc.reject!(validate_compliant)
|
23
23
|
end
|
24
24
|
|
25
25
|
defualt_address!(message) if message.to.blank?
|
@@ -27,7 +27,11 @@ module SesBlacklistRails
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def defualt_address!(message)
|
30
|
-
|
30
|
+
if SesBlacklistRails::Notification.default_address.blank?
|
31
|
+
message.perform_deliveries = false
|
32
|
+
else
|
33
|
+
message.to << SesBlacklistRails::Notification.default_address
|
34
|
+
end
|
31
35
|
message
|
32
36
|
end
|
33
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ses_blacklist_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrdShinse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -68,16 +68,10 @@ files:
|
|
68
68
|
- MIT-LICENSE
|
69
69
|
- README.md
|
70
70
|
- Rakefile
|
71
|
-
- app/assets/config/ses_blacklist_rails_manifest.js
|
72
|
-
- app/assets/stylesheets/ses_blacklist_rails/application.css
|
73
71
|
- app/controllers/ses_blacklist_rails/api/notification_controller.rb
|
74
72
|
- app/controllers/ses_blacklist_rails/application_controller.rb
|
75
|
-
- app/helpers/ses_blacklist_rails/application_helper.rb
|
76
|
-
- app/jobs/ses_blacklist_rails/application_job.rb
|
77
|
-
- app/mailers/ses_blacklist_rails/application_mailer.rb
|
78
73
|
- app/models/ses_blacklist_rails/application_record.rb
|
79
74
|
- app/models/ses_blacklist_rails/notification.rb
|
80
|
-
- app/views/layouts/ses_blacklist_rails/application.html.erb
|
81
75
|
- config/routes.rb
|
82
76
|
- db/migrate/20171116073708_create_ses_blacklist_rails_notifications.rb
|
83
77
|
- lib/generators/ses_blacklist_rails/install_generator.rb
|
@@ -87,7 +81,6 @@ files:
|
|
87
81
|
- lib/ses_blacklist_rails/config.rb
|
88
82
|
- lib/ses_blacklist_rails/engine.rb
|
89
83
|
- lib/ses_blacklist_rails/version.rb
|
90
|
-
- lib/tasks/ses_blacklist_rails_tasks.rake
|
91
84
|
homepage: https://github.com/mrdShinse/ses_blacklist_rails
|
92
85
|
licenses:
|
93
86
|
- MIT
|
@@ -1 +0,0 @@
|
|
1
|
-
//= link_directory ../stylesheets/ses_blacklist_rails .css
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Ses blacklist rails</title>
|
5
|
-
<%= stylesheet_link_tag "ses_blacklist_rails/application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "ses_blacklist_rails/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|