mandrill-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/mandrill-rails/version.rb +1 -1
- data/lib/mandrill/web_hook/event_decorator.rb +55 -10
- data/mandrill-rails.gemspec +2 -2
- data/spec/fixtures/webhook_examples/click.json +24 -0
- data/spec/fixtures/webhook_examples/inbound.json +29 -0
- data/spec/fixtures/webhook_examples/inbound_reply.json +36 -0
- data/spec/fixtures/webhook_examples/open.json +20 -0
- data/spec/fixtures/webhook_examples/send.json +17 -0
- data/spec/mandrill/web_hook/event_decorator_spec.rb +164 -91
- data/spec/support/fixtures_helper.rb +25 -0
- metadata +32 -60
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@ FYI, {Mandrill}[http://mandrill.com/] is the transactional email service by the
|
|
9
9
|
|
10
10
|
== Requirements and Known Limitations
|
11
11
|
|
12
|
-
* Tested with MRI 1.9.3
|
12
|
+
* Tested with MRI 1.8.7, 1.9.2, 1.9.3, Rubinius (1.8 and 1.9 mode), JRuby (1.8 and 1.9 mode)
|
13
13
|
* Requires Rails >= 3.0.3 (including 3.1 and 3.2)
|
14
14
|
* Includes {Mandrill}[https://github.com/tatemae-consultancy/mandrill] ~> 0.0.2 as a dependency
|
15
15
|
|
@@ -10,59 +10,85 @@
|
|
10
10
|
#
|
11
11
|
class Mandrill::WebHook::EventDecorator < Hash
|
12
12
|
|
13
|
-
# Returns the event type
|
13
|
+
# Returns the event type.
|
14
|
+
# Applicable events: all
|
14
15
|
def event_type
|
15
16
|
self['event']
|
16
17
|
end
|
17
18
|
|
18
|
-
# Returns the subject
|
19
|
+
# Returns the message subject.
|
20
|
+
# Applicable events: all
|
19
21
|
def subject
|
20
22
|
self['subject'] || msg['subject']
|
21
23
|
end
|
22
24
|
|
23
|
-
# Returns the msg Hash
|
25
|
+
# Returns the msg Hash.
|
26
|
+
# Applicable events: all
|
24
27
|
def msg
|
25
28
|
self['msg']||{}
|
26
29
|
end
|
27
30
|
|
28
|
-
# Returns the message_id
|
31
|
+
# Returns the message_id.
|
32
|
+
# Inbound events: references 'Message-Id' header.
|
33
|
+
# Send/Open/Click events: references '_id' message attribute.
|
29
34
|
def message_id
|
30
|
-
headers['Message-Id']
|
35
|
+
headers['Message-Id'] || msg['_id']
|
31
36
|
end
|
32
37
|
|
33
|
-
# Returns the
|
38
|
+
# Returns the Mandrill message version.
|
39
|
+
# Send/Click events: references '_version' message attribute.
|
40
|
+
# Inbound/Open events: n/a.
|
41
|
+
def message_version
|
42
|
+
msg['_version']
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns the reply-to ID.
|
46
|
+
# Applicable events: inbound
|
34
47
|
def in_reply_to
|
35
48
|
headers['In-Reply-To']
|
36
49
|
end
|
37
50
|
|
38
|
-
# Returns an array of reference IDs
|
51
|
+
# Returns an array of reference IDs.
|
52
|
+
# Applicable events: inbound
|
39
53
|
def references
|
40
54
|
(headers['References']||'').scan(/(<[^<]+?>)/).flatten
|
41
55
|
end
|
42
56
|
|
43
|
-
# Returns the headers Hash
|
57
|
+
# Returns the headers Hash.
|
58
|
+
# Applicable events: inbound
|
44
59
|
def headers
|
45
60
|
msg['headers']||{}
|
46
61
|
end
|
47
62
|
|
48
|
-
# Returns the email (String) of the sender
|
63
|
+
# Returns the email (String) of the sender.
|
64
|
+
# Applicable events: inbound
|
49
65
|
def sender_email
|
50
66
|
msg['from_email']
|
51
67
|
end
|
52
68
|
|
69
|
+
# Returns the subject user email address.
|
70
|
+
# Inbound messages: references 'email' message attribute (represents the sender).
|
71
|
+
# Send/Open/Click messages: references 'email' message attribute (represents the recipient).
|
72
|
+
def user_email
|
73
|
+
msg['email']
|
74
|
+
end
|
75
|
+
|
53
76
|
# Returns an array of all unique recipient emails (to/cc)
|
54
77
|
# [ email, email, .. ]
|
78
|
+
# Applicable events: inbound
|
55
79
|
def recipients
|
56
80
|
(Array(msg['to']) | Array(msg['cc'])).compact
|
57
81
|
end
|
58
82
|
|
59
83
|
# Returns an array of all unique recipients (to/cc)
|
60
84
|
# [ [email,name], [email,name], .. ]
|
85
|
+
# Applicable events: inbound
|
61
86
|
def recipient_emails
|
62
87
|
recipients.map(&:first)
|
63
88
|
end
|
64
89
|
|
65
|
-
# Returns the +format+ (:text,:html,:raw) message body
|
90
|
+
# Returns the +format+ (:text,:html,:raw) message body.
|
91
|
+
# Applicable events: inbound
|
66
92
|
def message_body(format=:text)
|
67
93
|
case format
|
68
94
|
when :text
|
@@ -74,4 +100,23 @@ class Mandrill::WebHook::EventDecorator < Hash
|
|
74
100
|
end
|
75
101
|
end
|
76
102
|
|
103
|
+
# Returns the primary click payload or nil if n/a.
|
104
|
+
# Applicable events: click, open
|
105
|
+
def click
|
106
|
+
{ 'ts' => self['ts'], 'url' => self['url'] } if self['ts'] && self['url']
|
107
|
+
end
|
108
|
+
|
109
|
+
# Returns an array of all the clicks.
|
110
|
+
# Applicable events: click, open
|
111
|
+
def all_clicks
|
112
|
+
clicks = msg['clicks'] || []
|
113
|
+
clicks << click if click and clicks.empty?
|
114
|
+
clicks
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns an array of all the urls marked as clicked in this message.
|
118
|
+
# Applicable events: click, open
|
119
|
+
def all_clicked_links
|
120
|
+
all_clicks.collect{|c| c['url'] }.uniq
|
121
|
+
end
|
77
122
|
end
|
data/mandrill-rails.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/mandrill-rails/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Paul Gallagher"]
|
6
6
|
gem.email = ["gallagher.paul@gmail.com"]
|
7
|
-
gem.description = %q{Rails integration for
|
8
|
-
gem.summary = %q{
|
7
|
+
gem.description = %q{Rails integration for Mandrill}
|
8
|
+
gem.summary = %q{Provides webhook processing and event decoration to make using Mandrill with Rails just that much easier}
|
9
9
|
gem.homepage = "https://github.com/evendis/mandrill-rails"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"event": "click",
|
4
|
+
"msg": {
|
5
|
+
"_id": "8606637.6692f6cac28e45a9b371e182d5ca0a35",
|
6
|
+
"_version": 5,
|
7
|
+
"clicks": [
|
8
|
+
{ "ts": 1350347773, "url": "http://feedproxy.google.com/~r/readwriteweb/~3/rqUHtsdBCzc/saturday-night-live-sketch-skewers-iphone-5-and-the-tech-press-video.php" },
|
9
|
+
{ "ts": 1350377171, "url": "http://feedproxy.google.com/~r/readwriteweb/~3/MMUCngEPdSU/now-you-can-search-your-email-docs-spreadsheets-from-the-main-google-box.php" },
|
10
|
+
{ "ts": 1350377231, "url": "http://feedproxy.google.com/~r/readwriteweb/~3/KemlM1hZvdI/how-evil-is-your-smartphone.php" },
|
11
|
+
{ "ts": 1350377135, "url": "http://feedproxy.google.com/~r/readwriteweb/~3/op1uGAwjnFo/fix-your-iphones-maps-reminders-with-localscope-3.php" }
|
12
|
+
],
|
13
|
+
"email": "to@example.com",
|
14
|
+
"opens": [ { "ts": 1350347773 } ],
|
15
|
+
"sender": "from@example.com",
|
16
|
+
"state": "sent",
|
17
|
+
"subject": "[click] Sample Subject",
|
18
|
+
"tags": [],
|
19
|
+
"ts": 1350345672
|
20
|
+
},
|
21
|
+
"ts": 1350377135,
|
22
|
+
"url": "http://feedproxy.google.com/~r/readwriteweb/~3/op1uGAwjnFo/fix-your-iphones-maps-reminders-with-localscope-3.php"
|
23
|
+
}
|
24
|
+
]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"event": "inbound",
|
4
|
+
"msg": {
|
5
|
+
"email": "from@example.com",
|
6
|
+
"from_email": "from@example.com",
|
7
|
+
"from_name": "From Name ",
|
8
|
+
"headers": {
|
9
|
+
"Content-Type": "multipart/alternative; boundary=e0cb4efe2faee9b97304c6d0647b",
|
10
|
+
"Date": "Thu, 9 Aug 2012 15:44:15 +0800",
|
11
|
+
"Dkim-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9/e4o7vsyI5eIM2MUze13ZWWdxyhC7cxjHwrHXPSEJQ=; b=HOb83u8i6ai3HuT61C+NfQcUHqATH+/ivAjZ2pD/MXcCFboOyN9LGeMHm+RhwnL+Ap mC0R9+eqlWaoxqd6ugrvtNOQ1Kvb9LunPnnMwY06KZKpoXCVwFrzT3e2f8JgLwyAxpUv G0srziHwpuCh/y42dJ83tKhctHc6w6GKC79H1WBAcexnjvk0LgrkOnNJ/iBCOznjs35o V4jfjlJBeZLvxcnEJ5Xxade2kWbLZ9TWiuVfTS6xUyVb/gfn5x9D1KjCUb1Gwq9wYJ4m UxH6oC5f3mkM+NZ6oDBmJFDdVxg23rRaMrF4YBpVGj+6+pjF36N8CrmtaDOJNVqCS5FN koSw==",
|
12
|
+
"From": "From Name <from@example.com>",
|
13
|
+
"Message-Id": "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>",
|
14
|
+
"Mime-Version": "1.0",
|
15
|
+
"Received": [ "from mail-lpp01m010-f51.google.com (mail-lpp01m010-f51.google.com [209.85.215.51]) by app01.transact (Postfix) with ESMTPS id F01841E0010A for <to@example.com>; Thu, 9 Aug 2012 03:44:16 -0400 (EDT)", "by lahe6 with SMTP id e6so79326lah.24 for <to@example.com>; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)", "by 10.112.43.67 with SMTP id u3mr382471lbl.16.1344498255378; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)", "by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:44:15 -0700 (PDT)" ],
|
16
|
+
"Subject": "[inbound] Sample Subject",
|
17
|
+
"To": "to@example.com"
|
18
|
+
},
|
19
|
+
"html": "multi-line content<br><br><b>multi-line content<br></b>\n<br><i>with some formatting</i><br><br>\nmulti-line content<br>\n<br>\n<br>\n\n",
|
20
|
+
"raw_msg": "Received: from mail-lpp01m010-f51.google.com (mail-lpp01m010-f51.google.com [209.85.215.51])\n\tby app01.transact (Postfix) with ESMTPS id F01841E0010A\n\tfor <to@example.com>; Thu, 9 Aug 2012 03:44:16 -0400 (EDT)\nReceived: by lahe6 with SMTP id e6so79326lah.24\n for <to@example.com>; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20120113;\n h=mime-version:date:message-id:subject:from:to:content-type;\n bh=9/e4o7vsyI5eIM2MUze13ZWWdxyhC7cxjHwrHXPSEJQ=;\n b=HOb83u8i6ai3HuT61C+NfQcUHqATH+/ivAjZ2pD/MXcCFboOyN9LGeMHm+RhwnL+Ap\n mC0R9+eqlWaoxqd6ugrvtNOQ1Kvb9LunPnnMwY06KZKpoXCVwFrzT3e2f8JgLwyAxpUv\n G0srziHwpuCh/y42dJ83tKhctHc6w6GKC79H1WBAcexnjvk0LgrkOnNJ/iBCOznjs35o\n V4jfjlJBeZLvxcnEJ5Xxade2kWbLZ9TWiuVfTS6xUyVb/gfn5x9D1KjCUb1Gwq9wYJ4m\n UxH6oC5f3mkM+NZ6oDBmJFDdVxg23rRaMrF4YBpVGj+6+pjF36N8CrmtaDOJNVqCS5FN\n koSw==\nMIME-Version: 1.0\nReceived: by 10.112.43.67 with SMTP id u3mr382471lbl.16.1344498255378; Thu, 09\n Aug 2012 00:44:15 -0700 (PDT)\nReceived: by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:44:15 -0700 (PDT)\nDate: Thu, 9 Aug 2012 15:44:15 +0800\nMessage-ID: <CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>\nSubject: [inbound] Sample Subject\nFrom: From Name <from@example.com>\nTo: to@example.com\nContent-Type: multipart/alternative; boundary=e0cb4efe2faee9b97304c6d0647b\n\n--e0cb4efe2faee9b97304c6d0647b\nContent-Type: text/plain; charset=UTF-8\n\nmulti-line content\n\n*multi-line content\n*\n*with some formatting*\n\nmulti-line content\n\n--e0cb4efe2faee9b97304c6d0647b\nContent-Type: text/html; charset=UTF-8\n\nmulti-line content<br><br><b>multi-line content<br></b>\n<br><i>with some formatting</i><br><br>\nmulti-line content<br>\n<br>\n<br>\n\n--e0cb4efe2faee9b97304c6d0647b--\n",
|
21
|
+
"sender": null,
|
22
|
+
"subject": "[inbound] Sample Subject",
|
23
|
+
"tags": [],
|
24
|
+
"text": "multi-line content\n\n*multi-line content\n*\n*with some formatting*\n\nmulti-line content\n\n",
|
25
|
+
"to": [ [ "to@example.com", null ] ]
|
26
|
+
},
|
27
|
+
"ts": 1344498257
|
28
|
+
}
|
29
|
+
]
|
@@ -0,0 +1,36 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"event": "inbound",
|
4
|
+
"msg": {
|
5
|
+
"cc": [ [ "cc@example.com", null ] ],
|
6
|
+
"email": "from@example.com",
|
7
|
+
"from_email": "from@example.com",
|
8
|
+
"from_name": "From Name ",
|
9
|
+
"headers": {
|
10
|
+
"Cc": "cc@example.com",
|
11
|
+
"Content-Type": "multipart/alternative; boundary=f46d040838d398472904c6d067c6",
|
12
|
+
"Date": "Thu, 9 Aug 2012 15:45:00 +0800",
|
13
|
+
"Dkim-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=hZurAGSA3OJIqtMOebHDdMvqss5GY1RDg7kV68+nvN8=; b=g9eCMb+rDV2RIp8stEri4PjLRHqxPECKEJcP/uMEcWZcWqDOlV9QBlOUAptAHMDv1F tIbDJBx+59t5q1hMr2sfn8CUl4T1oaXZq9Gu3SvGxlLX4HFGEQZBAUq+kfW+M8mNWHs9 SkNxsO1gmgjuht1hGOP4rxkEj/tRM+NXBiqB8UOzaF3BBI/NtjjKjbLu+VshGadTDoeQ ayQ6d6r5Sl+BE0PNLF65H8WJF0VyzTsTOSKAynRGGoLCaO+gzgxSwQe5+w9spw0SMSRY +it9DSZm1en+BsfMNlcbkUqN5a9ova+q4whSjdq4NoTrCaZS/6ZTVbBjc/HK2IQYQI4/ CTDw==",
|
14
|
+
"From": "From Name <from@example.com>",
|
15
|
+
"Message-Id": "<CAGBx7GhsVk7Q-aO-FQ-m+Oix7GQyEVHyL60qv0__G8EpH8pA4w@mail.gmail.com>",
|
16
|
+
"In-Reply-To": "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>",
|
17
|
+
"References": "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com> <9999999999999@mail.gmail.com>",
|
18
|
+
"Mime-Version": "1.0",
|
19
|
+
"Received": [ "from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by app01.transact (Postfix) with ESMTPS id E94801E000B8 for <to@example.com>; Thu, 9 Aug 2012 03:45:01 -0400 (EDT)",
|
20
|
+
"by lbao2 with SMTP id o2so118681lba.24 for <to@example.com>; Thu, 09 Aug 2012 00:45:00 -0700 (PDT)",
|
21
|
+
"by 10.152.112.233 with SMTP id it9mr20848692lab.40.1344498300372; Thu, 09 Aug 2012 00:45:00 -0700 (PDT)",
|
22
|
+
"by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:45:00 -0700 (PDT)" ],
|
23
|
+
"Subject": "[inbound] Sample Subject 2",
|
24
|
+
"To": "to@example.com, Other To <other.to@example.com>"
|
25
|
+
},
|
26
|
+
"html": "asfasdf<br>asdf<br>asdf<br>asdf<br>asdf<br>\n\n",
|
27
|
+
"raw_msg": "Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179])\n\tby app01.transact (Postfix) with ESMTPS id E94801E000B8\n\tfor <to@example.com>; Thu, 9 Aug 2012 03:45:01 -0400 (EDT)\nReceived: by lbao2 with SMTP id o2so118681lba.24\n for <to@example.com>; Thu, 09 Aug 2012 00:45:00 -0700 (PDT)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20120113;\n h=mime-version:date:message-id:subject:from:to:cc:content-type;\n bh=hZurAGSA3OJIqtMOebHDdMvqss5GY1RDg7kV68+nvN8=;\n b=g9eCMb+rDV2RIp8stEri4PjLRHqxPECKEJcP/uMEcWZcWqDOlV9QBlOUAptAHMDv1F\n tIbDJBx+59t5q1hMr2sfn8CUl4T1oaXZq9Gu3SvGxlLX4HFGEQZBAUq+kfW+M8mNWHs9\n SkNxsO1gmgjuht1hGOP4rxkEj/tRM+NXBiqB8UOzaF3BBI/NtjjKjbLu+VshGadTDoeQ\n ayQ6d6r5Sl+BE0PNLF65H8WJF0VyzTsTOSKAynRGGoLCaO+gzgxSwQe5+w9spw0SMSRY\n +it9DSZm1en+BsfMNlcbkUqN5a9ova+q4whSjdq4NoTrCaZS/6ZTVbBjc/HK2IQYQI4/\n CTDw==\nMIME-Version: 1.0\nReceived: by 10.152.112.233 with SMTP id it9mr20848692lab.40.1344498300372;\n Thu, 09 Aug 2012 00:45:00 -0700 (PDT)\nReceived: by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:45:00 -0700 (PDT)\nDate: Thu, 9 Aug 2012 15:45:00 +0800\nMessage-ID: <CAGBx7GhsVk7Q-aO-FQ-m+Oix7GQyEVHyL60qv0__G8EpH8pA4w@mail.gmail.com>\nSubject: [inbound] Sample Subject 2\nFrom: From Name <from@example.com>\nTo: to@example.com, Other To <other.to@example.com>\nCc: cc@example.com\nContent-Type: multipart/alternative; boundary=f46d040838d398472904c6d067c6\n\n--f46d040838d398472904c6d067c6\nContent-Type: text/plain; charset=UTF-8\n\nasfasdf\nasdf\nasdf\nasdf\nasdf\n\n--f46d040838d398472904c6d067c6\nContent-Type: text/html; charset=UTF-8\n\nasfasdf<br>asdf<br>asdf<br>asdf<br>asdf<br>\n\n--f46d040838d398472904c6d067c6--\n",
|
28
|
+
"sender": null,
|
29
|
+
"subject": "[inbound] Sample Subject 2",
|
30
|
+
"tags": [],
|
31
|
+
"text": "asfasdf\nasdf\nasdf\nasdf\nasdf\n\n",
|
32
|
+
"to": [ [ "to@example.com,", null ], [ "other.to@example.com", " Other To " ] ]
|
33
|
+
},
|
34
|
+
"ts": 1344498302
|
35
|
+
}
|
36
|
+
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"event": "open",
|
4
|
+
"msg": {
|
5
|
+
"_id": "12847763.9a32184309ad4d5e9bfd20368d9d7981",
|
6
|
+
"_version": 3,
|
7
|
+
"clicks": [
|
8
|
+
{ "ts": 1350693098, "url": "http://feedproxy.google.com/~r/AccidentalTechnologist/~3/Jc7hYTVjcmM/" }
|
9
|
+
],
|
10
|
+
"email": "to@example.com",
|
11
|
+
"opens": [ { "ts": 1350693098 }, { "ts": 1350693075 } ],
|
12
|
+
"sender": "from@example.com",
|
13
|
+
"state": "sent",
|
14
|
+
"subject": "[open] Sample Subject",
|
15
|
+
"tags": [],
|
16
|
+
"ts": 1350691301
|
17
|
+
},
|
18
|
+
"ts": 1350693075
|
19
|
+
}
|
20
|
+
]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"event": "send",
|
4
|
+
"msg": {
|
5
|
+
"_id": "9a32184309ad4d5e9bfd20368d9d7981",
|
6
|
+
"clicks": [],
|
7
|
+
"email": "to@example.com",
|
8
|
+
"opens": [],
|
9
|
+
"sender": "from@example.com",
|
10
|
+
"state": "sent",
|
11
|
+
"subject": "[send] Sample Subject",
|
12
|
+
"tags": [],
|
13
|
+
"ts": 1350691301
|
14
|
+
},
|
15
|
+
"ts": 1350691301
|
16
|
+
}
|
17
|
+
]
|
@@ -1,105 +1,178 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Mandrill::WebHook::EventDecorator do
|
4
|
-
|
5
|
-
|
6
|
-
let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
|
7
|
-
subject { event_payload }
|
8
3
|
|
9
|
-
|
4
|
+
describe Mandrill::WebHook::EventDecorator do
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
# Test decorator behaviour given the range of example Mandrill event types:
|
7
|
+
#
|
8
|
+
# * inbound - inbound mail receipt
|
9
|
+
# * send - message has been sent
|
10
|
+
# * click - recipient clicked a link in a message; will only occur when click tracking is enabled
|
11
|
+
# * open - recipient opened a message; will only occur when open tracking is enabled
|
12
|
+
#
|
13
|
+
# TODO: need to collect some real examples for the following event types:
|
14
|
+
# * hard_bounce - message has hard bounced
|
15
|
+
# * reject - message was rejected
|
16
|
+
# * soft_bounce - message has soft bounced
|
17
|
+
# * spam - recipient marked a message as spam
|
18
|
+
# * unsub - recipient unsubscribed
|
19
|
+
#
|
20
|
+
{
|
21
|
+
'inbound' => {
|
22
|
+
:event_type => 'inbound',
|
23
|
+
:subject => '[inbound] Sample Subject',
|
24
|
+
:message_id => '<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>',
|
25
|
+
:message_version => nil,
|
26
|
+
:in_reply_to => nil,
|
27
|
+
:references => [],
|
28
|
+
:headers => {
|
29
|
+
"Content-Type" => "multipart/alternative; boundary=e0cb4efe2faee9b97304c6d0647b",
|
30
|
+
"Date" => "Thu, 9 Aug 2012 15:44:15 +0800",
|
31
|
+
"Dkim-Signature" => "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9/e4o7vsyI5eIM2MUze13ZWWdxyhC7cxjHwrHXPSEJQ=; b=HOb83u8i6ai3HuT61C+NfQcUHqATH+/ivAjZ2pD/MXcCFboOyN9LGeMHm+RhwnL+Ap mC0R9+eqlWaoxqd6ugrvtNOQ1Kvb9LunPnnMwY06KZKpoXCVwFrzT3e2f8JgLwyAxpUv G0srziHwpuCh/y42dJ83tKhctHc6w6GKC79H1WBAcexnjvk0LgrkOnNJ/iBCOznjs35o V4jfjlJBeZLvxcnEJ5Xxade2kWbLZ9TWiuVfTS6xUyVb/gfn5x9D1KjCUb1Gwq9wYJ4m UxH6oC5f3mkM+NZ6oDBmJFDdVxg23rRaMrF4YBpVGj+6+pjF36N8CrmtaDOJNVqCS5FN koSw==",
|
32
|
+
"From" => "From Name <from@example.com>",
|
33
|
+
"Message-Id" => "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>",
|
34
|
+
"Mime-Version" => "1.0",
|
35
|
+
"Received" => [ "from mail-lpp01m010-f51.google.com (mail-lpp01m010-f51.google.com [209.85.215.51]) by app01.transact (Postfix) with ESMTPS id F01841E0010A for <to@example.com>; Thu, 9 Aug 2012 03:44:16 -0400 (EDT)", "by lahe6 with SMTP id e6so79326lah.24 for <to@example.com>; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)", "by 10.112.43.67 with SMTP id u3mr382471lbl.16.1344498255378; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)", "by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:44:15 -0700 (PDT)" ],
|
36
|
+
"Subject" => "[inbound] Sample Subject",
|
37
|
+
"To" => "to@example.com"
|
38
|
+
},
|
39
|
+
:sender_email => 'from@example.com',
|
40
|
+
:user_email => 'from@example.com',
|
41
|
+
:recipients => [["to@example.com", nil]],
|
42
|
+
:recipient_emails => ["to@example.com"],
|
43
|
+
:message_body => "multi-line content\n\n*multi-line content\n*\n*with some formatting*\n\nmulti-line content\n\n",
|
44
|
+
:click => nil,
|
45
|
+
:all_clicks => [],
|
46
|
+
:all_clicked_links => []
|
47
|
+
},
|
48
|
+
'inbound_reply' => {
|
49
|
+
:event_type => 'inbound',
|
50
|
+
:subject => '[inbound] Sample Subject 2',
|
51
|
+
:message_id => '<CAGBx7GhsVk7Q-aO-FQ-m+Oix7GQyEVHyL60qv0__G8EpH8pA4w@mail.gmail.com>',
|
52
|
+
:message_version => nil,
|
53
|
+
:in_reply_to => "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>",
|
54
|
+
:references => ["<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>", "<9999999999999@mail.gmail.com>"],
|
55
|
+
:headers => {
|
56
|
+
"Cc" => "cc@example.com",
|
57
|
+
"Content-Type" => "multipart/alternative; boundary=f46d040838d398472904c6d067c6",
|
58
|
+
"Date" => "Thu, 9 Aug 2012 15:45:00 +0800",
|
59
|
+
"Dkim-Signature" => "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=hZurAGSA3OJIqtMOebHDdMvqss5GY1RDg7kV68+nvN8=; b=g9eCMb+rDV2RIp8stEri4PjLRHqxPECKEJcP/uMEcWZcWqDOlV9QBlOUAptAHMDv1F tIbDJBx+59t5q1hMr2sfn8CUl4T1oaXZq9Gu3SvGxlLX4HFGEQZBAUq+kfW+M8mNWHs9 SkNxsO1gmgjuht1hGOP4rxkEj/tRM+NXBiqB8UOzaF3BBI/NtjjKjbLu+VshGadTDoeQ ayQ6d6r5Sl+BE0PNLF65H8WJF0VyzTsTOSKAynRGGoLCaO+gzgxSwQe5+w9spw0SMSRY +it9DSZm1en+BsfMNlcbkUqN5a9ova+q4whSjdq4NoTrCaZS/6ZTVbBjc/HK2IQYQI4/ CTDw==",
|
60
|
+
"From" => "From Name <from@example.com>",
|
61
|
+
"Message-Id" => "<CAGBx7GhsVk7Q-aO-FQ-m+Oix7GQyEVHyL60qv0__G8EpH8pA4w@mail.gmail.com>",
|
62
|
+
"In-Reply-To" => "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>",
|
63
|
+
"References" => "<CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com> <9999999999999@mail.gmail.com>",
|
64
|
+
"Mime-Version" => "1.0",
|
65
|
+
"Received" => [ "from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by app01.transact (Postfix) with ESMTPS id E94801E000B8 for <to@example.com>; Thu, 9 Aug 2012 03:45:01 -0400 (EDT)",
|
66
|
+
"by lbao2 with SMTP id o2so118681lba.24 for <to@example.com>; Thu, 09 Aug 2012 00:45:00 -0700 (PDT)",
|
67
|
+
"by 10.152.112.233 with SMTP id it9mr20848692lab.40.1344498300372; Thu, 09 Aug 2012 00:45:00 -0700 (PDT)",
|
68
|
+
"by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:45:00 -0700 (PDT)" ],
|
69
|
+
"Subject" => "[inbound] Sample Subject 2",
|
70
|
+
"To" => "to@example.com, Other To <other.to@example.com>"
|
71
|
+
},
|
72
|
+
:sender_email => 'from@example.com',
|
73
|
+
:user_email => 'from@example.com',
|
74
|
+
:recipients => [["to@example.com,", nil], ["other.to@example.com", " Other To "], ["cc@example.com", nil]],
|
75
|
+
:recipient_emails => ["to@example.com,", "other.to@example.com", "cc@example.com"],
|
76
|
+
:message_body => "asfasdf\nasdf\nasdf\nasdf\nasdf\n\n",
|
77
|
+
:click => nil,
|
78
|
+
:all_clicks => [],
|
79
|
+
:all_clicked_links => []
|
80
|
+
},
|
81
|
+
'click' => {
|
82
|
+
:event_type => 'click',
|
83
|
+
:subject => '[click] Sample Subject',
|
84
|
+
:message_id => '8606637.6692f6cac28e45a9b371e182d5ca0a35',
|
85
|
+
:message_version => 5,
|
86
|
+
:in_reply_to => nil,
|
87
|
+
:references => [],
|
88
|
+
:headers => {},
|
89
|
+
:sender_email => nil,
|
90
|
+
:user_email => 'to@example.com',
|
91
|
+
:recipients => [],
|
92
|
+
:recipient_emails => [],
|
93
|
+
:message_body => nil,
|
94
|
+
:click => {"ts"=>1350377135, "url"=>"http://feedproxy.google.com/~r/readwriteweb/~3/op1uGAwjnFo/fix-your-iphones-maps-reminders-with-localscope-3.php"},
|
95
|
+
:all_clicks => [
|
96
|
+
{"ts"=>1350347773, "url"=>"http://feedproxy.google.com/~r/readwriteweb/~3/rqUHtsdBCzc/saturday-night-live-sketch-skewers-iphone-5-and-the-tech-press-video.php"},
|
97
|
+
{"ts"=>1350377171, "url"=>"http://feedproxy.google.com/~r/readwriteweb/~3/MMUCngEPdSU/now-you-can-search-your-email-docs-spreadsheets-from-the-main-google-box.php"},
|
98
|
+
{"ts"=>1350377231, "url"=>"http://feedproxy.google.com/~r/readwriteweb/~3/KemlM1hZvdI/how-evil-is-your-smartphone.php"},
|
99
|
+
{"ts"=>1350377135, "url"=>"http://feedproxy.google.com/~r/readwriteweb/~3/op1uGAwjnFo/fix-your-iphones-maps-reminders-with-localscope-3.php"}
|
100
|
+
],
|
101
|
+
:all_clicked_links => [
|
102
|
+
"http://feedproxy.google.com/~r/readwriteweb/~3/rqUHtsdBCzc/saturday-night-live-sketch-skewers-iphone-5-and-the-tech-press-video.php",
|
103
|
+
"http://feedproxy.google.com/~r/readwriteweb/~3/MMUCngEPdSU/now-you-can-search-your-email-docs-spreadsheets-from-the-main-google-box.php",
|
104
|
+
"http://feedproxy.google.com/~r/readwriteweb/~3/KemlM1hZvdI/how-evil-is-your-smartphone.php",
|
105
|
+
"http://feedproxy.google.com/~r/readwriteweb/~3/op1uGAwjnFo/fix-your-iphones-maps-reminders-with-localscope-3.php"
|
106
|
+
]
|
107
|
+
},
|
108
|
+
'send' => {
|
109
|
+
:event_type => 'send',
|
110
|
+
:subject => '[send] Sample Subject',
|
111
|
+
:message_id => '9a32184309ad4d5e9bfd20368d9d7981',
|
112
|
+
:message_version => nil,
|
113
|
+
:in_reply_to => nil,
|
114
|
+
:references => [],
|
115
|
+
:headers => {},
|
116
|
+
:sender_email => nil,
|
117
|
+
:user_email => 'to@example.com',
|
118
|
+
:recipients => [],
|
119
|
+
:recipient_emails => [],
|
120
|
+
:message_body => nil,
|
121
|
+
:click => nil,
|
122
|
+
:all_clicks => [],
|
123
|
+
:all_clicked_links => []
|
124
|
+
},
|
125
|
+
'open' => {
|
126
|
+
:event_type => 'open',
|
127
|
+
:subject => '[open] Sample Subject',
|
128
|
+
:message_id => '12847763.9a32184309ad4d5e9bfd20368d9d7981',
|
129
|
+
:message_version => 3,
|
130
|
+
:in_reply_to => nil,
|
131
|
+
:references => [],
|
132
|
+
:headers => {},
|
133
|
+
:sender_email => nil,
|
134
|
+
:user_email => 'to@example.com',
|
135
|
+
:recipients => [],
|
136
|
+
:recipient_emails => [],
|
137
|
+
:message_body => nil,
|
138
|
+
:click => nil,
|
139
|
+
:all_clicks => [{"ts"=>1350693098, "url"=>"http://feedproxy.google.com/~r/AccidentalTechnologist/~3/Jc7hYTVjcmM/"}],
|
140
|
+
:all_clicked_links => ["http://feedproxy.google.com/~r/AccidentalTechnologist/~3/Jc7hYTVjcmM/"]
|
141
|
+
},
|
142
|
+
}.each do |event_type,expectations|
|
143
|
+
context "with #{event_type} event_type" do
|
144
|
+
let(:raw_event) { webhook_example_event(event_type) }
|
145
|
+
let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
|
146
|
+
subject { event_payload }
|
147
|
+
expectations.each do |attribute,expected_value|
|
148
|
+
its(attribute) { should eql(expected_value) }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
21
152
|
|
22
|
-
let(:raw_event) { {
|
23
|
-
'event' => event_type,
|
24
|
-
'msg' => {
|
25
|
-
'from_email' => sender_email,
|
26
|
-
'subject' => subject_line,
|
27
|
-
'headers' => {
|
28
|
-
'Cc' => "c@example.com,b@example.com",
|
29
|
-
'Message-Id' => message_id,
|
30
|
-
'In-Reply-To' => in_reply_to,
|
31
|
-
'References' => references
|
32
|
-
},
|
33
|
-
'html' => message_html,
|
34
|
-
'raw_msg' => message_raw,
|
35
|
-
'text' => message_text,
|
36
|
-
'cc' => [ [ "c@example.com", "C"],[ "b@example.com", nil] ],
|
37
|
-
'to' => [ [ "a@example.com", "A"],[ "b@example.com", nil] ]
|
38
|
-
}
|
39
|
-
} }
|
40
153
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
its(:recipients) { should eql([["a@example.com", "A"], ["b@example.com", nil], ["c@example.com", "C"]]) }
|
45
|
-
its(:message_id) { should eql(message_id) }
|
46
|
-
its(:in_reply_to) { should eql(in_reply_to) }
|
154
|
+
describe "#message_body" do
|
155
|
+
let(:raw_event) { webhook_example_event('inbound') }
|
156
|
+
let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
|
47
157
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
158
|
+
subject { event_payload.message_body(format) }
|
159
|
+
describe ":text" do
|
160
|
+
let(:expected) { "multi-line content\n\n*multi-line content\n*\n*with some formatting*\n\nmulti-line content\n\n" }
|
161
|
+
let(:format) { :text }
|
162
|
+
it { should eql(expected) }
|
54
163
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
let(:raw_event) { {} }
|
60
|
-
its(:recipient_emails) { should eql([]) }
|
61
|
-
end
|
164
|
+
describe ":html" do
|
165
|
+
let(:expected) { "multi-line content<br><br><b>multi-line content<br></b>\n<br><i>with some formatting</i><br><br>\nmulti-line content<br>\n<br>\n<br>\n\n" }
|
166
|
+
let(:format) { :html }
|
167
|
+
it { should eql(expected) }
|
62
168
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
let(:format) { :text }
|
68
|
-
it { should eql(message_text) }
|
69
|
-
end
|
70
|
-
describe ":html" do
|
71
|
-
let(:format) { :html }
|
72
|
-
it { should eql(message_html) }
|
73
|
-
end
|
74
|
-
describe ":raw" do
|
75
|
-
let(:format) { :raw }
|
76
|
-
it { should eql(message_raw) }
|
77
|
-
end
|
169
|
+
describe ":raw" do
|
170
|
+
let(:expected) { "Received: from mail-lpp01m010-f51.google.com (mail-lpp01m010-f51.google.com [209.85.215.51])\n\tby app01.transact (Postfix) with ESMTPS id F01841E0010A\n\tfor <to@example.com>; Thu, 9 Aug 2012 03:44:16 -0400 (EDT)\nReceived: by lahe6 with SMTP id e6so79326lah.24\n for <to@example.com>; Thu, 09 Aug 2012 00:44:15 -0700 (PDT)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20120113;\n h=mime-version:date:message-id:subject:from:to:content-type;\n bh=9/e4o7vsyI5eIM2MUze13ZWWdxyhC7cxjHwrHXPSEJQ=;\n b=HOb83u8i6ai3HuT61C+NfQcUHqATH+/ivAjZ2pD/MXcCFboOyN9LGeMHm+RhwnL+Ap\n mC0R9+eqlWaoxqd6ugrvtNOQ1Kvb9LunPnnMwY06KZKpoXCVwFrzT3e2f8JgLwyAxpUv\n G0srziHwpuCh/y42dJ83tKhctHc6w6GKC79H1WBAcexnjvk0LgrkOnNJ/iBCOznjs35o\n V4jfjlJBeZLvxcnEJ5Xxade2kWbLZ9TWiuVfTS6xUyVb/gfn5x9D1KjCUb1Gwq9wYJ4m\n UxH6oC5f3mkM+NZ6oDBmJFDdVxg23rRaMrF4YBpVGj+6+pjF36N8CrmtaDOJNVqCS5FN\n koSw==\nMIME-Version: 1.0\nReceived: by 10.112.43.67 with SMTP id u3mr382471lbl.16.1344498255378; Thu, 09\n Aug 2012 00:44:15 -0700 (PDT)\nReceived: by 10.114.69.44 with HTTP; Thu, 9 Aug 2012 00:44:15 -0700 (PDT)\nDate: Thu, 9 Aug 2012 15:44:15 +0800\nMessage-ID: <CAGBx7GhULS7d6ZsdLREHnKQ68V6w2fbGmD85dPn63s6RtpsZeQ@mail.gmail.com>\nSubject: [inbound] Sample Subject\nFrom: From Name <from@example.com>\nTo: to@example.com\nContent-Type: multipart/alternative; boundary=e0cb4efe2faee9b97304c6d0647b\n\n--e0cb4efe2faee9b97304c6d0647b\nContent-Type: text/plain; charset=UTF-8\n\nmulti-line content\n\n*multi-line content\n*\n*with some formatting*\n\nmulti-line content\n\n--e0cb4efe2faee9b97304c6d0647b\nContent-Type: text/html; charset=UTF-8\n\nmulti-line content<br><br><b>multi-line content<br></b>\n<br><i>with some formatting</i><br><br>\nmulti-line content<br>\n<br>\n<br>\n\n--e0cb4efe2faee9b97304c6d0647b--\n" }
|
171
|
+
let(:format) { :raw }
|
172
|
+
it { should eql(expected) }
|
78
173
|
end
|
79
|
-
|
80
174
|
end
|
81
175
|
|
82
176
|
|
83
|
-
|
84
|
-
context "with 'send' event_type" do
|
85
|
-
let(:event_type) { 'send' }
|
86
|
-
let(:subject_line) { 'a subject line' }
|
87
|
-
let(:raw_event) { {
|
88
|
-
'event' => event_type,
|
89
|
-
'subject' => subject_line
|
90
|
-
} }
|
91
|
-
|
92
|
-
its(:event_type) { should eql(event_type) }
|
93
|
-
its(:subject) { should eql(subject_line) }
|
94
|
-
end
|
177
|
+
end
|
95
178
|
|
96
|
-
# TODO: other web hook types
|
97
|
-
# send - message has been sent
|
98
|
-
# hard_bounce - message has hard bounced
|
99
|
-
# soft_bounce - message has soft bounced
|
100
|
-
# open - recipient opened a message; will only occur when open tracking is enabled
|
101
|
-
# click - recipient clicked a link in a message; will only occur when click tracking is enabled
|
102
|
-
# spam - recipient marked a message as spam
|
103
|
-
# unsub - recipient unsubscribed
|
104
|
-
# reject - message was rejected
|
105
|
-
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module FixturesHelper
|
5
|
+
|
6
|
+
def webhook_examples_path
|
7
|
+
Pathname.new(File.dirname(__FILE__)).join('..','fixtures','webhook_examples')
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns the JSON representation of an array of +sample_name+ events
|
11
|
+
def webhook_example_events(sample_name)
|
12
|
+
sample_path = webhook_examples_path.join("#{sample_name}.json")
|
13
|
+
JSON.parse(sample_path.read)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns the JSON representation of an +sample_name+ event
|
17
|
+
def webhook_example_event(sample_name)
|
18
|
+
webhook_example_events(sample_name).first
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
RSpec.configure do |conf|
|
24
|
+
conf.include FixturesHelper
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mandrill
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70116641865300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.0.2
|
24
|
+
version_requirements: *70116641865300
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: activesupport
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70116641864660 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: 3.0.3
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 3.0.3
|
35
|
+
version_requirements: *70116641864660
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: bundler
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70116641864160 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ~>
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: 1.1.0
|
54
44
|
type: :development
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.1.0
|
46
|
+
version_requirements: *70116641864160
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rake
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70116641863640 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ~>
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: 0.9.2.2
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.9.2.2
|
57
|
+
version_requirements: *70116641863640
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: rspec
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70116641863140 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ~>
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: 2.8.0
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 2.8.0
|
68
|
+
version_requirements: *70116641863140
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: rdoc
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70116641862560 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ~>
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: '3.11'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '3.11'
|
79
|
+
version_requirements: *70116641862560
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: guard-rspec
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &70116641862000 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ~>
|
@@ -117,13 +87,8 @@ dependencies:
|
|
117
87
|
version: 1.2.0
|
118
88
|
type: :development
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 1.2.0
|
126
|
-
description: Rails integration for working with Mandrill
|
90
|
+
version_requirements: *70116641862000
|
91
|
+
description: Rails integration for Mandrill
|
127
92
|
email:
|
128
93
|
- gallagher.paul@gmail.com
|
129
94
|
executables: []
|
@@ -145,10 +110,16 @@ files:
|
|
145
110
|
- lib/mandrill/web_hook/event_decorator.rb
|
146
111
|
- lib/mandrill/web_hook/processor.rb
|
147
112
|
- mandrill-rails.gemspec
|
113
|
+
- spec/fixtures/webhook_examples/click.json
|
114
|
+
- spec/fixtures/webhook_examples/inbound.json
|
115
|
+
- spec/fixtures/webhook_examples/inbound_reply.json
|
116
|
+
- spec/fixtures/webhook_examples/open.json
|
117
|
+
- spec/fixtures/webhook_examples/send.json
|
148
118
|
- spec/mandrill-rails/web_hook_processor_spec.rb
|
149
119
|
- spec/mandrill/web_hook/event_decorator_spec.rb
|
150
120
|
- spec/mandrill/web_hook/processor_spec.rb
|
151
121
|
- spec/spec_helper.rb
|
122
|
+
- spec/support/fixtures_helper.rb
|
152
123
|
homepage: https://github.com/evendis/mandrill-rails
|
153
124
|
licenses: []
|
154
125
|
post_install_message:
|
@@ -161,26 +132,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
132
|
- - ! '>='
|
162
133
|
- !ruby/object:Gem::Version
|
163
134
|
version: '0'
|
164
|
-
segments:
|
165
|
-
- 0
|
166
|
-
hash: 1652128042679890864
|
167
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
136
|
none: false
|
169
137
|
requirements:
|
170
138
|
- - ! '>='
|
171
139
|
- !ruby/object:Gem::Version
|
172
140
|
version: '0'
|
173
|
-
segments:
|
174
|
-
- 0
|
175
|
-
hash: 1652128042679890864
|
176
141
|
requirements: []
|
177
142
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.8.
|
143
|
+
rubygems_version: 1.8.15
|
179
144
|
signing_key:
|
180
145
|
specification_version: 3
|
181
|
-
summary:
|
146
|
+
summary: Provides webhook processing and event decoration to make using Mandrill with
|
147
|
+
Rails just that much easier
|
182
148
|
test_files:
|
149
|
+
- spec/fixtures/webhook_examples/click.json
|
150
|
+
- spec/fixtures/webhook_examples/inbound.json
|
151
|
+
- spec/fixtures/webhook_examples/inbound_reply.json
|
152
|
+
- spec/fixtures/webhook_examples/open.json
|
153
|
+
- spec/fixtures/webhook_examples/send.json
|
183
154
|
- spec/mandrill-rails/web_hook_processor_spec.rb
|
184
155
|
- spec/mandrill/web_hook/event_decorator_spec.rb
|
185
156
|
- spec/mandrill/web_hook/processor_spec.rb
|
186
157
|
- spec/spec_helper.rb
|
158
|
+
- spec/support/fixtures_helper.rb
|