mailkick 0.1.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +72 -11
- data/LICENSE.txt +1 -1
- data/README.md +152 -97
- data/app/controllers/mailkick/subscriptions_controller.rb +41 -20
- data/app/models/mailkick/opt_out.rb +1 -1
- data/app/models/mailkick/subscription.rb +9 -0
- data/app/views/mailkick/subscriptions/show.html.erb +1 -1
- data/config/routes.rb +3 -1
- data/lib/generators/mailkick/install_generator.rb +6 -17
- data/lib/generators/mailkick/templates/install.rb.tt +11 -0
- data/lib/mailkick/engine.rb +13 -5
- data/lib/mailkick/legacy.rb +70 -0
- data/lib/mailkick/model.rb +11 -21
- data/lib/mailkick/service/aws_ses.rb +47 -0
- data/lib/mailkick/service/mailchimp.rb +5 -5
- data/lib/mailkick/service/mailgun.rb +1 -1
- data/lib/mailkick/service/mandrill.rb +6 -2
- data/lib/mailkick/service/postmark.rb +41 -0
- data/lib/mailkick/service/sendgrid.rb +4 -1
- data/lib/mailkick/service/sendgrid_v2.rb +52 -0
- data/lib/mailkick/service.rb +1 -15
- data/lib/mailkick/url_helper.rb +8 -0
- data/lib/mailkick/version.rb +1 -1
- data/lib/mailkick.rb +32 -65
- metadata +21 -39
- data/.gitignore +0 -22
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/app/helpers/mailkick/url_helper.rb +0 -13
- data/lib/generators/mailkick/templates/install.rb +0 -16
- data/lib/mailkick/mailer.rb +0 -11
- data/lib/mailkick/processor.rb +0 -27
- data/mailkick.gemspec +0 -23
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Mailkick
|
2
|
-
module UrlHelper
|
3
|
-
def mailkick_unsubscribe_url
|
4
|
-
Mailkick::Engine.routes.url_helpers.url_for(
|
5
|
-
(ActionMailer::Base.default_url_options || {}).merge(
|
6
|
-
controller: "mailkick/subscriptions",
|
7
|
-
action: "unsubscribe",
|
8
|
-
id: "{{MAILKICK_TOKEN}}"
|
9
|
-
)
|
10
|
-
)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :mailkick_opt_outs do |t|
|
4
|
-
t.string :email
|
5
|
-
t.integer :user_id
|
6
|
-
t.string :user_type
|
7
|
-
t.boolean :active, null: false, default: true
|
8
|
-
t.string :reason
|
9
|
-
t.string :list
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
|
13
|
-
add_index :mailkick_opt_outs, :email
|
14
|
-
add_index :mailkick_opt_outs, [:user_id, :user_type]
|
15
|
-
end
|
16
|
-
end
|
data/lib/mailkick/mailer.rb
DELETED
data/lib/mailkick/processor.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mailkick
|
2
|
-
class Processor
|
3
|
-
attr_reader :message
|
4
|
-
|
5
|
-
def initialize(message)
|
6
|
-
@message = message
|
7
|
-
end
|
8
|
-
|
9
|
-
def process
|
10
|
-
email = message.to.first
|
11
|
-
user = Mailkick.user_method.call(email) if Mailkick.user_method
|
12
|
-
list = message[:mailkick_list].try(:value)
|
13
|
-
if list
|
14
|
-
# remove header
|
15
|
-
message[:mailkick_list] = nil
|
16
|
-
end
|
17
|
-
|
18
|
-
verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
|
19
|
-
token = verifier.generate([email, user.try(:id), user.try(:class).try(:name), list])
|
20
|
-
|
21
|
-
parts = message.parts.any? ? message.parts : [message]
|
22
|
-
parts.each do |part|
|
23
|
-
part.body.raw_source.gsub!(/%7B%7BMAILKICK_TOKEN%7D%7D/, CGI.escape(token))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/mailkick.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "mailkick/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "mailkick"
|
8
|
-
spec.version = Mailkick::VERSION
|
9
|
-
spec.authors = ["Andrew Kane"]
|
10
|
-
spec.email = ["andrew@chartkick.com"]
|
11
|
-
spec.summary = "Email subscriptions made easy"
|
12
|
-
spec.description = "Email subscriptions made easy"
|
13
|
-
spec.homepage = "https://github.com/ankane/mailkick"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
end
|