mandrill-rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ == 1.0.1
2
+ * When specific format not requested, EventDecorator#message_body returns the first available body content. See \#8
3
+
1
4
  == 1.0.0
2
5
  * added support for Mandrill webhook authentication (thanks to @zshannon for the contribution)
3
6
  * stepped to 1.0.0 (applying Semantic Versioning principles; see http://semver.org/)
@@ -3,5 +3,5 @@ module Mandrill
3
3
  end
4
4
  end
5
5
  unless defined?(Mandrill::Rails::VERSION)
6
- Mandrill::Rails::VERSION = "1.0.0"
6
+ Mandrill::Rails::VERSION = "1.0.1"
7
7
  end
@@ -98,8 +98,9 @@ class Mandrill::WebHook::EventDecorator < Hash
98
98
  end
99
99
 
100
100
  # Returns the +format+ (:text,:html,:raw) message body.
101
+ # If +format+ is not specified, it will return the first available message content in order: text, html, raw.
101
102
  # Applicable events: inbound
102
- def message_body(format=:text)
103
+ def message_body(format=nil)
103
104
  case format
104
105
  when :text
105
106
  msg['text']
@@ -107,6 +108,8 @@ class Mandrill::WebHook::EventDecorator < Hash
107
108
  msg['html']
108
109
  when :raw
109
110
  msg['raw_msg']
111
+ else
112
+ msg['text'] || msg['html'] || msg['raw_msg']
110
113
  end
111
114
  end
112
115
 
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{Rails integration for Mandrill}
8
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
+ gem.license = 'MIT'
10
11
 
11
12
  gem.files = `git ls-files`.split($\)
12
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -0,0 +1,116 @@
1
+ [
2
+ {
3
+ "event": "inbound",
4
+ "ts": 1385559214,
5
+ "msg": {
6
+ "raw_msg": "Received: from xxxx.xxxx.xxxxxxx.net (mail.xxxxx.co.uk [99.99.99.99])\n\tby ip-99-99-99-99 (Postfix) with ESMTP id 122333333\n\tfor <offer-88206@inbound.xxxxx.co.uk>; Wed, 27 Nov 2013 13:33:32 +0000 (UTC)\nReceived: from xxxx.xxxx.xxxx.net (localhost.localdomain [127.0.0.1])\n\tby localhost (Email Security Appliance) with SMTP id F3EE6101E628_295E809B\n\tfor <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)\nReceived: from xxxx.xxxx.co.uk (unknown [53.247.144.158])\n\tby xxxx.xxxx.xxxx.net (Sophos Email Appliance) with ESMTP id E041E10CAFD0_295E809F\n\tfor <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)\nImportance: Normal\nX-Priority: 3 (Normal)\nIn-Reply-To: <5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>\nReferences: <5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>\nSubject: Re: Leeroy, you have a question from Toni about offer 88206\nMIME-Version: 1.0\nFrom: xxxx.xxxx@xxxx.co.uk\nTo: <offer-88206@inbound.xxxx.co.uk>\nCc: xxxx.xxxx@xxxx.co.uk\nMessage-ID: <OFA804C4DE.C8619FB4-ON80257C30.004A7A89-80257C30.004A7A94@xxxx.co.uk>\nDate: Wed, 27 Nov 2013 13:33:30 +0000\nX-Mailer: Lotus Domino Web Server Release 8.5.3FP4 March 27, 2013\nX-MIMETrack: Serialize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March\n 27, 2013) at 11\/27\/2013 01:33:30 PM,\n\tSerialize complete at 11\/27\/2013 01:33:30 PM,\n\tItemize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at\n 11\/27\/2013 01:33:30 PM,\n\tSerialize by Router on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at\n 11\/27\/2013 01:33:31 PM,\n\tSerialize complete at 11\/27\/2013 01:33:31 PM\nX-KeepSent: A804C4DE:C8619FB4-80257C30:004A7A89;\n type=4; name=$KeepSent\nContent-Transfer-Encoding: quoted-printable\nContent-Type: text\/html;\n\tcharset=ISO-8859-1\n\n<FONT face=3D\"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif\" size=\n=3D2>\n<DIV>Hi Toni,<\/DIV><DIV>&nbsp;<\/DIV><DIV>This is James, the sales manager u=\nsing Leeroy's account! Leeroy has had to run off as his wife is giving birt=\nh!<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Can you tell me the model of interest, and your annua=\nl mileage and target payment, we can buildd a deal for you.<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Kind regards<BR><\/DIV><DIV>James (on Leeroy's mail!)<=\nBR>\n<BR>Kind regards<BR><BR>Leeroy xxxx<BR>A>\n<BR><BR>xxxx Group<BR>xxxxs a trading name of and Hamp=\nshire Limited. BR>\n<BR>This e-mail is confidential and may also be privileged. If you are not =\nthe..<BR>\n<DIV><BR><\/DIV><FONT color=3D#990099>-----&lt;offer-88206@xxxx.co.uk&gt; =\nwrote: -----<BR>\n<BR><\/FONT><BLOCKQUOTE style=3D\"BORDER-LEFT: #000000 2px solid; PADDING-LEF=\nT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px\">\nTo: Leeroy xxxx &lt;xxxxx@xxxx.co.uk&gt;<BR>From: &lt;offer-8=\n8206@inbound.xxxx.co.uk&gt;<BR>\nSent by: &lt;offer-88206@xxxx.co.uk&gt;<BR>Date: 11\/27\/2013 12:10PM<BR>\nSubject: Leeroy, you have a question from Toni about offer 88206<=\nBR>\n<BR><CENTER><TABLE style=3D\"PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #f4f4f4;=\n MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-CO=\nLLAPSE: collapse; HEIGHT: 100%; PADDING-TOP: 0px; mso-table-lspace: 0pt; ms=\no-table-rspace: 0pt\" id=3DbodyTable border=3D0 cellSpacing=3D0 cellPadding=\n=3D0 width=3D\"100%\" height=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN PREHEADER --><TABLE style=3D\"BACKGROUND-COLOR: #ffffff; BORDE=\nR-COLLAPSE: collapse; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-=\ntable-rspace: 0pt\" id=3DtemplatePreheader border=3D0 cellSpacing=3D0 cellPa=\ndding=3D10 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #dddddd; FONT-SIZE: 12px; mso-table=\n-lspace: 0pt; mso-table-rspace: 0pt\" class=3DpreheaderContent vAlign=3Dtop>\n--- WRITE REPLY ABOVE THIS LINE --- <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR>\n<\/TBODY><\/TABLE><!-- END PREHEADER \\\\ --><!-- \/\/ BEGIN TEMPLATE SECTIONS --=\n><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-tabl=\ne-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN HEADER --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-tabl=\ne-lspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPaddin=\ng=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BACKGROUND-COLOR: #00a4ff; BORDER-COLLAPSE: collaps=\ne; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; =\nmso-table-rspace: 0pt\" id=3DtemplateHeader vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT:=\n 100%; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; FO=\nNT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 20px; VERTICAL-ALIGN: middle; =\nFONT-WEIGHT: bold; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspac=\ne: 0pt\" class=3DheaderContent>\n<A style=3D\"COLOR: #00a4ff; FONT-WEIGHT: normal; TEXT-DECORATION: underline=\n\" href=3D\"http:\/\/mandrillapp.com\/track\/click.php?u=3D9468237&amp;id=3Dc957c=\nf5cc63e442eaed046d71250d452&amp;url=3Dhttp%3A%2F%2Fquotes.xxxx.co.uk&amp;=\nurl=5Fid=3Db934b2af78697032efe57f20affdda2b09fb10ca\" target=3D=5Fblank>\n<IMG style=3D\"LINE-HEIGHT: 150%; BORDER-RIGHT-WIDTH: 0px; OUTLINE-STYLE: no=\nne; MAX-WIDTH: 600px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORD=\nER-LEFT-WIDTH: 0px; TEXT-DECORATION: none\" id=3DheaderImage src=3D\"http:\/\/g=\nallery.mailchimp.com\/d97bdc4f44006e12654e4f1b6\/images\/xxxx=5Fnewsletter=\n=5Fheader=5Fleft=5Faligned.png\" width=3D600 height=3D100 mc:allowtext=3D\"\" =\nmc:allowdesigner=3D\"\" mc:label=3D\"header=5Fimage\">\n<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END HEADER \\\\=\n --><\/TD>\n<\/TR><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso=\n-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN BODY --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-=\nlspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=\n=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"PADDING-BOTTOM: 20px; BACKGROUND-COLOR: #ffffff; PA=\nDDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TO=\nP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace=\n: 0pt; mso-table-rspace: 0pt\" id=3DtemplateBody vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 16px; FONT-WEIG=\nHT: 100; PADDING-TOP: 24px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" c=\nlass=3DbodyContent vAlign=3Dtop>\n<P>Hola Leeroy xxxx,<\/P><BR>A xxx user (Offer id: #088206), Toni from Luton, Luton, has sent you a new message about the xxx they =\nrequested offers for: <P>\n<\/P><BLOCKQUOTE style=3D\"PADDING-BOTTOM: 10px; BACKGROUND-COLOR: #eee; PADD=\nING-LEFT: 10px; PADDING-RIGHT: 10px; COLOR: #444; PADDING-TOP: 10px\">\nHi Leeroy Thank you for your email. Can you please send me some blah blah blah Thanks again Toni <\/BLOCKQUOTE>\n<BR>Login to your dashboard to <P><\/P><TABLE style=3D\"BORDER-COLLAPSE: coll=\napse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" align=3Dmiddle>\n<TABLE class=3DtemplateButton border=3D0 cellSpacing=3D0 cellPadding=3D20 w=\nidth=3D300>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; BORDER-COLLA=\nPSE: collapse; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WE=\nIGHT: 300; TEXT-DECORATION: none; mso-table-lspace: 0pt; mso-table-rspace: =\n0pt\" class=3DtemplateButtonContent vAlign=3Dcenter align=3Dmiddle>\n<A style=3D\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; FONT-FAMILY: Arial; COLO=\nR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none\" Respond directly to Toni by replying to this email. Ne=\ned help? Call John, 02020202020. <P>\n<\/P><BR>Regards, <P><\/P><BR>The xxxx team <P><\/P><\/TD><\/TR><\/TBODY><\/TABL=\nE>\n<\/TD><\/TR><\/TBODY><\/TABLE><!-- END BODY \\\\ --><\/TD><\/TR><TR><TD style=3D\"BO=\nRDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAli=\ngn=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN FOOTER --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-tabl=\ne-lspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPaddin=\ng=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"PADDING-BOTTOM: 20px; PADDING-LEFT: 20px; PADDING-R=\nIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; PADDING-TOP: =\n20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=3DtemplateFooter vAl=\nign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table=\n-lspace: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop col=\nSpan=3D3>\n<A style=3D\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" h=\nref=3D\"http:\/\/mandrillapp.com\/track\/click.php?u=&amp;id==\nc6&amp;url=3Dhttp%3A%2F%2Ftwitter.com%2F&amp;=\nurl=5Fid=\" target=3D=5Fself>\nFollow on Twitter<\/A>&nbsp;&nbsp;&nbsp;<A style=3D\"COLOR: #606060; FONT-WEI=\nGHT: 100; TEXT-DECORATION: underline\" href=3D\"http:\/\/mandrillapp.com\/track\/=\nclick.php?u=&amp;id=&amp;url=3Dh=\nttp%3A%2F%2Fwww.facebook.com%2F&amp;url=5Fid==\nfc5dadc29bc1e18f56\" target=3D=5Fself>\nLike on Facebook<\/A>&nbsp;<\/TD><\/TR><TR><TD style=3D\"TEXT-ALIGN: left; PADD=\nING-BOTTOM: 20px; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY=\n: Arial; COLOR: #686c70; FONT-SIZE: 10px; PADDING-TOP: 20px; mso-table-lspa=\nce: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop>\n<EM>Copyright =A9 2013 Ltd, All rights reserved.<\/EM> <BR><BR>\n<\/TD><\/TR><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLL=\nAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-ta=\nble-lspace: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop =\ncolSpan=3D3>\n<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN>\n <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END FOOTER \\\\ -->=\n<\/TD>\n<\/TR><\/TBODY><\/TABLE><!-- END TEMPLATE SECTIONS \\\\ --><\/TD><\/TR><\/TBODY>\n<\/TABLE><\/CENTER><IMG src=3D\"http:\/\/mandrillapp.com\/track\/open.php?u==\n237&id=3Dc95\" width=3D1 height=3D1>\n <BR><\/BLOCKQUOTE><BR><\/DIV><\/FONT>",
7
+ "headers": {
8
+ "Received": [
9
+ "from xxxx.xxx.xxx.net (mail.xxx.co.uk [00.00.00.00]) by ip-00-00-00-00 (Postfix) with ESMTP id 642254A820F for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 13:33:32 +0000 (UTC)",
10
+ "from xxxx.xxxx.xxxx.xxxx (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id F3EE6101E628_295E809B for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)",
11
+ "from xxxx.xxxx.co.uk (unknown [00.00.00.00]) by xxxx.xxxx.xxxx.net (Sophos Email Appliance) with ESMTP id E041E10CAFD0_295E809F for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)"
12
+ ],
13
+ "Importance": "Normal",
14
+ "X-Priority": "3 (Normal)",
15
+ "In-Reply-To": "<5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>",
16
+ "References": "<5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>",
17
+ "Subject": "Re: Leeroy, you have a question from Toni about offer 88206",
18
+ "Mime-Version": "1.0",
19
+ "From": "xxxx.xxxx@xxxx.co.uk",
20
+ "To": "<offer-88206@inbound.xxxx.co.uk>",
21
+ "Cc": "xxxx.xxxx@xxxx.co.uk",
22
+ "Message-Id": "<OFA804C4DE.C8619FB4-ON80257C30.004A7A89-80257C30.004A7A94@xxxxx.co.uk>",
23
+ "Date": "Wed, 27 Nov 2013 13:33:30 +0000",
24
+ "X-Mailer": "Lotus Domino Web Server Release 8.5.3FP4 March 27, 2013",
25
+ "X-Mimetrack": "Serialize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:30 PM, Serialize complete at 11\/27\/2013 01:33:30 PM, Itemize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:30 PM, Serialize by Router on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:31 PM, Serialize complete at 11\/27\/2013 01:33:31 PM",
26
+ "X-Keepsent": "A804C4DE:C8619FB4-80257C30:004A7A89; type=4; name=$KeepSent",
27
+ "Content-Transfer-Encoding": "quoted-printable",
28
+ "Content-Type": "text\/html; charset=ISO-8859-1"
29
+ },
30
+ "html": "<FONT face=\"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif\" size=2>\n<DIV>Hi Toni,<\/DIV><DIV>&nbsp;<\/DIV><DIV>This is James, the sales manager using Leeroy's account! Leeroy has had to run off as his wife is giving birth!<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Can you tell me the model of interest, and your annual mileage and target payment, we can buildd a deal for you.<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Kind regards<BR><\/DIV><DIV>James (on Leeroy's mail!)<BR>\n<BR>Kind regards<BR>90099>-----&lt;offer-88206@xxxx.co.uk&gt; wrote: -----<BR>\n<BR><\/FONT><BLOCKQUOTE style=\"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px\">\nTo: Leeroy xxxx &lt;xxxx@xxxxx.co.uk&gt;<BR>From: &lt;offer-88206@inbound.xxxx.co.uk&gt;<BR>\nSent by: &lt;offer-88206@xxxx.co.uk&gt;<BR>Date: 11\/27\/2013 12:10PM<BR>\nSubject: Leeroy, you have a question from Toni about offer 88206<BR>\n<BR><CENTER><TABLE style=\"PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; HEIGHT: 100%; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=bodyTable border=0 cellSpacing=0 cellPadding=0 width=\"100%\" height=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN PREHEADER --><TABLE style=\"BACKGROUND-COLOR: #ffffff; BORDER-COLLAPSE: collapse; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templatePreheader border=0 cellSpacing=0 cellPadding=10 width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #dddddd; FONT-SIZE: 12px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=preheaderContent vAlign=top>\n--- WRITE REPLY ABOVE THIS LINE --- <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR>\n<\/TBODY><\/TABLE><!-- END PREHEADER \\\\ --><!-- \/\/ BEGIN TEMPLATE SECTIONS --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN HEADER --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"BACKGROUND-COLOR: #00a4ff; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateHeader vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 100%; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 20px; VERTICAL-ALIGN: middle; FONT-WEIGHT: bold; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=headerContent>\n<A style=\"COLOR: #00a4ff; FONT-WEIGHT: normal; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fquotes.xxxx.co.uk&amp;url_id=b934b2af78697032efe57f20affdda2b09fb10ca\" target=_blank>\n<IMG style=\"LINE-HEIGHT: 150%; BORDER-RIGHT-WIDTH: 0px; OUTLINE-STYLE: none; MAX-WIDTH: 600px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; TEXT-DECORATION: none\" id=headerImage src=\"http:\/\/gallery.mailchimp.com\/d97bdc4f44006e12654e4f1b6\/images\/xxxx.png\" width=600 height=100 mc:allowtext=\"\" mc:allowdesigner=\"\" mc:label=\"header_image\">\n<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END HEADER \\\\ --><\/TD>\n<\/TR><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN BODY --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"PADDING-BOTTOM: 20px; BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateBody vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 16px; FONT-WEIGHT: 100; PADDING-TOP: 24px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=bodyContent vAlign=top>\n<P>Hola Leeroy xxxx,<\/P><BR>A xxxx user (Offer id: #088206), Toni from Luton, Luton, has sent you a new message about the xxxx they requested offers for: <P>\n<\/P><BLOCKQUOTE style=\"PADDING-BOTTOM: 10px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; COLOR: #444; PADDING-TOP: 10px\">\nHi Leeroy Thank you for your email. Can you please send me some business lease quotes and\/or PCP quotations as I am looking for this car to be my company car. Thanks again Toni <\/BLOCKQUOTE>\n<BR>Login to your dashboard to <P><\/P><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" align=middle>\n<TABLE class=templateButton border=0 cellSpacing=0 cellPadding=20 width=300>\n<TBODY><TR><TD style=\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateButtonContent vAlign=center align=middle>\n<A style=\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fquotes.xxxx.co.uk%2Fdealers%2Foffers%2F88206&amp;url_id=78aafdf8a19763ba7e0967d15e22e4b499d1a2b0\" target=blank>\nSee the details of this lead<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY>\n<\/TABLE><BR><SPAN style=\"COLOR: #2ecc71; FONT-WEIGHT: 500\">NEW FEATURE <\/SPAN>\n&amp;dash; Respond directly to Toni by replying to this email. Need help? Call John, 02076111065. <P>\n<\/P><BR>Regards, <P><\/P><BR>The xxxx team <P><\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<\/TD><\/TR><\/TBODY><\/TABLE><!-- END BODY \\\\ --><\/TD><\/TR><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN FOOTER --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"PADDING-BOTTOM: 20px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateFooter vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top colSpan=3>\n<A style=\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Ftwitter.com%2Fxxxx&amp;url_id=35530deb3e3923de4d66154d775dcf7307d15aa1\" target=_self>\nFollow on Twitter<\/A>&nbsp;&nbsp;&nbsp;<A style=\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fwww.facebook.com%2Fxxxx&amp;url_id=a0de7c9d161d1d0f65433dfc5dadc29bc1e18f56\" target=_self>\nLike on Facebook<\/A>&nbsp;<\/TD><\/TR><TR><TD style=\"TEXT-ALIGN: left; PADDING-BOTTOM: 20px; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top>\n<EM>Copyright \u00a9 2013 Digital Blurb Ltd, All rights reserved.<\/EM> <BR><BR>\n<\/TD><\/TR><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top colSpan=3>\n<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN>\n <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END FOOTER \\\\ --><\/TD>\n<\/TR><\/TBODY><\/TABLE><!-- END TEMPLATE SECTIONS \\\\ --><\/TD><\/TR><\/TBODY>\n<\/TABLE><\/CENTER><IMG src=\"http:\/\/mandrillapp.com\/track\/open.php?u=9468237&id=c957cf5cc63e442eaed046d71250d452\" width=1 height=1>\n <BR><\/BLOCKQUOTE><BR><\/DIV><\/FONT>",
31
+ "from_email": "Leeroy.xxxx@xxxx.co.uk",
32
+ "to": [
33
+ [
34
+ "offer-88206@inbound.xxxx.co.uk",
35
+ null
36
+ ]
37
+ ],
38
+ "cc": [
39
+ [
40
+ "xxxx.xxxx@xxxx.co.uk",
41
+ null
42
+ ]
43
+ ],
44
+ "subject": "Re: Leeroy, you have a question from Toni about offer 88206",
45
+ "spam_report": {
46
+ "score": 3.1,
47
+ "matched_rules": [
48
+ {
49
+ "name": "URIBL_BLOCKED",
50
+ "score": 0,
51
+ "description": "ADMINISTRATOR NOTICE: The query to URIBL was blocked."
52
+ },
53
+ {
54
+ "name": null,
55
+ "score": 0,
56
+ "description": null
57
+ },
58
+ {
59
+ "name": "more",
60
+ "score": 0,
61
+ "description": "information."
62
+ },
63
+ {
64
+ "name": "xxxxxxxx.co.uk]",
65
+ "score": 0,
66
+ "description": null
67
+ },
68
+ {
69
+ "name": "RCVD_IN_DNSWL_NONE",
70
+ "score": 0,
71
+ "description": "RBL: Sender listed at http:\/\/www.xxxx.org\/, no"
72
+ },
73
+ {
74
+ "name": "listed",
75
+ "score": 0,
76
+ "description": "in list.xxxx.org]"
77
+ },
78
+ {
79
+ "name": "URI_HEX",
80
+ "score": 1.3,
81
+ "description": "URI: URI hostname has long hexadecimal sequence"
82
+ },
83
+ {
84
+ "name": "HTML_MESSAGE",
85
+ "score": 0,
86
+ "description": "BODY: HTML included in message"
87
+ },
88
+ {
89
+ "name": "MIME_HTML_ONLY",
90
+ "score": 1.1,
91
+ "description": "BODY: Message only has text\/html MIME parts"
92
+ },
93
+ {
94
+ "name": "HTML_MIME_NO_HTML_TAG",
95
+ "score": 0.6,
96
+ "description": "HTML-only message, but there is no HTML tag"
97
+ }
98
+ ]
99
+ },
100
+ "dkim": {
101
+ "signed": false,
102
+ "valid": false
103
+ },
104
+ "spf": {
105
+ "result": "none",
106
+ "detail": ""
107
+ },
108
+ "email": "offer-88206@inbound.xxxx.co.uk",
109
+ "tags": [
110
+
111
+ ],
112
+ "sender": null,
113
+ "template": null
114
+ }
115
+ }
116
+ ]
@@ -0,0 +1,40 @@
1
+ [
2
+ {
3
+ "event": "inbound",
4
+ "msg": {
5
+ "attachments": {
6
+ "sample.txt": {
7
+ "content": "This is \na sample\ntext file\n",
8
+ "name": "sample.txt",
9
+ "type": "text/plain"
10
+ }
11
+ },
12
+ "email": "inbox@example.com",
13
+ "from_email": "from@example.com",
14
+ "from_name": "Paul Gallagher",
15
+ "headers": {
16
+ "Content-Type": "multipart/mixed; boundary=e89a8f3ba2bfabfe6204d5a93196",
17
+ "Date": "Thu, 14 Feb 2013 14:16:06 +0800",
18
+ "Dkim-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=9klOiPBS1fmHfWy4y/n63i9UkCsWeaWEoRK/Xoil3rc=; b=fd8OUm18616MYkDeCovUfcdp+/2eBDeO+BjmvuZp6DG0ltA6LdVOGi5QYzLlBH6h88 iQfCFc/6hXpI1gt62NPXetP6gjJwsYKzCUdsZ34OMmtDti0xD+Fs2Evs+LdRt+ubGWud elz56NANGT+kI3qw5TVtw4FZBiMEdH3m6cSgpUW4YmM0yRGXB8tLeeFhTNbnxeRx6U4P /psf+5I941CJrt7OtLLUwN4cVtUoflNnQcK+zXnOifmwHX8/TGsVcP2O8EQIdYS5eZnr U2tRJM3y7ADfUf81CkM2uwhaKt3cZJh3rdBUUv0TuHTob8FSUF0M9DV85YfKRgmdZSuY IR8w==",
19
+ "From": "Paul Gallagher <from@example.com>",
20
+ "Message-Id": "<CAGBx7Gg-CUco7NNsA79Ss1QMFTaXvyWnqkt26=RJr-ktSoRB0A@mail.gmail.com>",
21
+ "Mime-Version": "1.0",
22
+ "Received": [
23
+ "from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by ip-10-31-147-25 (Postfix) with ESMTPS id CA036151A005 for <inbox@example.com>; Thu, 14 Feb 2013 06:16:06 +0000 (UTC)",
24
+ "by mail-ia0-f180.google.com with SMTP id f27so2031783iae.11 for <inbox@example.com>; Wed, 13 Feb 2013 22:16:06 -0800 (PST)",
25
+ "by 10.64.28.212 with HTTP; Wed, 13 Feb 2013 22:16:06 -0800 (PST)"
26
+ ],
27
+ "Subject": "test 2 with attachment",
28
+ "To": "inbox@example.com",
29
+ "X-Received": "by 10.50.88.228 with SMTP id bj4mr16622425igb.85.1360822566387; Wed, 13 Feb 2013 22:16:06 -0800 (PST)"
30
+ },
31
+ "raw_msg": "Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180])\n\tby ip-10-31-147-25 (Postfix) with ESMTPS id CA036151A005\n\tfor <inbox@example.com>; Thu, 14 Feb 2013 06:16:06 +0000 (UTC)\nReceived: by mail-ia0-f180.google.com with SMTP id f27so2031783iae.11\n for <inbox@example.com>; Wed, 13 Feb 2013 22:16:06 -0800 (PST)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20120113;\n h=mime-version:x-received:date:message-id:subject:from:to\n :content-type;\n bh=9klOiPBS1fmHfWy4y/n63i9UkCsWeaWEoRK/Xoil3rc=;\n b=fd8OUm18616MYkDeCovUfcdp+/2eBDeO+BjmvuZp6DG0ltA6LdVOGi5QYzLlBH6h88\n iQfCFc/6hXpI1gt62NPXetP6gjJwsYKzCUdsZ34OMmtDti0xD+Fs2Evs+LdRt+ubGWud\n elz56NANGT+kI3qw5TVtw4FZBiMEdH3m6cSgpUW4YmM0yRGXB8tLeeFhTNbnxeRx6U4P\n /psf+5I941CJrt7OtLLUwN4cVtUoflNnQcK+zXnOifmwHX8/TGsVcP2O8EQIdYS5eZnr\n U2tRJM3y7ADfUf81CkM2uwhaKt3cZJh3rdBUUv0TuHTob8FSUF0M9DV85YfKRgmdZSuY\n IR8w==\nMIME-Version: 1.0\nX-Received: by 10.50.88.228 with SMTP id bj4mr16622425igb.85.1360822566387;\n Wed, 13 Feb 2013 22:16:06 -0800 (PST)\nReceived: by 10.64.28.212 with HTTP; Wed, 13 Feb 2013 22:16:06 -0800 (PST)\nDate: Thu, 14 Feb 2013 14:16:06 +0800\nMessage-ID: <CAGBx7Gg-CUco7NNsA79Ss1QMFTaXvyWnqkt26=RJr-ktSoRB0A@mail.gmail.com>\nSubject: test 2 with attachment\nFrom: Paul Gallagher <from@example.com>\nTo: inbox@example.com\nContent-Type: multipart/mixed; boundary=e89a8f3ba2bfabfe6204d5a93196\n\n--e89a8f3ba2bfabfe6204d5a93196\nContent-Type: multipart/alternative; boundary=e89a8f3ba2bfabfe5b04d5a93194\n\n--e89a8f3ba2bfabfe5b04d5a93194\nContent-Type: text/plain; charset=UTF-8\n\nthis one has a text file attachment\n\n--e89a8f3ba2bfabfe5b04d5a93194\nContent-Type: text/html; charset=UTF-8\n\n<div dir=\"ltr\">this one has a text file attachment</div>\n\n--e89a8f3ba2bfabfe5b04d5a93194--\n--e89a8f3ba2bfabfe6204d5a93196\nContent-Type: text/plain; charset=US-ASCII; name=\"sample.txt\"\nContent-Disposition: attachment; filename=\"sample.txt\"\nContent-Transfer-Encoding: base64\nX-Attachment-Id: f_hd5im61u0\n\nVGhpcyBpcyAKYSBzYW1wbGUKdGV4dCBmaWxlCg==\n--e89a8f3ba2bfabfe6204d5a93196--",
32
+ "sender": null,
33
+ "subject": "test 2 with attachment",
34
+ "tags": [],
35
+ "text": "this one has a text file attachment\n\n",
36
+ "to": [ [ "inbox@example.com", null ] ]
37
+ },
38
+ "ts": 1360822567
39
+ }
40
+ ]
@@ -0,0 +1,6 @@
1
+ [
2
+ {
3
+ "event": "inbound",
4
+ "ts": 1344498257
5
+ }
6
+ ]
@@ -171,6 +171,40 @@ describe Mandrill::WebHook::EventDecorator do
171
171
  let(:format) { :raw }
172
172
  it { should eql(expected) }
173
173
  end
174
+
175
+ context "when msg is missing" do
176
+ let(:raw_event) { webhook_example_event('inbound_without_msg') }
177
+ let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
178
+
179
+ subject { event_payload }
180
+ its(:message_body) { should be_nil }
181
+ its(:message_id) { should be_nil }
182
+ its(:sender_email) { should be_nil }
183
+ end
184
+
185
+ context "with html-only payload; see github issue \#8" do
186
+ let(:raw_event) { webhook_example_event('inbound_html_only') }
187
+ let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
188
+
189
+ subject { event_payload }
190
+ its(:message_body) { should_not be_nil }
191
+ it { subject.message_body(:html).should_not be_nil }
192
+ it { subject.message_body(:text).should be_nil }
193
+ its(:message_id) { should eql('<OFA804C4DE.C8619FB4-ON80257C30.004A7A89-80257C30.004A7A94@xxxxx.co.uk>') }
194
+ its(:sender_email) { should eql('Leeroy.xxxx@xxxx.co.uk') }
195
+ end
196
+
197
+ context "with text-only payload" do
198
+ let(:raw_event) { webhook_example_event('inbound_text_only') }
199
+ let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
200
+
201
+ subject { event_payload }
202
+ its(:message_body) { should_not be_nil }
203
+ it { subject.message_body(:html).should be_nil }
204
+ it { subject.message_body(:text).should_not be_nil }
205
+ its(:message_id) { should eql('<CAGBx7Gg-CUco7NNsA79Ss1QMFTaXvyWnqkt26=RJr-ktSoRB0A@mail.gmail.com>') }
206
+ its(:sender_email) { should eql('from@example.com') }
207
+ end
174
208
  end
175
209
 
176
210
  describe "#attachments" do
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: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
12
+ date: 2013-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -136,10 +136,13 @@ files:
136
136
  - spec/fixtures/webhook_examples/click.json
137
137
  - spec/fixtures/webhook_examples/click_with_signature.json
138
138
  - spec/fixtures/webhook_examples/inbound.json
139
+ - spec/fixtures/webhook_examples/inbound_html_only.json
139
140
  - spec/fixtures/webhook_examples/inbound_reply.json
141
+ - spec/fixtures/webhook_examples/inbound_text_only.json
140
142
  - spec/fixtures/webhook_examples/inbound_with_multiple_attachments.json
141
143
  - spec/fixtures/webhook_examples/inbound_with_pdf_attachment.json
142
144
  - spec/fixtures/webhook_examples/inbound_with_txt_attachment.json
145
+ - spec/fixtures/webhook_examples/inbound_without_msg.json
143
146
  - spec/fixtures/webhook_examples/open.json
144
147
  - spec/fixtures/webhook_examples/send.json
145
148
  - spec/mandrill-rails/web_hook_processor_spec.rb
@@ -149,7 +152,8 @@ files:
149
152
  - spec/spec_helper.rb
150
153
  - spec/support/fixtures_helper.rb
151
154
  homepage: https://github.com/evendis/mandrill-rails
152
- licenses: []
155
+ licenses:
156
+ - MIT
153
157
  post_install_message:
154
158
  rdoc_options: []
155
159
  require_paths:
@@ -180,10 +184,13 @@ test_files:
180
184
  - spec/fixtures/webhook_examples/click.json
181
185
  - spec/fixtures/webhook_examples/click_with_signature.json
182
186
  - spec/fixtures/webhook_examples/inbound.json
187
+ - spec/fixtures/webhook_examples/inbound_html_only.json
183
188
  - spec/fixtures/webhook_examples/inbound_reply.json
189
+ - spec/fixtures/webhook_examples/inbound_text_only.json
184
190
  - spec/fixtures/webhook_examples/inbound_with_multiple_attachments.json
185
191
  - spec/fixtures/webhook_examples/inbound_with_pdf_attachment.json
186
192
  - spec/fixtures/webhook_examples/inbound_with_txt_attachment.json
193
+ - spec/fixtures/webhook_examples/inbound_without_msg.json
187
194
  - spec/fixtures/webhook_examples/open.json
188
195
  - spec/fixtures/webhook_examples/send.json
189
196
  - spec/mandrill-rails/web_hook_processor_spec.rb