ahoy_email 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +17 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/README.md +2 -0
- data/ahoy_email.gemspec +1 -1
- data/app/models/ahoy/message.rb +1 -1
- data/lib/ahoy_email.rb +4 -2
- data/lib/ahoy_email/engine.rb +1 -0
- data/lib/ahoy_email/processor.rb +3 -3
- data/lib/ahoy_email/version.rb +1 -1
- data/test/gemfiles/actionmailer42.gemfile +6 -0
- data/test/test_helper.rb +2 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 896fbfeee3ad98de6957deb50df361b61ba3d7a5
|
4
|
+
data.tar.gz: 42a4024bee8e9d3628795ba5637ebaf605bc0fad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cfcc41e31deee1f91e43cd0cf9b1b5305e472e497be81d08eb87fc764fcfc7b8425e3bdbfc4ef3f00bf3898e56de98d6c1128b88550dde436248b47089eb115
|
7
|
+
data.tar.gz: dd28e360cda8635058214b7282b59131bc73f4885fed85fe5be0bc73e2467252386f4e5c103238cb34e931a71a22f1f18dd704da227b6c6e0241885e5f372518
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.3.0
|
4
|
+
sudo: false
|
5
|
+
script: RUBYOPT=W0 bundle exec rake test
|
6
|
+
before_script:
|
7
|
+
- gem install bundler
|
8
|
+
notifications:
|
9
|
+
email:
|
10
|
+
on_success: never
|
11
|
+
on_failure: change
|
12
|
+
gemfile:
|
13
|
+
- Gemfile
|
14
|
+
- test/gemfiles/actionmailer42.gemfile
|
15
|
+
- test/gemfiles/actionmailer41.gemfile
|
16
|
+
- test/gemfiles/actionmailer40.gemfile
|
17
|
+
- test/gemfiles/actionmailer32.gemfile
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -14,6 +14,8 @@ Works with any email service.
|
|
14
14
|
|
15
15
|
:fire: To track visits and events, check out [Ahoy](https://github.com/ankane/ahoy)
|
16
16
|
|
17
|
+
[![Build Status](https://travis-ci.org/ankane/ahoy_email.svg?branch=master)](https://travis-ci.org/ankane/ahoy_email)
|
18
|
+
|
17
19
|
## Installation
|
18
20
|
|
19
21
|
Add this line to your application’s Gemfile:
|
data/ahoy_email.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "rails"
|
22
22
|
spec.add_runtime_dependency "addressable"
|
23
23
|
spec.add_runtime_dependency "nokogiri"
|
24
|
-
spec.add_runtime_dependency "safely_block"
|
24
|
+
spec.add_runtime_dependency "safely_block", ">= 0.1.1"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.6"
|
27
27
|
spec.add_development_dependency "rake"
|
data/app/models/ahoy/message.rb
CHANGED
data/lib/ahoy_email.rb
CHANGED
@@ -4,14 +4,14 @@ require "rails"
|
|
4
4
|
require "nokogiri"
|
5
5
|
require "addressable/uri"
|
6
6
|
require "openssl"
|
7
|
-
require "
|
7
|
+
require "safely/core"
|
8
8
|
require "ahoy_email/processor"
|
9
9
|
require "ahoy_email/interceptor"
|
10
10
|
require "ahoy_email/mailer"
|
11
11
|
require "ahoy_email/engine"
|
12
12
|
|
13
13
|
module AhoyEmail
|
14
|
-
mattr_accessor :secret_token, :options, :subscribers
|
14
|
+
mattr_accessor :secret_token, :options, :subscribers, :belongs_to
|
15
15
|
|
16
16
|
self.options = {
|
17
17
|
message: true,
|
@@ -30,6 +30,8 @@ module AhoyEmail
|
|
30
30
|
|
31
31
|
self.subscribers = []
|
32
32
|
|
33
|
+
self.belongs_to = {}
|
34
|
+
|
33
35
|
def self.track(options)
|
34
36
|
self.options = self.options.merge(options)
|
35
37
|
end
|
data/lib/ahoy_email/engine.rb
CHANGED
@@ -3,6 +3,7 @@ module AhoyEmail
|
|
3
3
|
initializer "ahoy_email" do |app|
|
4
4
|
secrets = app.respond_to?(:secrets) ? app.secrets : app.config
|
5
5
|
AhoyEmail.secret_token ||= secrets.respond_to?(:secret_key_base) ? secrets.secret_key_base : secrets.secret_token
|
6
|
+
AhoyEmail.belongs_to = {optional: true} if Rails::VERSION::MAJOR >= 5
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/ahoy_email/processor.rb
CHANGED
@@ -10,7 +10,7 @@ module AhoyEmail
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def process
|
13
|
-
safely do
|
13
|
+
Safely.safely do
|
14
14
|
action_name = mailer.action_name.to_sym
|
15
15
|
if options[:message] && (!options[:only] || options[:only].include?(action_name)) && !options[:except].to_a.include?(action_name)
|
16
16
|
@ahoy_message = AhoyEmail.message_model.new
|
@@ -31,14 +31,14 @@ module AhoyEmail
|
|
31
31
|
|
32
32
|
ahoy_message.assign_attributes(options[:extra] || {})
|
33
33
|
|
34
|
-
ahoy_message.save
|
34
|
+
ahoy_message.save!
|
35
35
|
message["Ahoy-Message-Id"] = ahoy_message.id.to_s
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
def track_send
|
41
|
-
safely do
|
41
|
+
Safely.safely do
|
42
42
|
if (message_id = message["Ahoy-Message-Id"]) && message.perform_deliveries
|
43
43
|
ahoy_message = AhoyEmail.message_model.where(id: message_id.to_s).first
|
44
44
|
if ahoy_message
|
data/lib/ahoy_email/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.1.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.1.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,6 +144,7 @@ extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
146
|
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
147
148
|
- CHANGELOG.md
|
148
149
|
- Gemfile
|
149
150
|
- LICENSE.txt
|
@@ -164,6 +165,7 @@ files:
|
|
164
165
|
- test/gemfiles/actionmailer32.gemfile
|
165
166
|
- test/gemfiles/actionmailer40.gemfile
|
166
167
|
- test/gemfiles/actionmailer41.gemfile
|
168
|
+
- test/gemfiles/actionmailer42.gemfile
|
167
169
|
- test/internal/config/database.yml
|
168
170
|
- test/internal/config/routes.rb
|
169
171
|
- test/internal/db/schema.rb
|
@@ -189,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
191
|
version: '0'
|
190
192
|
requirements: []
|
191
193
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.5.1
|
193
195
|
signing_key:
|
194
196
|
specification_version: 4
|
195
197
|
summary: Simple, powerful email tracking for Rails
|
@@ -197,9 +199,9 @@ test_files:
|
|
197
199
|
- test/gemfiles/actionmailer32.gemfile
|
198
200
|
- test/gemfiles/actionmailer40.gemfile
|
199
201
|
- test/gemfiles/actionmailer41.gemfile
|
202
|
+
- test/gemfiles/actionmailer42.gemfile
|
200
203
|
- test/internal/config/database.yml
|
201
204
|
- test/internal/config/routes.rb
|
202
205
|
- test/internal/db/schema.rb
|
203
206
|
- test/mailer_test.rb
|
204
207
|
- test/test_helper.rb
|
205
|
-
has_rdoc:
|