mandrill-rails 1.3.0 → 1.3.1
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 +8 -8
- data/.rspec +1 -1
- data/lib/mandrill-rails/version.rb +1 -1
- data/lib/mandrill/web_hook/event_decorator.rb +9 -3
- data/spec/fixtures/webhook_examples/sync_blacklist.json +49 -14
- data/spec/fixtures/webhook_examples/sync_whitelist.json +20 -8
- data/spec/mandrill/web_hook/event_decorator_spec.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODA5YzY1YTI5ODBjOTg0M2Y4NDdhNzc0ZTg5MGFhNTk0MDgwMmNhMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2UyZTI0NWU3OTkxNjM2MmUyM2EzODIxNDcxMGMxMGVjZDAxYzU0YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjcyY2E1MTI1NzNiYWFjMjIyN2I5NTVmYmM0M2E1NzllZDM0MzhiZGIyZTc2
|
10
|
+
Nzk5Zjg3NDUwMDdlYWRlMmNhNWQxNjIyYWRjNDAyZGQ4OTdkYjNmNzEzZjA2
|
11
|
+
YWU0MzYzYjFjZGVkZjYwZDQ4OTA2ZmZjZDc4N2RkYzJjN2RjYTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2MwNGFkNTIyYTc2NGZiMDgwNDdhYzIzNWZjYmM2NjhjNGRlNzc0NzdkYmNi
|
14
|
+
MDc5MTViMjg0OTdkY2NkMzY5MDA3ZGJkZTlkNTAyZGZjZDE5NmU1MzA2ZTRl
|
15
|
+
ZTY2NTcwMjA0OWY0Y2VmZGFkMzdlY2JmNTA5YjIyOTFmYzYxZjQ=
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--format documentation
|
2
|
-
--colour
|
2
|
+
--colour
|
@@ -26,6 +26,12 @@ class Mandrill::WebHook::EventDecorator < Hash
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# Returns the entry Hash.
|
30
|
+
# Applicable events: sync
|
31
|
+
def entry
|
32
|
+
self['entry']||{}
|
33
|
+
end
|
34
|
+
|
29
35
|
# Returns the reject Hash.
|
30
36
|
# Applicable events: sync
|
31
37
|
def reject
|
@@ -48,7 +54,7 @@ class Mandrill::WebHook::EventDecorator < Hash
|
|
48
54
|
# Inbound events: references 'Message-Id' header.
|
49
55
|
# Send/Open/Click events: references '_id' message attribute.
|
50
56
|
def message_id
|
51
|
-
headers['Message-Id'] || msg['_id']
|
57
|
+
headers['Message-Id'] || msg['_id'] || self['_id']
|
52
58
|
end
|
53
59
|
|
54
60
|
# Returns the Mandrill message version.
|
@@ -85,14 +91,14 @@ class Mandrill::WebHook::EventDecorator < Hash
|
|
85
91
|
# Inbound messages: references 'from_email' message attribute.
|
86
92
|
# Send/Open/Click messages: references 'sender' message attribute.
|
87
93
|
def sender_email
|
88
|
-
msg['from_email'] || msg['sender'] || reject['sender']
|
94
|
+
msg['from_email'] || msg['sender'] || entry['sender'] || reject['sender']
|
89
95
|
end
|
90
96
|
|
91
97
|
# Returns the subject user email address.
|
92
98
|
# Inbound messages: references 'email' message attribute (represents the sender).
|
93
99
|
# Send/Open/Click messages: references 'email' message attribute (represents the recipient).
|
94
100
|
def user_email
|
95
|
-
msg['email'] || reject['email']
|
101
|
+
msg['email'] || entry['email'] || reject['email']
|
96
102
|
end
|
97
103
|
|
98
104
|
# Returns an array of all unique recipients (to/cc)
|
@@ -1,18 +1,53 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
|
-
"type":
|
4
|
-
"action":
|
5
|
-
"reject":
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
"type":"blacklist",
|
4
|
+
"action":"add",
|
5
|
+
"reject":
|
6
|
+
{
|
7
|
+
"reason":"hard-bounce",
|
8
|
+
"detail":"Example detail",
|
9
|
+
"last_event_at":"2014-02-01 12:43:56",
|
10
|
+
"email":"example.webhook@mandrillapp.com",
|
11
|
+
"created_at":"2014-01-15 11:32:19",
|
12
|
+
"expires_at":"2020-04-02 12:09:18",
|
13
|
+
"expired":false,
|
14
|
+
"subaccount":"example_subaccount",
|
15
|
+
"sender":"example.sender@mandrillapp.com"
|
16
|
+
},
|
17
|
+
"ts":1438785792
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type":"blacklist",
|
21
|
+
"action":"change",
|
22
|
+
"reject":
|
23
|
+
{
|
24
|
+
"reason":"hard-bounce",
|
25
|
+
"detail":"Example detail",
|
26
|
+
"last_event_at":"2014-02-01 12:43:56",
|
27
|
+
"email":"example.webhook@mandrillapp.com",
|
28
|
+
"created_at":"2014-01-15 11:32:19",
|
29
|
+
"expires_at":"2020-04-02 12:09:18",
|
30
|
+
"expired":false,
|
31
|
+
"subaccount":"example_subaccount",
|
32
|
+
"sender":"example.sender@mandrillapp.com"
|
33
|
+
},
|
34
|
+
"ts":1438785792
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"type":"blacklist",
|
38
|
+
"action":"remove",
|
39
|
+
"reject":
|
40
|
+
{
|
41
|
+
"reason":"hard-bounce",
|
42
|
+
"detail":"Example detail",
|
43
|
+
"last_event_at":"2014-02-01 12:43:56",
|
44
|
+
"email":"example.webhook@mandrillapp.com",
|
45
|
+
"created_at":"2014-01-15 11:32:19",
|
46
|
+
"expires_at":"2020-04-02 12:09:18",
|
47
|
+
"expired":false,
|
48
|
+
"subaccount":"example_subaccount",
|
49
|
+
"sender":"example.sender@mandrillapp.com"
|
50
|
+
},
|
51
|
+
"ts":1438785792
|
17
52
|
}
|
18
53
|
]
|
@@ -1,12 +1,24 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
|
-
"type":
|
4
|
-
"action":
|
5
|
-
"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
"type":"whitelist",
|
4
|
+
"action":"add",
|
5
|
+
"entry":
|
6
|
+
{
|
7
|
+
"email":"example.webhook@mandrillapp.com",
|
8
|
+
"detail":"example details",
|
9
|
+
"created_at":"2014-01-15 12:03:19"
|
10
|
+
},
|
11
|
+
"ts":1438786546
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"type":"whitelist",
|
15
|
+
"action":"remove",
|
16
|
+
"entry":
|
17
|
+
{
|
18
|
+
"email":"example.webhook@mandrillapp.com",
|
19
|
+
"detail":"example details",
|
20
|
+
"created_at":"2014-01-15 12:03:19"
|
21
|
+
},
|
22
|
+
"ts":1438786546
|
11
23
|
}
|
12
24
|
]
|
@@ -153,15 +153,15 @@ describe Mandrill::WebHook::EventDecorator do
|
|
153
153
|
:event_type => 'sync',
|
154
154
|
:sync_type => 'blacklist',
|
155
155
|
:reject => {
|
156
|
-
"reason"=>"
|
157
|
-
"detail"=>"
|
158
|
-
"last_event_at"=>"
|
159
|
-
"email"=>"
|
160
|
-
"created_at"=>"
|
161
|
-
"expires_at"=>"
|
162
|
-
"expired"=>
|
163
|
-
"subaccount"=>"",
|
164
|
-
"sender"=>"sender@
|
156
|
+
"reason"=>"hard-bounce",
|
157
|
+
"detail"=>"Example detail",
|
158
|
+
"last_event_at"=>"2014-02-01 12:43:56",
|
159
|
+
"email"=>"example.webhook@mandrillapp.com",
|
160
|
+
"created_at"=>"2014-01-15 11:32:19",
|
161
|
+
"expires_at"=>"2020-04-02 12:09:18",
|
162
|
+
"expired"=>false,
|
163
|
+
"subaccount"=>"example_subaccount",
|
164
|
+
"sender"=>"example.sender@mandrillapp.com"
|
165
165
|
},
|
166
166
|
:subject => nil,
|
167
167
|
:message_id => nil,
|
@@ -169,8 +169,8 @@ describe Mandrill::WebHook::EventDecorator do
|
|
169
169
|
:in_reply_to => nil,
|
170
170
|
:references => [],
|
171
171
|
:headers => {},
|
172
|
-
:sender_email => "sender@
|
173
|
-
:user_email => "
|
172
|
+
:sender_email => "example.sender@mandrillapp.com",
|
173
|
+
:user_email => "example.webhook@mandrillapp.com",
|
174
174
|
:recipients => [],
|
175
175
|
:recipient_emails => [],
|
176
176
|
:message_body => nil,
|
@@ -181,10 +181,10 @@ describe Mandrill::WebHook::EventDecorator do
|
|
181
181
|
'sync_whitelist' => {
|
182
182
|
:event_type => 'sync',
|
183
183
|
:sync_type => 'whitelist',
|
184
|
-
:
|
185
|
-
"detail"=>"
|
186
|
-
"email"=>"
|
187
|
-
"created_at"=>"
|
184
|
+
:entry => {
|
185
|
+
"detail"=>"example details",
|
186
|
+
"email"=>"example.webhook@mandrillapp.com",
|
187
|
+
"created_at"=>"2014-01-15 12:03:19"
|
188
188
|
},
|
189
189
|
:subject => nil,
|
190
190
|
:message_id => nil,
|
@@ -193,7 +193,7 @@ describe Mandrill::WebHook::EventDecorator do
|
|
193
193
|
:references => [],
|
194
194
|
:headers => {},
|
195
195
|
:sender_email => nil,
|
196
|
-
:user_email => "
|
196
|
+
:user_email => "example.webhook@mandrillapp.com",
|
197
197
|
:recipients => [],
|
198
198
|
:recipient_emails => [],
|
199
199
|
:message_body => nil,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Gallagher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|