ses_blacklist_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +23 -0
- data/app/assets/config/ses_blacklist_rails_manifest.js +1 -0
- data/app/assets/stylesheets/ses_blacklist_rails/application.css +15 -0
- data/app/controllers/ses_blacklist_rails/api/notification_controller.rb +45 -0
- data/app/controllers/ses_blacklist_rails/application_controller.rb +5 -0
- data/app/helpers/ses_blacklist_rails/application_helper.rb +4 -0
- data/app/jobs/ses_blacklist_rails/application_job.rb +4 -0
- data/app/mailers/ses_blacklist_rails/application_mailer.rb +6 -0
- data/app/models/ses_blacklist_rails/application_record.rb +5 -0
- data/app/models/ses_blacklist_rails/notification.rb +11 -0
- data/app/views/layouts/ses_blacklist_rails/application.html.erb +14 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20171116073708_create_ses_blacklist_rails_notifications.rb +11 -0
- data/lib/ses_blacklist_rails/engine.rb +9 -0
- data/lib/ses_blacklist_rails/version.rb +3 -0
- data/lib/ses_blacklist_rails.rb +5 -0
- data/lib/tasks/ses_blacklist_rails_tasks.rake +4 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: be92ed12a82e9954ed61eafef665d848fe13474d
|
4
|
+
data.tar.gz: 39cae3633e2a92236abe70416dc4aa4194c507b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d8d3b578c9bf7d926d4bec8e817765d55e402b1f03f84f0cf1fd2e3ca55b0f784d40490d562250398116e8ca0418f52d310f0e65b4fd7bb7816424f2d51f1a36
|
7
|
+
data.tar.gz: 041bdfe65479250c5a7cec09a1cb9319aaa3efe3195895b625084a1a4c2322b066d529012dddffc45fcbffd825ca6ab7d12dda0467cf9653a7de1ecf77c79f2b
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 mrdShinse
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# SesBlacklistRails
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'ses_blacklist_rails'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install ses_blacklist_rails
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'SesBlacklistRails'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
require 'bundler/gem_tasks'
|
22
|
+
|
23
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/ses_blacklist_rails .css
|
@@ -0,0 +1,15 @@
|
|
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
|
+
*/
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_dependency 'ses_blacklist_rails/application_controller'
|
2
|
+
|
3
|
+
module SesBlacklistRails
|
4
|
+
module Api
|
5
|
+
class NotificationController < ApplicationController # :nodoc:
|
6
|
+
skip_before_action :verify_authenticity_token
|
7
|
+
before_action :parse_request
|
8
|
+
|
9
|
+
def index
|
10
|
+
case @params[:notificationType]
|
11
|
+
when 'Bounce'
|
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
|
+
)
|
18
|
+
end
|
19
|
+
when 'Complaint'
|
20
|
+
@params[:complaint][:complainedRecipients].each do |r|
|
21
|
+
Notification.create(
|
22
|
+
notification_type: Notification.notification_types[:complaint],
|
23
|
+
email: r[:emailAddress],
|
24
|
+
log: @params
|
25
|
+
)
|
26
|
+
end
|
27
|
+
when 'Delivery'
|
28
|
+
@params[:delivery][:recipients].each do |r|
|
29
|
+
Notification.create(
|
30
|
+
notification_type: Notification.notification_types[:delivery],
|
31
|
+
email: r,
|
32
|
+
log: @params
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def parse_request
|
41
|
+
@params ||= JSON.parse(request.body.read, symbolize_names: true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,14 @@
|
|
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>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateSesBlacklistRailsNotifications < ActiveRecord::Migration[5.1] # :nodoc:
|
2
|
+
def change
|
3
|
+
create_table :ses_notifications do |t|
|
4
|
+
t.integer :notification_type, null: false, default: 0
|
5
|
+
t.string :email, null: false, default: ''
|
6
|
+
t.text :log, null: false, default: ''
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ses_blacklist_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mrdShinse
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.2'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rspec-rails
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sqlite3
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: Handling SES notifications like Bounce or Complaint.
|
62
|
+
email:
|
63
|
+
- shinse.tanaka@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- MIT-LICENSE
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- app/assets/config/ses_blacklist_rails_manifest.js
|
72
|
+
- app/assets/stylesheets/ses_blacklist_rails/application.css
|
73
|
+
- app/controllers/ses_blacklist_rails/api/notification_controller.rb
|
74
|
+
- 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
|
+
- app/models/ses_blacklist_rails/application_record.rb
|
79
|
+
- app/models/ses_blacklist_rails/notification.rb
|
80
|
+
- app/views/layouts/ses_blacklist_rails/application.html.erb
|
81
|
+
- config/routes.rb
|
82
|
+
- db/migrate/20171116073708_create_ses_blacklist_rails_notifications.rb
|
83
|
+
- lib/ses_blacklist_rails.rb
|
84
|
+
- lib/ses_blacklist_rails/engine.rb
|
85
|
+
- lib/ses_blacklist_rails/version.rb
|
86
|
+
- lib/tasks/ses_blacklist_rails_tasks.rake
|
87
|
+
homepage: https://github.com/mrdShinse/ses_blacklist_rails
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.5.1
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: AWS SES blacklist for Rails applications.
|
111
|
+
test_files: []
|