ahoy_email 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ahoy_email/mailer.rb +2 -2
- data/lib/ahoy_email/processor.rb +18 -22
- data/lib/ahoy_email/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c93fae59edb3ef7d69664769d7706673c09955ca
|
4
|
+
data.tar.gz: d4fcf110e9b0d31f27df464426c5b98ecd8c68a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3be760d8cd4b4bbbb4d7f7c82124f0243b3234a0019a9bd041241cb0ca04c2880ed539e9f0868f248c2c1d6c45cc4cf06845e97c563b26b8d19ca6ebb91a28
|
7
|
+
data.tar.gz: e76a54879f082d10651fed3e82c3dcb969eb1fd7ca3bcca9b7ab46214e73152a244ce598ecd5b71165ace8b1867bc4baa65577537a1e998db2458c58df325025
|
data/CHANGELOG.md
CHANGED
data/lib/ahoy_email/mailer.rb
CHANGED
@@ -12,12 +12,12 @@ module AhoyEmail
|
|
12
12
|
|
13
13
|
module ClassMethods
|
14
14
|
def track(options)
|
15
|
-
self.ahoy_options = ahoy_options.merge(options)
|
15
|
+
self.ahoy_options = ahoy_options.merge(message: true).merge(options)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def track(options)
|
20
|
-
@ahoy_options = (@ahoy_options || {}).merge(options)
|
20
|
+
@ahoy_options = (@ahoy_options || {}).merge(message: true).merge(options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def mail_with_ahoy(headers = {}, &block)
|
data/lib/ahoy_email/processor.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module AhoyEmail
|
2
2
|
class Processor
|
3
|
-
include ActionView::Helpers::AssetTagHelper
|
4
|
-
|
5
3
|
attr_reader :message, :options, :ahoy_message
|
6
4
|
|
7
5
|
def initialize(message, options = {})
|
@@ -54,15 +52,13 @@ module AhoyEmail
|
|
54
52
|
raw_source = (message.html_part || message).body.raw_source
|
55
53
|
regex = /<\/body>/i
|
56
54
|
url =
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
format: "gif"
|
63
|
-
)
|
55
|
+
url_for(
|
56
|
+
controller: "ahoy/messages",
|
57
|
+
action: "open",
|
58
|
+
id: ahoy_message.token,
|
59
|
+
format: "gif"
|
64
60
|
)
|
65
|
-
pixel = image_tag(url, size: "1x1", alt: nil)
|
61
|
+
pixel = ActionController::Base.helpers.image_tag(url, size: "1x1", alt: nil)
|
66
62
|
|
67
63
|
# try to add before body tag
|
68
64
|
if raw_source.match(regex)
|
@@ -92,18 +88,14 @@ module AhoyEmail
|
|
92
88
|
|
93
89
|
if options[:click] and !skip_attribute?(link, "click")
|
94
90
|
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), AhoyEmail.secret_token, link["href"])
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
signature: signature
|
103
|
-
)
|
91
|
+
link["href"] =
|
92
|
+
url_for(
|
93
|
+
controller: "ahoy/messages",
|
94
|
+
action: "click",
|
95
|
+
id: ahoy_message.token,
|
96
|
+
url: link["href"],
|
97
|
+
signature: signature
|
104
98
|
)
|
105
|
-
|
106
|
-
link["href"] = url
|
107
99
|
end
|
108
100
|
end
|
109
101
|
|
@@ -130,6 +122,10 @@ module AhoyEmail
|
|
130
122
|
end
|
131
123
|
end
|
132
124
|
|
125
|
+
def url_for(options)
|
126
|
+
AhoyEmail::Engine.routes.url_helpers.url_for((ActionMailer::Base.default_url_options || {}).merge(options))
|
127
|
+
end
|
128
|
+
|
133
129
|
# not a fan of quiet errors
|
134
130
|
# but tracking should *not* break
|
135
131
|
# email delivery in production
|
@@ -142,4 +138,4 @@ module AhoyEmail
|
|
142
138
|
end
|
143
139
|
|
144
140
|
end
|
145
|
-
end
|
141
|
+
end
|
data/lib/ahoy_email/version.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.2.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: 2014-05-
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|