samples/sample-email.rb in fuelsdk-0.0.3 vs samples/sample-email.rb in fuelsdk-0.0.4
- old
+ new
@@ -1,14 +1,14 @@
require 'fuelsdk'
require_relative 'sample_helper'
begin
- stubObj = FuelSDK::ET_Client.new auth
+ stubObj = FuelSDK::Client.new auth
# Retrieve All Email with GetMoreResults
p '>>> Retrieve All Email with GetMoreResults'
- getHTMLBody = FuelSDK::ET_Email.new()
+ getHTMLBody = FuelSDK::Email.new()
getHTMLBody.authStub = stubObj
getHTMLBody.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Name","Folder","CategoryID","HTMLBody","TextBody","Subject","IsActive","IsHTMLPaste","ClonedFromID","Status","EmailType","CharacterSet","HasDynamicSubjectLine","ContentCheckStatus","Client.PartnerClientKey","ContentAreas","CustomerKey"]
getResponse = getHTMLBody.get
p 'Retrieve Status: ' + getResponse.status.to_s
p 'Code: ' + getResponse.code.to_s
@@ -31,11 +31,11 @@
NameOfTestEmail = "RubySDKEmail"
# Create Email
p '>>> Create Email'
- postHTMLBody = FuelSDK::ET_Email.new
+ postHTMLBody = FuelSDK::Email.new
postHTMLBody.authStub = stubObj
postHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "Subject" => "Created Using the RubySDK", "HTMLBody"=> "<b>Some HTML Goes here</b>"}
postResponse = postHTMLBody.post
p 'Post Status: ' + postResponse.status.to_s
p 'Code: ' + postResponse.code.to_s
@@ -44,11 +44,11 @@
p 'Results: ' + postResponse.results.inspect
raise 'Failure creating email' unless postResponse.success?
# Retrieve newly created Email
p '>>> Retrieve newly created Email'
- getHTMLBody = FuelSDK::ET_Email.new()
+ getHTMLBody = FuelSDK::Email.new()
getHTMLBody.authStub = stubObj
getHTMLBody.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Name","Folder","CategoryID","HTMLBody","TextBody","Subject","IsActive","IsHTMLPaste","ClonedFromID","Status","EmailType","CharacterSet","HasDynamicSubjectLine","ContentCheckStatus","Client.PartnerClientKey","ContentAreas","CustomerKey"]
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
getResponse = getHTMLBody.get
p 'Retrieve Status: ' + getResponse.status.to_s
@@ -59,11 +59,11 @@
p 'Results: ' + getResponse.results.to_s
raise 'Failure retrieving email' unless getResponse.success?
# Update Email
p '>>> Update Email'
- patchHTMLBody = FuelSDK::ET_Email.new
+ patchHTMLBody = FuelSDK::Email.new
patchHTMLBody.authStub = stubObj
patchHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "<b>Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody</b>"}
patchResponse = patchHTMLBody.patch
p 'Patch Status: ' + patchResponse.status.to_s
p 'Code: ' + patchResponse.code.to_s
@@ -72,11 +72,11 @@
p 'Results: ' + patchResponse.results.inspect
raise 'Failure updating email' unless patchResponse.success?
# Retrieve updated Email
p '>>> Retrieve updated Email'
- getHTMLBody = FuelSDK::ET_Email.new()
+ getHTMLBody = FuelSDK::Email.new()
getHTMLBody.authStub = stubObj
getHTMLBody.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Name","Folder","CategoryID","HTMLBody","TextBody","Subject","IsActive","IsHTMLPaste","ClonedFromID","Status","EmailType","CharacterSet","HasDynamicSubjectLine","ContentCheckStatus","Client.PartnerClientKey","ContentAreas","CustomerKey"]
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
getResponse = getHTMLBody.get
p 'Retrieve Status: ' + getResponse.status.to_s
@@ -87,11 +87,11 @@
p 'Results: ' + getResponse.results.to_s
raise 'Failure retrieving email' unless getResponse.success?
# Delete Email
p '>>> Delete Email'
- deleteHTMLBody = FuelSDK::ET_Email.new
+ deleteHTMLBody = FuelSDK::Email.new
deleteHTMLBody.authStub = stubObj
deleteHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "<b>Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody</b>"}
deleteResponse = deleteHTMLBody.delete
p 'Delete Status: ' + deleteResponse.status.to_s
p 'Code: ' + deleteResponse.code.to_s
@@ -100,10 +100,10 @@
p 'Results: ' + deleteResponse.results.inspect
raise 'Failure deleteing email' unless deleteResponse.success?
# Retrieve Email to confirm deletion
p '>>> Retrieve Email to confirm deletion'
- getHTMLBody = FuelSDK::ET_Email.new()
+ getHTMLBody = FuelSDK::Email.new()
getHTMLBody.authStub = stubObj
getHTMLBody.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Name","Folder","CategoryID","HTMLBody","TextBody","Subject","IsActive","IsHTMLPaste","ClonedFromID","Status","EmailType","CharacterSet","HasDynamicSubjectLine","ContentCheckStatus","Client.PartnerClientKey","ContentAreas","CustomerKey"]
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
getResponse = getHTMLBody.get
p 'Retrieve Status: ' + getResponse.status.to_s