1require 'rubygems'
2gem 'soap4r'
3require 'soap/wsdlDriver'
4require 'soap/header/simplehandler'
5require 'defaultDriver.rb'
6require 'authStub.rb'
7<%#Async create options%>
8<%#options = CreateOptions.new(nil,nil,nil,nil,nil,nil,nil,nil,'Asynchronous')%>
9options = nil
10footer = "<table cellpadding='2' cellspacing='0' width='600' border='0' align='center'><tr><td valign='top' align='left' style='line-height: 16px;'><p><font face='verdana' size='1' color='#777777'>This email was sent to: <b>%%emailaddr%%</b><br /><a href='%%subscription_center_url%%' alias='Manage Subscriptions'>Manage Subscriptions</a> | <a href='%%profile_center_url%%' alias='Update Profile'>Update Profile</a> | <a href='%%unsub_center_url%%' alias='Unsubscribe'>One-Click Unsubscribe</a></p><p>This email was sent by: <b>%%Member_Busname%%</b><br />%%Member_Addr%% %%Member_City%%, %%Member_State%% %%Member_PostalCode%% %%Member_Country%%</p><p>We respect your right to privacy - <a href='http://email.exacttarget.com/ETWeb/company.aspx?id=80' alias='View Privacy Policy' style='color: #0000ff'>view our policy</a></p></font></td><td width='145' align='right' valign='center'><a href='http://www.exacttarget.com' title='This email is Powered By Marketing Cloud Engagement' alias='Powered By'><img src='http://email.exacttarget.com/images/Powered_By_1206.jpg' width='124' height='55' alt='This email is Powered By Marketing Cloud Engagement' border='0' /></a></td></tr></table>"
11Params = {
12 :CustomerKey => "API-Test-9",
13 :Name => "API-Test-9",
14 :ID => nil,
15 :ClonedFromID => 2723760,
16 :Subject => "Thank you for subscribing",
17 :HTMLBody => "<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" style=\"border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; padding: 16px 0;\"><tbody><tr><td align=\"left\"><p>Now is the time for all good men to come to the aid of their country.</p><p>Now is the time for all good men to come to the aid of their country.</p><p>Now is the time for all good men to come to the aid of their country.</p><p>Now is the time for all good men to come to the aid of their country.</p><p>Now is the time for all good men to come to the aid of their country.</p></td></tr><tr><td align=\"left\"><custom type=\"content\" name=\"cell2\"></custom></td></tr></tbody></table><custom name=\"opencounter\" type=\"tracking\"></custom>" + footer
18}
19emailObj = Email.new(nil,nil,nil,nil,nil,Params[:ID],nil,Params[:CustomerKey],nil,nil,Params[:Name],nil,nil,Params[:HTMLBody],Params[:HTMLBody].gsub(/<\/?[^>]*>/,""),nil,Params[:Subject],nil,1)
20apiObj = emailObj
21resp = $driver.create(CreateRequest.new(options,[*apiObj]))