ses_blacklist_rails 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 7b306a0d1afa86638a8c1a4e86436bd771ba8d44
4
- data.tar.gz: f3e670d796026a02ae1c19c73e3baf9f8461470f
3
+ metadata.gz: 7ee23ea37f063312d33037cea7f9ce5c4e33ec64
4
+ data.tar.gz: 49e518db62b66d5d0f31e26a2f6dae174b1ef5d6
5
5
  SHA512:
6
- metadata.gz: 7a64869980ddff162b14458009ca2521643eb1883ce473733cdd8c0f08c7ccd6a750f15ff64b480931179ce0ca0c725c916716eaa99483011c764c6dac13a797
7
- data.tar.gz: 6e3be1e79938e43eb866be0713f5886c84a62af2eee579f3b7bd1e9be936ba0930dc7d15875e59cbf11f0f83958c4547189f49353be0131e8999e3967d079320
6
+ metadata.gz: 160af04f8a01d6938b0bf9e4c65131dc9308757888df88d0d30669ca1887dc4e108fb9e55e5419d30b6460bb7ecd66b13fec40ef0aba5c3251ceec260371e58b
7
+ data.tar.gz: 6e1f55675f4d1a8e27754e7b85db997bf9be79f59de331c45bd89bb922f3016e29f09b54d2c371281ed3a2535562fdfdaec5261157e7419a1a9870cdcfa9959d
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # SesBlacklistRails
2
- Short description and motivation.
2
+ [![Gem Version](https://badge.fury.io/rb/ses_blacklist_rails.svg)](https://badge.fury.io/rb/ses_blacklist_rails)
3
+ [![CircleCI](https://circleci.com/gh/mrdShinse/sns_blacklist_rails/tree/master.svg?style=svg)](https://circleci.com/gh/mrdShinse/sns_blacklist_rails/tree/master)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/4f1e146157fdfacbdde1/maintainability)](https://codeclimate.com/github/mrdShinse/sns_blacklist_rails/maintainability)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/mrdShinse/sns_blacklist_rails.svg)](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
- Notification.create(
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
- Notification.create(
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
- Notification.create(
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
- validate_bounce = ->(email) { SesBlacklistRails::Notification.compliant.find_by(email: email) }
20
- message.to.reject!(validate_bounce)
21
- message.cc.reject!(validate_bounce)
22
- message.bcc.reject!(validate_bounce)
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
- message.to << SesBlacklistRails::Notification.default_address
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
@@ -1,3 +1,3 @@
1
1
  module SesBlacklistRails
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  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.2
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-18 00:00:00.000000000 Z
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,4 +0,0 @@
1
- module SesBlacklistRails
2
- module ApplicationHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module SesBlacklistRails
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module SesBlacklistRails
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end
@@ -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>
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :ses_blacklist_rails do
3
- # # Task goes here
4
- # end