mailkick 0.1.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in mailkick.gemspec
4
- gemspec
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
@@ -1,11 +0,0 @@
1
- module Mailkick
2
- module Mailer
3
- def mail(headers = {}, &block)
4
- message = super
5
-
6
- Mailkick::Processor.new(message).process
7
-
8
- message
9
- end
10
- end
11
- end
@@ -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