ses_blacklist_rails 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/app/models/ses_blacklist_rails/notification.rb +10 -0
- data/lib/generators/templates/ses_blacklist_rails.rb +1 -1
- data/lib/ses_blacklist_rails.rb +12 -5
- data/lib/ses_blacklist_rails/action_mail_interceptor.rb +16 -15
- data/lib/ses_blacklist_rails/config.rb +1 -1
- data/lib/ses_blacklist_rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: edb8ab1818899ae5e658327dc9be87f5bbaa4f15352ad5f13bbf9434664be564
|
4
|
+
data.tar.gz: a772e98108ee7a1f51c504889c158c77da6b87f733188e06c2908866b732ad51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a23f0d10a8820dee53455928f25ba41ba07fb9a950efee9c2bc3a92a87fa0704ad3f2f71e69f93a04558e1a4979b80a31fdf7a3c07d37bd7f8d18c38cde3928
|
7
|
+
data.tar.gz: 8e4f09724df8d274bee1d9633fab5eda0caee77049805c4db0f96c7604dbb496b02a3df705db8fec532571bc51d1384f52e56b42f6aabeba0eae141e11102f63
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ $ bundle exec rails g ses_blacklist_rails:install
|
|
23
23
|
```ruby
|
24
24
|
SesBlacklistRails.configure do |config|
|
25
25
|
config.send_bounce = false
|
26
|
-
config.
|
26
|
+
config.send_complaint = false
|
27
27
|
config.default_address = 'some_address@sample.com'
|
28
28
|
end
|
29
29
|
```
|
@@ -8,5 +8,15 @@ module SesBlacklistRails
|
|
8
8
|
delivery: 2,
|
9
9
|
other: 9
|
10
10
|
}
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def validate_bounce
|
14
|
+
@validate_bounce ||= ->(email) { self.bounce.where(email: email).any? }
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate_complaint
|
18
|
+
@validate_complaint ||= ->(email) { self.complaint.where(email: email).any? }
|
19
|
+
end
|
20
|
+
end
|
11
21
|
end
|
12
22
|
end
|
data/lib/ses_blacklist_rails.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
|
+
require 'ses_blacklist_rails/action_mail_interceptor'
|
1
2
|
require 'ses_blacklist_rails/config'
|
2
3
|
require 'ses_blacklist_rails/engine'
|
3
4
|
|
4
5
|
module SesBlacklistRails # :nodoc:
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
class << self
|
7
|
+
def configure(*)
|
8
|
+
yield config
|
9
|
+
end
|
10
|
+
|
11
|
+
def config
|
12
|
+
@config ||= SesBlacklistRails::Config.new
|
13
|
+
end
|
8
14
|
|
9
|
-
|
10
|
-
|
15
|
+
delegate :send_bounce, to: :config
|
16
|
+
delegate :send_complaint, to: :config
|
17
|
+
delegate :default_address, to: :config
|
11
18
|
end
|
12
19
|
end
|
@@ -8,32 +8,33 @@ module SesBlacklistRails
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def validate!(message)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
unless SesBlacklistRails.
|
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
|
-
end
|
11
|
+
sanitize_destination!(
|
12
|
+
message,
|
13
|
+
SesBlacklistRails::Notification.validate_bounce
|
14
|
+
) unless SesBlacklistRails.send_bounce
|
15
|
+
sanitize_destination!(
|
16
|
+
message,
|
17
|
+
SesBlacklistRails::Notification.validate_complaint
|
18
|
+
) unless SesBlacklistRails.send_complaint
|
24
19
|
|
25
20
|
defualt_address!(message) if message.to.blank?
|
26
21
|
message
|
27
22
|
end
|
28
23
|
|
29
24
|
def defualt_address!(message)
|
30
|
-
if SesBlacklistRails
|
25
|
+
if SesBlacklistRails.default_address.blank?
|
31
26
|
message.perform_deliveries = false
|
32
27
|
else
|
33
|
-
message.to
|
28
|
+
message.to = [SesBlacklistRails.default_address]
|
34
29
|
end
|
35
30
|
message
|
36
31
|
end
|
32
|
+
|
33
|
+
def sanitize_destination!(message, validation)
|
34
|
+
message.to = message.to&.reject! &validation
|
35
|
+
message.cc = message.cc&.reject! &validation
|
36
|
+
message.bcc = message.bcc&.reject! &validation
|
37
|
+
end
|
37
38
|
end
|
38
39
|
end
|
39
40
|
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.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrdShinse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.6
|
104
|
+
rubygems_version: 2.7.6
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: AWS SES blacklist for Rails applications.
|