/**
  * Get a preview of an email campaign
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param int $campaignId - Valid campaign id
  * @return CampaignPreview
  * @throws CtctException
  */
 public function getPreview($accessToken, $campaignId)
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.campaign_preview'), $campaignId);
     $request = parent::createBaseRequest($accessToken, 'GET', $baseUrl);
     try {
         $response = parent::getClient()->send($request);
     } catch (ClientException $e) {
         throw parent::convertException($e);
     }
     return CampaignPreview::create($response->json());
 }
 public function testGetPreview()
 {
     $response = self::$client->get('/');
     $preview = CampaignPreview::create($response->json());
     $this->assertEquals("Subject Test", $preview->subject);
     $this->assertEquals("*****@*****.**", $preview->fromEmail);
     $this->assertEquals("*****@*****.**", $preview->replyToEmail);
     $htmlContent = "<head ><meta /></head><body><center><table bgcolor=\"#ffffff\" id=\"VWPLINK\" width=\"595\"><tr><td style=\"font-size: 8pt; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;\" width=\"100%\">View this message as a web page\n<a >Click here\n</a></td></tr></table></center><center ><table bgcolor=\"#ffffff\" width=\"595\" ><tr ><td width=\"100%\" ><font color=\"#000000\" face=\"verdana,arial\" size=\"1\" ><div >As a reminder, you're receiving this email because you have expressed an interest in MyCompany. Don't forget to add from_email@example.com to your address book so we'll be sure to land in your inbox! You may unsubscribe if you no longer wish to receive our emails. <div >&nbsp;</div><div >You may <a >unsubscribe</a> if you no longer wish to receive our emails.</div></div></font></td></tr></table></center><img /><p>This is text of the email message.</p><br />\n<table bgcolor=\"#ffffff\" padding=\"0\" width=\"100%\" ><tr align=\"center\" ><td ><table bgcolor=\"#ffffff\" width=\"595\" ><tr ><td colspan=\"2\" ><font face=\"tahoma,sans-serif\" size=\"1\" ><b ><a >Click here to forward this message</a></b></font><br />\n<br />\n</td></tr>\n<tr ><td ><FooterContent ><a ><img /></a></FooterContent></td><td align=\"right\" ><font face=\"tahoma,sans-serif\" size=\"1\" ><FooterLogo ><a ><img /></a></FooterLogo></font>\n</td>\n</tr><tr ><td colspan=\"2\" ><font face=\"tahoma,sans-serif\" size=\"1\" ><FooterContent ><div >This email was sent to {Email Address} by <a >rmarcucella@constantcontact.com</a> <span style=\"color: #bababa;\" > | </span> &nbsp; </div>\n<div ><a >Update Profile/Email Address</a> <span style=\"color: #bababa;\" >|</span> Instant removal with <a >SafeUnsubscribe</a>&trade; <span style=\"color: #bababa;\" >|</span> <a >Privacy Policy</a>.</div></FooterContent></font>\n</td>\n</tr>\n<tr ><td colspan=\"2\" ><font face=\"tahoma,sans-serif\" size=\"1\" ><br />My Organization | 123 Maple Street | Suite 1 | Anytown | MA | 01444</font>\n</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n<br />\n&lt;/body&gt;";
     $this->assertEquals($htmlContent, $preview->htmlContent);
     $textContent = "View this message as a web page\nClick here\nhttp://campaign.r20.l1.constantcontact.com/render?ca=025eff86-6378-4f53-9301-5897ecf50b30&c={Contact Id}&ch={Contact Id}\n\nAs a reminder, you're receiving this email because you have expressed an interest in MyCompany. Don't forget to add from_email@example.com to your address book so we'll be sure to land in your inbox! You may unsubscribe if you no longer wish to receive our emails. You may unsubscribe\nhttp://visitor.l1.constantcontact.com/do?p=un&m=001JZtDyxcvPiye1EthMqSLGA%3D%3D&ch={Contact Id}&ca=025eff86-6378-4f53-9301-5897ecf50b30\n if you no longer wish to receive our emails.\n------------------------------------------------------------\nThis is the text of the email message.\n\nClick here to forward this message\nhttp://ui.l1.constantcontact.com/sa/fwtf.jsp?llr=cqmhk9aab&m=1100394770946&ea=rmarcucella%40constantcontact.com&a=1100400205633\n\n\n\n\n\nThis email was sent to {Email Address} by rmarcucella@constantcontact.com.\n\nUpdate Profile/Email Address\nhttp://visitor.l1.constantcontact.com/do?p=oo&m=001JZtDyxcvPiye1EthMqSLGA%3D%3D&ch={Contact Id}&ca=025eff86-6378-4f53-9301-5897ecf50b30\n\n\nInstant removal with SafeUnsubscribe(TM)\nhttp://visitor.l1.constantcontact.com/do?p=un&m=001JZtDyxcvPiye1EthMqSLGA%3D%3D&ch={Contact Id}&ca=025eff86-6378-4f53-9301-5897ecf50b30\n\n\nPrivacy Policy:\nhttp://ui.l1.constantcontact.com/roving/CCPrivacyPolicy.jsp\n\n\n\n\n\nOnline Marketing by\nhttp://img.l1.constantcontact.com/letters/images/cc-logo-color-sm.gif\nhttp://www.constantcontact.com\n\n\n\nMy Organization | 123 Maple Street | Suite 1 | Anytown | MA | 01444\n\n\n\n\n\n\n\n\n";
     $this->assertEquals($textContent, $preview->textContent);
 }