From b1c611c7e483089eae06edabb72698120575c8f4 Mon Sep 17 00:00:00 2001 From: Themba Date: Wed, 26 Oct 2016 20:52:49 +0200 Subject: [PATCH] Updated sample code to require MarketingCloudSDK instead of FUELSDK --- samples/sample-AddSubscriberToList.rb | 2 +- ...ample-CreateAndStartDataExtensionImport.rb | 4 +- samples/sample-CreateAndStartListImport.rb | 4 +- samples/sample-CreateContentAreas.rb | 4 +- samples/sample-CreateDataExtensions.rb | 2 +- samples/sample-CreateProfileAttributes.rb | 4 +- samples/sample-SendEmailToDataExtension.rb | 4 +- samples/sample-SendEmailToList.rb | 4 +- samples/sample-SendTriggeredSends.rb | 4 +- samples/sample-bounceevent.rb | 4 +- samples/sample-campaign.rb | 250 +++++++++--------- samples/sample-clickevent.rb | 8 +- samples/sample-contentarea.rb | 18 +- samples/sample-dataextension.rb | 2 +- samples/sample-directverb.rb | 53 ++-- samples/sample-email.rb | 18 +- samples/sample-email.senddefinition.rb | 18 +- samples/sample-folder.rb | 20 +- samples/sample-import.rb | 195 +++++++------- samples/sample-list.rb | 16 +- samples/sample-list.subscriber.rb | 14 +- samples/sample-openevent.rb | 8 +- samples/sample-profileattribute.rb | 101 ++++--- samples/sample-sentevent.rb | 8 +- samples/sample-subscriber.rb | 19 +- samples/sample-triggeredsend.rb | 21 +- samples/sample-unsubevent.rb | 8 +- 27 files changed, 404 insertions(+), 409 deletions(-) diff --git a/samples/sample-AddSubscriberToList.rb b/samples/sample-AddSubscriberToList.rb index 69c9002..87af0a0 100644 --- a/samples/sample-AddSubscriberToList.rb +++ b/samples/sample-AddSubscriberToList.rb @@ -1,4 +1,4 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin diff --git a/samples/sample-CreateAndStartDataExtensionImport.rb b/samples/sample-CreateAndStartDataExtensionImport.rb index b247933..66e8512 100644 --- a/samples/sample-CreateAndStartDataExtensionImport.rb +++ b/samples/sample-CreateAndStartDataExtensionImport.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth DataExtensionCustomerKey = "62476204-bfd3-de11-95ca-001e0bbae8cc" CSVFileName = "SDKExample.csv" diff --git a/samples/sample-CreateAndStartListImport.rb b/samples/sample-CreateAndStartListImport.rb index 7cb9479..f78884c 100644 --- a/samples/sample-CreateAndStartListImport.rb +++ b/samples/sample-CreateAndStartListImport.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth ListID = "1956035" CSVFileName = "SDKExample.csv" diff --git a/samples/sample-CreateContentAreas.rb b/samples/sample-CreateContentAreas.rb index b0008a4..a5b9e55 100644 --- a/samples/sample-CreateContentAreas.rb +++ b/samples/sample-CreateContentAreas.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth ## Example using CreateContentAreas() method diff --git a/samples/sample-CreateDataExtensions.rb b/samples/sample-CreateDataExtensions.rb index 8368f0e..69a5d44 100644 --- a/samples/sample-CreateDataExtensions.rb +++ b/samples/sample-CreateDataExtensions.rb @@ -1,4 +1,4 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin diff --git a/samples/sample-CreateProfileAttributes.rb b/samples/sample-CreateProfileAttributes.rb index 943f931..6f21018 100644 --- a/samples/sample-CreateProfileAttributes.rb +++ b/samples/sample-CreateProfileAttributes.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth ## Example using CreateProfileAttributes() method diff --git a/samples/sample-SendEmailToDataExtension.rb b/samples/sample-SendEmailToDataExtension.rb index 016bd00..2b44959 100644 --- a/samples/sample-SendEmailToDataExtension.rb +++ b/samples/sample-SendEmailToDataExtension.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth EmailIDForSendDefinition = "3113962" SendClassificationCustomerKey = "2239" diff --git a/samples/sample-SendEmailToList.rb b/samples/sample-SendEmailToList.rb index 0d73ebb..aa622b6 100644 --- a/samples/sample-SendEmailToList.rb +++ b/samples/sample-SendEmailToList.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth EmailIDForSendDefinition = "3113962" ListIDForSendDefinition = "1729515" diff --git a/samples/sample-SendTriggeredSends.rb b/samples/sample-SendTriggeredSends.rb index 2c75e50..01e7b9e 100644 --- a/samples/sample-SendTriggeredSends.rb +++ b/samples/sample-SendTriggeredSends.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - myclient = FuelSDK::Client.new auth + myclient = MarketingCloudSDK::Client.new auth TriggeredSendCustomerKey = "TEXTEXT" AltTriggeredSendCustomerKey = "FailTest" diff --git a/samples/sample-bounceevent.rb b/samples/sample-bounceevent.rb index f10ac9c..3e56776 100644 --- a/samples/sample-bounceevent.rb +++ b/samples/sample-bounceevent.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth ## Modify the date below to reduce the number of results returned from the request ## Setting this too far in the past could result in a very large response size diff --git a/samples/sample-campaign.rb b/samples/sample-campaign.rb index 2fef610..545bc58 100644 --- a/samples/sample-campaign.rb +++ b/samples/sample-campaign.rb @@ -1,13 +1,12 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' - begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # Create List p '>>> Create List' - postList = FuelSDK::List.new + postList = MarketingCloudSDK::List.new postList.authStub = stubObj postList.props = {"ListName" => 'RubyAssetList', "Description" => "This list was created with the RubySDK", "Type" => "Private" } postResponse = postList.post @@ -25,7 +24,7 @@ # Retrieve all Campaigns p '>>> Retrieve all Campaigns' - getCamp = FuelSDK::Campaign.new + getCamp = MarketingCloudSDK::Campaign.new getCamp.authStub = stubObj getResponse = getCamp.get p 'Retrieve Status: ' + getResponse.status.to_s @@ -50,7 +49,7 @@ # Create a new Campaign p '>>> Create a new Campaign' - postCamp = FuelSDK::Campaign.new + postCamp = MarketingCloudSDK::Campaign.new postCamp.authStub = stubObj postCamp.props = {"name" => "RubySDKCreatedForTest1", "description"=> "RubySDKCreatedForTest", "color"=>"FF9933", "favorite"=>"false"} postResponse = postCamp.post @@ -64,117 +63,117 @@ IDOfpostCampaign = postResponse.results['id'] - # Retrieve the new Campaign - p '>>> Retrieve the new Campaign' - getCamp = FuelSDK::Campaign.new - getCamp.authStub = stubObj - getCamp.props = {"id" => IDOfpostCampaign} - getResponse = getCamp.get - p 'Retrieve Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Results: ' + getResponse.results.to_json - p '-----------------------------' + # Retrieve the new Campaign + p '>>> Retrieve the new Campaign' + getCamp = MarketingCloudSDK::Campaign.new + getCamp.authStub = stubObj + getCamp.props = {"id" => IDOfpostCampaign} + getResponse = getCamp.get + p 'Retrieve Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Results: ' + getResponse.results.to_json + p '-----------------------------' raise 'Failure retrieving campaign' unless getResponse.success? - - # Update the new Campaign - p '>>> Update the new Campaign' - patchCamp = FuelSDK::Campaign.new - patchCamp.authStub = stubObj - patchCamp.props = {"id"=> IDOfpostCampaign, "name" => "RubySDKCreated-Updated!"} - patchResponse = patchCamp.patch - p 'Patch Status: ' + patchResponse.status.to_s - p 'Code: ' + patchResponse.code.to_s - p 'Message: ' + patchResponse.message.to_s - p 'Results: ' + patchResponse.results.to_json - p '-----------------------------' + + # Update the new Campaign + p '>>> Update the new Campaign' + patchCamp = MarketingCloudSDK::Campaign.new + patchCamp.authStub = stubObj + patchCamp.props = {"id"=> IDOfpostCampaign, "name" => "RubySDKCreated-Updated!"} + patchResponse = patchCamp.patch + p 'Patch Status: ' + patchResponse.status.to_s + p 'Code: ' + patchResponse.code.to_s + p 'Message: ' + patchResponse.message.to_s + p 'Results: ' + patchResponse.results.to_json + p '-----------------------------' raise 'Failure updating campaign' unless patchResponse.success? - - # Retrieve the updated Campaign - p '>>> Retrieve the updated Campaign' - getCamp = FuelSDK::Campaign.new - getCamp.authStub = stubObj - getCamp.props = {"id" => IDOfpostCampaign} - getResponse = getCamp.get - p 'Retrieve Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Results: ' + getResponse.results.to_json - p '-----------------------------' + + # Retrieve the updated Campaign + p '>>> Retrieve the updated Campaign' + getCamp = MarketingCloudSDK::Campaign.new + getCamp.authStub = stubObj + getCamp.props = {"id" => IDOfpostCampaign} + getResponse = getCamp.get + p 'Retrieve Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Results: ' + getResponse.results.to_json + p '-----------------------------' raise 'Failure retrieving campaign' unless getResponse.success? - - # Create a new Campaign Asset - p '>>> Create a new Campaign Asset' - postCampAsset = FuelSDK::Campaign::Asset.new - postCampAsset.authStub = stubObj - postCampAsset.props = {"id" => IDOfpostCampaign, "ids"=> [ExampleAssetItemID], "type"=> ExampleAssetType} - postResponse = postCampAsset.post - p 'Post Status: ' + postResponse.status.to_s - p 'Code: ' + postResponse.code.to_s - p 'Message: ' + postResponse.message.to_s - p 'Results: ' + postResponse.results.to_json - p '-----------------------------' - + + # Create a new Campaign Asset + p '>>> Create a new Campaign Asset' + postCampAsset = MarketingCloudSDK::Campaign::Asset.new + postCampAsset.authStub = stubObj + postCampAsset.props = {"id" => IDOfpostCampaign, "ids"=> [ExampleAssetItemID], "type"=> ExampleAssetType} + postResponse = postCampAsset.post + p 'Post Status: ' + postResponse.status.to_s + p 'Code: ' + postResponse.code.to_s + p 'Message: ' + postResponse.message.to_s + p 'Results: ' + postResponse.results.to_json + p '-----------------------------' + raise 'Failure creating campaign assets' unless postResponse.success? - - IDOfpostCampaignAsset = postResponse.results[0]['id'] - - # Retrieve all Campaign Asset for a campaign - p '>>> Retrieve all Campaign Asset for a Campaign' - getCampAsset = FuelSDK::Campaign::Asset.new - getCampAsset.authStub = stubObj - getCampAsset.props = {"id" => IDOfpostCampaign} - getResponse = getCampAsset.get - p 'Retrieve Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Results: ' + getResponse.results.inspect - p '-----------------------------' + + IDOfpostCampaignAsset = postResponse.results[0]['id'] + + # Retrieve all Campaign Asset for a campaign + p '>>> Retrieve all Campaign Asset for a Campaign' + getCampAsset = MarketingCloudSDK::Campaign::Asset.new + getCampAsset.authStub = stubObj + getCampAsset.props = {"id" => IDOfpostCampaign} + getResponse = getCampAsset.get + p 'Retrieve Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Results: ' + getResponse.results.inspect + p '-----------------------------' raise 'Failure retrieving campaign assets' unless getResponse.success? - - # Retrieve a single new Campaign Asset - p '>>> Retrieve a single new Campaign Asset' - getCampAsset = FuelSDK::Campaign::Asset.new - getCampAsset.authStub = stubObj - getCampAsset.props = {"id" => IDOfpostCampaign, "assetId" => IDOfpostCampaignAsset} - getResponse = getCampAsset.get - p 'Retrieve Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Results: ' + getResponse.results.inspect - p '-----------------------------' + + # Retrieve a single new Campaign Asset + p '>>> Retrieve a single new Campaign Asset' + getCampAsset = MarketingCloudSDK::Campaign::Asset.new + getCampAsset.authStub = stubObj + getCampAsset.props = {"id" => IDOfpostCampaign, "assetId" => IDOfpostCampaignAsset} + getResponse = getCampAsset.get + p 'Retrieve Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Results: ' + getResponse.results.inspect + p '-----------------------------' raise 'Failure retrieving campaign asset' unless getResponse.success? - - # Delete the new Campaign Asset - p '>>> Delete the new Campaign Asset' - deleteCampAsset = FuelSDK::Campaign::Asset.new - deleteCampAsset.authStub = stubObj - deleteCampAsset.props = {"id" => IDOfpostCampaign, "assetId"=> IDOfpostCampaignAsset} - deleteResponse = deleteCampAsset.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Results: ' + deleteResponse.results.to_json - p '-----------------------------' + + # Delete the new Campaign Asset + p '>>> Delete the new Campaign Asset' + deleteCampAsset = MarketingCloudSDK::Campaign::Asset.new + deleteCampAsset.authStub = stubObj + deleteCampAsset.props = {"id" => IDOfpostCampaign, "assetId"=> IDOfpostCampaignAsset} + deleteResponse = deleteCampAsset.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Results: ' + deleteResponse.results.to_json + p '-----------------------------' raise 'Failure deleting campaign asset' unless deleteResponse.success? - - # Get a single a new Campaign Asset to confirm deletion - p '>>> Get a single a new Campaign Asset to confirm deletion' - getCampAsset = FuelSDK::Campaign::Asset.new - getCampAsset.authStub = stubObj - getCampAsset.props = {"id" => IDOfpostCampaign} - getResponse = getCampAsset.get - p 'Retrieve Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Results: ' + getResponse.results.inspect - p '-----------------------------' + + # Get a single a new Campaign Asset to confirm deletion + p '>>> Get a single a new Campaign Asset to confirm deletion' + getCampAsset = MarketingCloudSDK::Campaign::Asset.new + getCampAsset.authStub = stubObj + getCampAsset.props = {"id" => IDOfpostCampaign} + getResponse = getCampAsset.get + p 'Retrieve Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Results: ' + getResponse.results.inspect + p '-----------------------------' raise 'Failure retrieving campaign asset' unless getResponse.success? raise 'Failure retrieving campaign asset' unless getResponse.results['totalCount'] == 0 @@ -184,28 +183,29 @@ p e.backtrace ensure - # Delete the new Campaign - p '>>> Delete the new Campaign' - deleteCamp = FuelSDK::Campaign.new - deleteCamp.authStub = stubObj - deleteCamp.props = {"id"=> IDOfpostCampaign} - deleteResponse = deleteCamp.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Results: ' + deleteResponse.results.to_json - p '-----------------------------' + + # Delete the new Campaign + p '>>> Delete the new Campaign' + deleteCamp = MarketingCloudSDK::Campaign.new + deleteCamp.authStub = stubObj + deleteCamp.props = {"id"=> IDOfpostCampaign} + deleteResponse = deleteCamp.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Results: ' + deleteResponse.results.to_json + p '-----------------------------' raise 'Failure deleting campaign asset' unless deleteResponse.success? - p '>>> Delete List' - deleteSub = FuelSDK::List.new() - deleteSub.authStub = stubObj - deleteSub.props = {"ID" => ExampleAssetItemID} - deleteResponse = deleteSub.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Results Length: ' + deleteResponse.results.length.to_s - p 'Results: ' + deleteResponse.results.to_s + p '>>> Delete List' + deleteSub = MarketingCloudSDK::List.new() + deleteSub.authStub = stubObj + deleteSub.props = {"ID" => ExampleAssetItemID} + deleteResponse = deleteSub.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Results Length: ' + deleteResponse.results.length.to_s + p 'Results: ' + deleteResponse.results.to_s end diff --git a/samples/sample-clickevent.rb b/samples/sample-clickevent.rb index c14f7d8..e57d439 100644 --- a/samples/sample-clickevent.rb +++ b/samples/sample-clickevent.rb @@ -1,15 +1,15 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth ## Modify the date below to reduce the number of results returned from the request ## Setting this too far in the past could result in a very large response size retrieveDate = '2013-01-15T13:00:00.000' p '>>> Retrieve Filtered ClickEvents with GetMoreResults' - getClickEvent = FuelSDK::ClickEvent.new() + getClickEvent = MarketingCloudSDK::ClickEvent.new() getClickEvent.authStub = stubObj getClickEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] getClickEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate} @@ -39,7 +39,7 @@ # The following request could potentially bring back large amounts of data if run against a production account =begin p '>>> Retrieve All ClickEvents with GetMoreResults' - getClickEvent = FuelSDK::ClickEvent.new() + getClickEvent = MarketingCloudSDK::ClickEvent.new() getClickEvent.authStub = stubObj getClickEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] getResponse = getClickEvent.get diff --git a/samples/sample-contentarea.rb b/samples/sample-contentarea.rb index e5c556d..ff51c18 100644 --- a/samples/sample-contentarea.rb +++ b/samples/sample-contentarea.rb @@ -1,12 +1,12 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # Retrieve All ContentArea with GetMoreResults p '>>> Retrieve All ContentArea with GetMoreResults' - getContent = FuelSDK::ContentArea.new() + getContent = MarketingCloudSDK::ContentArea.new() getContent.authStub = stubObj getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"] getResponse = getContent.get @@ -33,7 +33,7 @@ # Create ContentArea p '>>> Create ContentArea' - postContent = FuelSDK::ContentArea.new + postContent = MarketingCloudSDK::ContentArea.new postContent.authStub = stubObj postContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "Some HTML Content Goes here"} postResponse = postContent.post @@ -46,7 +46,7 @@ # Retrieve newly created ContentArea p '>>> Retrieve newly created ContentArea' - getContent = FuelSDK::ContentArea.new() + getContent = MarketingCloudSDK::ContentArea.new() getContent.authStub = stubObj getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"] getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea} @@ -61,7 +61,7 @@ # Update ContentArea p '>>> Update ContentArea' - patchContent = FuelSDK::ContentArea.new + patchContent = MarketingCloudSDK::ContentArea.new patchContent.authStub = stubObj patchContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "Some HTML Content Goes here. NOW WITH NEW CONTENT"} patchResponse = patchContent.patch @@ -74,7 +74,7 @@ # Retrieve updated ContentArea p '>>> Retrieve updated ContentArea' - getContent = FuelSDK::ContentArea.new() + getContent = MarketingCloudSDK::ContentArea.new() getContent.authStub = stubObj getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"] getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea} @@ -89,7 +89,7 @@ # Delete ContentArea p '>>> Delete ContentArea' - deleteContent = FuelSDK::ContentArea.new + deleteContent = MarketingCloudSDK::ContentArea.new deleteContent.authStub = stubObj deleteContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "Some HTML Content Goes here. NOW WITH NEW CONTENT"} deleteResponse = deleteContent.delete @@ -102,7 +102,7 @@ # Retrieve ContentArea to confirm deletion p '>>> Retrieve ContentArea to confirm deletion' - getContent = FuelSDK::ContentArea.new() + getContent = MarketingCloudSDK::ContentArea.new() getContent.authStub = stubObj getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"] getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea} diff --git a/samples/sample-dataextension.rb b/samples/sample-dataextension.rb index 87e35ab..af54d7e 100644 --- a/samples/sample-dataextension.rb +++ b/samples/sample-dataextension.rb @@ -1,4 +1,4 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' require 'pry' diff --git a/samples/sample-directverb.rb b/samples/sample-directverb.rb index 255c2a2..df7b358 100644 --- a/samples/sample-directverb.rb +++ b/samples/sample-directverb.rb @@ -1,4 +1,4 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' # contains auth with credentials begin @@ -23,33 +23,32 @@ p "Results: #{postResponse.results.inspect}" raise 'Failure Creating List' unless postResponse.success? - if postResponse.success? then - newListID = postResponse.results[0][:new_id] - p "New ID: #{newListID}" - - props = {"ID" => newListID, "Description" => "Update!!!"} - client = ET_Client.new auth - patchResponse = ET_Patch.new client, 'List', props - p "Patch Status: #{patchResponse.status.to_s}" - p "Code: #{patchResponse.code.to_s}" - p "Message: #{patchResponse.message.to_s}" - p "Result Count: #{patchResponse.results.length.to_s}" - p "Results: #{patchResponse.results.inspect}" - raise 'Failure Patching List' unless patchResponse.success? - - - props = {"ID" => newListID} - client = ET_Client.new auth - deleteResponse = ET_Delete.new client, 'List', props - p "Delete Status: #{deleteResponse.status.to_s}" - p "Code: #{deleteResponse.code.to_s}" - p "Message: #{deleteResponse.message.to_s}" - p "Result Count: #{deleteResponse.results.length.to_s}" - p "Results: #{deleteResponse.results.inspect}" - raise 'Failure Deleting List' unless deleteResponse.success? - end + if postResponse.success? then + newListID = postResponse.results[0][:new_id] + p "New ID: #{newListID}" + + props = {"ID" => newListID, "Description" => "Update!!!"} + client = ET_Client.new auth + patchResponse = ET_Patch.new client, 'List', props + p "Patch Status: #{patchResponse.status.to_s}" + p "Code: #{patchResponse.code.to_s}" + p "Message: #{patchResponse.message.to_s}" + p "Result Count: #{patchResponse.results.length.to_s}" + p "Results: #{patchResponse.results.inspect}" + raise 'Failure Patching List' unless patchResponse.success? + + props = {"ID" => newListID} + client = ET_Client.new auth + deleteResponse = ET_Delete.new client, 'List', props + p "Delete Status: #{deleteResponse.status.to_s}" + p "Code: #{deleteResponse.code.to_s}" + p "Message: #{deleteResponse.message.to_s}" + p "Result Count: #{deleteResponse.results.length.to_s}" + p "Results: #{deleteResponse.results.inspect}" + raise 'Failure Deleting List' unless deleteResponse.success? + end rescue => e p "Caught exception: #{e.message}" p e.backtrace -end \ No newline at end of file +end diff --git a/samples/sample-email.rb b/samples/sample-email.rb index 7991549..1e9fad3 100644 --- a/samples/sample-email.rb +++ b/samples/sample-email.rb @@ -1,12 +1,12 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # Retrieve All Email with GetMoreResults p '>>> Retrieve All Email with GetMoreResults' - getHTMLBody = FuelSDK::Email.new() + getHTMLBody = MarketingCloudSDK::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 @@ -33,7 +33,7 @@ # Create Email p '>>> Create Email' - postHTMLBody = FuelSDK::Email.new + postHTMLBody = MarketingCloudSDK::Email.new postHTMLBody.authStub = stubObj postHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "Subject" => "Created Using the RubySDK", "HTMLBody"=> "Some HTML Goes here"} postResponse = postHTMLBody.post @@ -46,7 +46,7 @@ # Retrieve newly created Email p '>>> Retrieve newly created Email' - getHTMLBody = FuelSDK::Email.new() + getHTMLBody = MarketingCloudSDK::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} @@ -61,7 +61,7 @@ # Update Email p '>>> Update Email' - patchHTMLBody = FuelSDK::Email.new + patchHTMLBody = MarketingCloudSDK::Email.new patchHTMLBody.authStub = stubObj patchHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody"} patchResponse = patchHTMLBody.patch @@ -74,7 +74,7 @@ # Retrieve updated Email p '>>> Retrieve updated Email' - getHTMLBody = FuelSDK::Email.new() + getHTMLBody = MarketingCloudSDK::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} @@ -89,7 +89,7 @@ # Delete Email p '>>> Delete Email' - deleteHTMLBody = FuelSDK::Email.new + deleteHTMLBody = MarketingCloudSDK::Email.new deleteHTMLBody.authStub = stubObj deleteHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody"} deleteResponse = deleteHTMLBody.delete @@ -102,7 +102,7 @@ # Retrieve Email to confirm deletion p '>>> Retrieve Email to confirm deletion' - getHTMLBody = FuelSDK::Email.new() + getHTMLBody = MarketingCloudSDK::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} diff --git a/samples/sample-email.senddefinition.rb b/samples/sample-email.senddefinition.rb index 71a1ac9..2d416e8 100644 --- a/samples/sample-email.senddefinition.rb +++ b/samples/sample-email.senddefinition.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth NewSendDefinitionName = "PHPSDKSendDefinition"; SendableDataExtensionCustomerKey = "F6F3871A-D124-499B-BBF5-3EFC0E827A51"; @@ -12,7 +12,7 @@ # Retrieve All Email::SendDefinition with GetMoreResults p '>>> Retrieve All Email.SendDefinition with GetMoreResults' - sendDef = FuelSDK::Email::SendDefinition.new() + sendDef = MarketingCloudSDK::Email::SendDefinition.new() sendDef.authStub = stubObj sendDef.props = ["Client.ID", "CreatedDate","ModifiedDate","ObjectID","CustomerKey","Name","CategoryID","Description","SendClassification.CustomerKey","SenderProfile.CustomerKey","SenderProfile.FromName","SenderProfile.FromAddress","DeliveryProfile.CustomerKey","DeliveryProfile.SourceAddressType","DeliveryProfile.PrivateIP","DeliveryProfile.DomainType","DeliveryProfile.PrivateDomain","DeliveryProfile.HeaderSalutationSource","DeliveryProfile.FooterSalutationSource","SuppressTracking","IsSendLogging","Email.ID","BccEmail","AutoBccEmail","TestEmailAddr","EmailSubject","DynamicEmailSubject","IsMultipart","IsWrapped","SendLimit","SendWindowOpen","SendWindowClose","DeduplicateByEmail","ExclusionFilter","Additional"] getResponse = sendDef.get @@ -37,12 +37,12 @@ end p '>>> Create New Email.SendDefinition to DataExtension' - postSendDefinition = FuelSDK::Email::SendDefinition.new() + postSendDefinition = MarketingCloudSDK::Email::SendDefinition.new() postSendDefinition.authStub = stubObj postSendDefinition.props = {} postSendDefinition.props["Name"] = NewSendDefinitionName postSendDefinition.props["CustomerKey"] = NewSendDefinitionName - postSendDefinition.props["Description"] = "Created with PHPSDK" + postSendDefinition.props["Description"] = "Created with RubySDK" postSendDefinition.props["SendClassification"] = {"CustomerKey"=>SendClassificationCustomerKey} postSendDefinition.props["SendDefinitionList"] = {"CustomerKey"=> SendableDataExtensionCustomerKey, "DataSourceTypeID"=>"CustomObject"} postSendDefinition.props["Email"] = {"ID"=>EmailIDForSendDefinition} @@ -56,7 +56,7 @@ #raise 'Failure Creating SendDefinition' unless postResponse.success? p '>>> Delete SendDefinition to DataExtension' - deleteSendDefinition = FuelSDK::Email::SendDefinition.new() + deleteSendDefinition = MarketingCloudSDK::Email::SendDefinition.new() deleteSendDefinition.authStub = stubObj deleteSendDefinition.props = {"CustomerKey"=> NewSendDefinitionName} deleteResponse = deleteSendDefinition.delete @@ -70,7 +70,7 @@ p '>>> Create New Email.SendDefinition to List' - postSendDefinition = FuelSDK::Email::SendDefinition.new() + postSendDefinition = MarketingCloudSDK::Email::SendDefinition.new() postSendDefinition.authStub = stubObj postSendDefinition.props = {"Name"=>NewSendDefinitionName} postSendDefinition.props["CustomerKey"] = NewSendDefinitionName @@ -88,7 +88,7 @@ raise 'Failure Creating SendDefinition' unless postResponse.success? p '>>> Send SendDefinition to List' - sendSendDefinition = FuelSDK::Email::SendDefinition.new() + sendSendDefinition = MarketingCloudSDK::Email::SendDefinition.new() sendSendDefinition.authStub = stubObj sendSendDefinition.props = {"CustomerKey"=> NewSendDefinitionName} sendResponse = sendSendDefinition.send @@ -115,7 +115,7 @@ end p '>>> Delete SendDefinition to List' - deleteSendDefinition = FuelSDK::Email::SendDefinition.new() + deleteSendDefinition = MarketingCloudSDK::Email::SendDefinition.new() deleteSendDefinition.authStub = stubObj deleteSendDefinition.props = {"CustomerKey"=> NewSendDefinitionName} deleteResponse = deleteSendDefinition.delete diff --git a/samples/sample-folder.rb b/samples/sample-folder.rb index 409b3e9..506e1c7 100644 --- a/samples/sample-folder.rb +++ b/samples/sample-folder.rb @@ -1,12 +1,12 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # Retrieve All Folder with GetMoreResults p '>>> Retrieve All Folder with GetMoreResults' - getFolder = FuelSDK::Folder.new() + getFolder = MarketingCloudSDK::Folder.new() getFolder.authStub = stubObj getFolder.props = ["ID", "Client.ID", "ParentFolder.ID", "ParentFolder.CustomerKey", "ParentFolder.ObjectID", "ParentFolder.Name", "ParentFolder.Description", "ParentFolder.ContentType", "ParentFolder.IsActive", "ParentFolder.IsEditable", "ParentFolder.AllowChildren", "Name", "Description", "ContentType", "IsActive", "IsEditable", "AllowChildren", "CreatedDate", "ModifiedDate", "Client.ModifiedBy", "ObjectID", "CustomerKey", "Client.EnterpriseID", "Client.CreatedBy"] getResponse = getFolder.get @@ -33,7 +33,7 @@ # Retrieve Specific Folder for Email Folder ParentID p '>>> Retrieve Specific Folder for Email Folder ParentID' - getFolder = FuelSDK::Folder.new() + getFolder = MarketingCloudSDK::Folder.new() getFolder.authStub = stubObj getFolder.props = ["ID"] getFolder.filter = {'LeftOperand' => {'Property' => 'ParentFolder.ID','SimpleOperator' => 'equals','Value' => '0'}, 'LogicalOperator' => 'AND', 'RightOperand' => {'Property' => 'ContentType','SimpleOperator' => 'equals','Value' => 'EMAIL'}} @@ -52,7 +52,7 @@ # Create Folder p '>>> Create Folder' - postFolder = FuelSDK::Folder.new + postFolder = MarketingCloudSDK::Folder.new postFolder.authStub = stubObj postFolder.props = {"CustomerKey" => NameOfTestFolder, "Name" => NameOfTestFolder, "Description" => NameOfTestFolder, "ContentType"=> "EMAIL", "ParentFolder" => {"ID" => ParentIDForEmail}} postResponse = postFolder.post @@ -65,7 +65,7 @@ # Retrieve newly created Folder p '>>> Retrieve newly created Folder' - getFolder = FuelSDK::Folder.new() + getFolder = MarketingCloudSDK::Folder.new() getFolder.authStub = stubObj getFolder.props = ["ID", "Client.ID", "ParentFolder.ID", "ParentFolder.CustomerKey", "ParentFolder.ObjectID", "ParentFolder.Name", "ParentFolder.Description", "ParentFolder.ContentType", "ParentFolder.IsActive", "ParentFolder.IsEditable", "ParentFolder.AllowChildren", "Name", "Description", "ContentType", "IsActive", "IsEditable", "AllowChildren", "CreatedDate", "ModifiedDate", "Client.ModifiedBy", "ObjectID", "CustomerKey", "Client.EnterpriseID", "Client.CreatedBy"] getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder} @@ -81,7 +81,7 @@ # Update Folder p '>>> Update Folder' - patchFolder = FuelSDK::Folder.new + patchFolder = MarketingCloudSDK::Folder.new patchFolder.authStub = stubObj patchFolder.props = {"CustomerKey" => NameOfTestFolder, "Description" => "New Description"} patchResponse = patchFolder.patch @@ -94,7 +94,7 @@ # Retrieve updated Folder p '>>> Retrieve updated Folder' - getFolder = FuelSDK::Folder.new() + getFolder = MarketingCloudSDK::Folder.new() getFolder.authStub = stubObj getFolder.props = ["ID", "Client.ID", "ParentFolder.ID", "ParentFolder.CustomerKey", "ParentFolder.ObjectID", "ParentFolder.Name", "ParentFolder.Description", "ParentFolder.ContentType", "ParentFolder.IsActive", "ParentFolder.IsEditable", "ParentFolder.AllowChildren", "Name", "Description", "ContentType", "IsActive", "IsEditable", "AllowChildren", "CreatedDate", "ModifiedDate", "Client.ModifiedBy", "ObjectID", "CustomerKey", "Client.EnterpriseID", "Client.CreatedBy"] getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder} @@ -109,7 +109,7 @@ # Delete Folder p '>>> Delete Folder' - deleteFolder = FuelSDK::Folder.new + deleteFolder = MarketingCloudSDK::Folder.new deleteFolder.authStub = stubObj deleteFolder.props = {"CustomerKey" => NameOfTestFolder, "Name"=>NameOfTestFolder, "Content"=> "Some HTML Content Goes here. NOW WITH NEW CONTENT"} deleteResponse = deleteFolder.delete @@ -122,7 +122,7 @@ # Retrieve Folder to confirm deletion p '>>> Retrieve Folder to confirm deletion' - getFolder = FuelSDK::Folder.new() + getFolder = MarketingCloudSDK::Folder.new() getFolder.authStub = stubObj getFolder.props = ["ID"] getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder} diff --git a/samples/sample-import.rb b/samples/sample-import.rb index 0b6a54c..e556e72 100644 --- a/samples/sample-import.rb +++ b/samples/sample-import.rb @@ -1,104 +1,103 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth - - NewImportName = "RubySDKImport" - SendableDataExtensionCustomerKey = "62476204-bfd3-de11-95ca-001e0bbae8cc" - ListIDForImport = "1956035" - - p '>>> Create Import to DataExtension' - postImport = ET_Import.new - postImport.authStub = stubObj - postImport.props = {"Name"=>NewImportName} - postImport.props["CustomerKey"] = NewImportName - postImport.props["Description"] = "Created with RubySDK" - postImport.props["AllowErrors"] = "true" - postImport.props["DestinationObject"] = {"ObjectID"=>SendableDataExtensionCustomerKey} - postImport.props["FieldMappingType"] = "InferFromColumnHeadings" - postImport.props["FileSpec"] = "RubyExample.csv" - postImport.props["FileType"] = "CSV" - postImport.props["Notification"] = {"ResponseType"=>"email","ResponseAddress"=>"example@example.com"} - postImport.props["RetrieveFileTransferLocation"] = {"CustomerKey"=>"ExactTarget Enhanced FTP"} - postImport.props["UpdateType"] = "Overwrite" - postResponse = postImport.post - p 'Post Status: ' + postResponse.status.to_s - p 'Code: ' + postResponse.code.to_s - p 'Message: ' + postResponse.message.to_s - p 'Result Count: ' + postResponse.results.length.to_s - p 'Results: ' + postResponse.results.inspect - - p '>>> Delete Import' - deleteImport = ET_Import.new() - deleteImport.authStub = stubObj - deleteImport.props = {"CustomerKey" => NewImportName} - deleteResponse = deleteImport.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Results Length: ' + deleteResponse.results.length.to_s - p 'Results: ' + deleteResponse.results.to_s - - p '>>> Create Import to List' - postImport = ET_Import.new - postImport.authStub = stubObj - postImport.props = {"Name"=>NewImportName} - postImport.props["CustomerKey"] = NewImportName - postImport.props["Description"] = "Created with RubySDK" - postImport.props["AllowErrors"] = "true" - postImport.props["DestinationObject"] = {"ID"=>ListIDForImport} - postImport.props["FieldMappingType"] = "InferFromColumnHeadings" - postImport.props["FileSpec"] = "RubyExample.csv" - postImport.props["FileType"] = "CSV" - postImport.props["Notification"] = {"ResponseType"=>"email","ResponseAddress"=>"example@example.com"} - postImport.props["RetrieveFileTransferLocation"] = {"CustomerKey"=>"ExactTarget Enhanced FTP"} - postImport.props["UpdateType"] = "AddAndUpdate" - postResponse = postImport.post - p 'Post Status: ' + postResponse.status.to_s - p 'Code: ' + postResponse.code.to_s - p 'Message: ' + postResponse.message.to_s - p 'Result Count: ' + postResponse.results.length.to_s - p 'Results: ' + postResponse.results.inspect - - p '>>> Start Import to List' - startImport = ET_Import.new - startImport.authStub = stubObj - startImport.props = {"CustomerKey"=>NewImportName} - postResponse = startImport.start - p 'Start Status: ' + postResponse.status.to_s - p 'Code: ' + postResponse.code.to_s - p 'Message: ' + postResponse.message.to_s - p 'Result Count: ' + postResponse.results.length.to_s - p 'Results: ' + postResponse.results.inspect - - importStatus = "" - while postResponse.status && importStatus != "Error" && importStatus != "Completed" do - p '>>> Checking status in loop' - # Wait a bit before checking the status to give it time to process - sleep 30 - statusResponse = startImport.status - p 'Status Status: ' + statusResponse.status.to_s - p 'Code: ' + statusResponse.code.to_s - p 'Message: ' + statusResponse.message.to_s - p 'Result Count: ' + statusResponse.results.length.to_s - p 'Results: ' + statusResponse.results.inspect - importStatus = statusResponse.results[0][:import_status] - end - - p '>>> Delete Import' - deleteImport = ET_Import.new() - deleteImport.authStub = stubObj - deleteImport.props = {"CustomerKey" => NewImportName} - deleteResponse = deleteImport.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Results Length: ' + deleteResponse.results.length.to_s - p 'Results: ' + deleteResponse.results.to_s + stubObj = MarketingCloudSDK::Client.new auth + + NewImportName = "RubySDKImport" + SendableDataExtensionCustomerKey = "62476204-bfd3-de11-95ca-001e0bbae8cc" + ListIDForImport = "1956035" + + p '>>> Create Import to DataExtension' + postImport = ET_Import.new + postImport.authStub = stubObj + postImport.props = {"Name"=>NewImportName} + postImport.props["CustomerKey"] = NewImportName + postImport.props["Description"] = "Created with RubySDK" + postImport.props["AllowErrors"] = "true" + postImport.props["DestinationObject"] = {"ObjectID"=>SendableDataExtensionCustomerKey} + postImport.props["FieldMappingType"] = "InferFromColumnHeadings" + postImport.props["FileSpec"] = "RubyExample.csv" + postImport.props["FileType"] = "CSV" + postImport.props["Notification"] = {"ResponseType"=>"email","ResponseAddress"=>"example@example.com"} + postImport.props["RetrieveFileTransferLocation"] = {"CustomerKey"=>"ExactTarget Enhanced FTP"} + postImport.props["UpdateType"] = "Overwrite" + postResponse = postImport.post + p 'Post Status: ' + postResponse.status.to_s + p 'Code: ' + postResponse.code.to_s + p 'Message: ' + postResponse.message.to_s + p 'Result Count: ' + postResponse.results.length.to_s + p 'Results: ' + postResponse.results.inspect + + p '>>> Delete Import' + deleteImport = ET_Import.new() + deleteImport.authStub = stubObj + deleteImport.props = {"CustomerKey" => NewImportName} + deleteResponse = deleteImport.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Results Length: ' + deleteResponse.results.length.to_s + p 'Results: ' + deleteResponse.results.to_s + + p '>>> Create Import to List' + postImport = ET_Import.new + postImport.authStub = stubObj + postImport.props = {"Name"=>NewImportName} + postImport.props["CustomerKey"] = NewImportName + postImport.props["Description"] = "Created with RubySDK" + postImport.props["AllowErrors"] = "true" + postImport.props["DestinationObject"] = {"ID"=>ListIDForImport} + postImport.props["FieldMappingType"] = "InferFromColumnHeadings" + postImport.props["FileSpec"] = "RubyExample.csv" + postImport.props["FileType"] = "CSV" + postImport.props["Notification"] = {"ResponseType"=>"email","ResponseAddress"=>"example@example.com"} + postImport.props["RetrieveFileTransferLocation"] = {"CustomerKey"=>"ExactTarget Enhanced FTP"} + postImport.props["UpdateType"] = "AddAndUpdate" + postResponse = postImport.post + p 'Post Status: ' + postResponse.status.to_s + p 'Code: ' + postResponse.code.to_s + p 'Message: ' + postResponse.message.to_s + p 'Result Count: ' + postResponse.results.length.to_s + p 'Results: ' + postResponse.results.inspect + + p '>>> Start Import to List' + startImport = ET_Import.new + startImport.authStub = stubObj + startImport.props = {"CustomerKey"=>NewImportName} + postResponse = startImport.start + p 'Start Status: ' + postResponse.status.to_s + p 'Code: ' + postResponse.code.to_s + p 'Message: ' + postResponse.message.to_s + p 'Result Count: ' + postResponse.results.length.to_s + p 'Results: ' + postResponse.results.inspect + + importStatus = "" + while postResponse.status && importStatus != "Error" && importStatus != "Completed" do + p '>>> Checking status in loop' + # Wait a bit before checking the status to give it time to process + sleep 30 + statusResponse = startImport.status + p 'Status Status: ' + statusResponse.status.to_s + p 'Code: ' + statusResponse.code.to_s + p 'Message: ' + statusResponse.message.to_s + p 'Result Count: ' + statusResponse.results.length.to_s + p 'Results: ' + statusResponse.results.inspect + importStatus = statusResponse.results[0][:import_status] + end + + p '>>> Delete Import' + deleteImport = ET_Import.new() + deleteImport.authStub = stubObj + deleteImport.props = {"CustomerKey" => NewImportName} + deleteResponse = deleteImport.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Results Length: ' + deleteResponse.results.length.to_s + p 'Results: ' + deleteResponse.results.to_s rescue => e - p "Caught exception: #{e.message}" - p e.backtrace + p "Caught exception: #{e.message}" + p e.backtrace end - diff --git a/samples/sample-list.rb b/samples/sample-list.rb index b01adc7..aae99f2 100644 --- a/samples/sample-list.rb +++ b/samples/sample-list.rb @@ -1,14 +1,14 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth NewListName = "RubySDKList" # Create List p '>>> Create List' - postList = FuelSDK::List.new + postList = MarketingCloudSDK::List.new postList.authStub = stubObj postList.props = {"ListName" => NewListName, "Description" => "This list was created with the RubySDK", "Type" => "Private" } #postList.folder_id = 1083760 @@ -27,7 +27,7 @@ # Retrieve newly created List by ID p '>>> Retrieve newly created List' - getList = FuelSDK::List.new() + getList = MarketingCloudSDK::List.new() getList.authStub = stubObj getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"] getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID} @@ -42,7 +42,7 @@ # Update List p '>>> Update List' - patchSub = FuelSDK::List.new + patchSub = MarketingCloudSDK::List.new patchSub.authStub = stubObj patchSub.props = {"ID" => newListID, "Description" => "I updated the description"} patchResponse = patchSub.patch @@ -56,7 +56,7 @@ # Retrieve List that should have description updated p '>>> Retrieve List that should have description updated ' - getList = FuelSDK::List.new() + getList = MarketingCloudSDK::List.new() getList.authStub = stubObj getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"] getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID} @@ -71,7 +71,7 @@ # Delete List p '>>> Delete List' - deleteSub = FuelSDK::List.new() + deleteSub = MarketingCloudSDK::List.new() deleteSub.authStub = stubObj deleteSub.props = {"ID" => newListID} deleteResponse = deleteSub.delete @@ -84,7 +84,7 @@ # Retrieve List to confirm deletion p '>>> Retrieve List to confirm deletion' - getList = FuelSDK::List.new() + getList = MarketingCloudSDK::List.new() getList.authStub = stubObj getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"] getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID} diff --git a/samples/sample-list.subscriber.rb b/samples/sample-list.subscriber.rb index 8dd24c2..6ad7ff0 100644 --- a/samples/sample-list.subscriber.rb +++ b/samples/sample-list.subscriber.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # NOTE: These examples only work in accounts where the SubscriberKey functionality is not enabled # SubscriberKey will need to be included in the props if that feature is enabled @@ -12,7 +12,7 @@ # Create List p '>>> Create List' - postList = FuelSDK::List.new + postList = MarketingCloudSDK::List.new postList.authStub = stubObj postList.props = {"ListName" => NewListName, "Description" => "This list was created with the RubySDK", "Type" => "Private" } postResponse = postList.post @@ -32,7 +32,7 @@ # Create Subscriber On List p '>>> Create Subscriber On List' - postSub = FuelSDK::Subscriber.new + postSub = MarketingCloudSDK::Subscriber.new postSub.authStub = stubObj postSub.props = {"EmailAddress" => SubscriberTestEmail, "Lists" =>[{"ID" => newListID}]} postResponse = postSub.post @@ -48,7 +48,7 @@ if postResponse.results[0][:error_code] == "12014" then # Update Subscriber to add to List p '>>> Update Subscriber to add to List' - patchSub = FuelSDK::Subscriber.new + patchSub = MarketingCloudSDK::Subscriber.new patchSub.authStub = stubObj patchSub.props = {"EmailAddress" => SubscriberTestEmail, "Lists" =>[{"ID" => newListID}]} patchResponse = patchSub.patch @@ -64,7 +64,7 @@ # Retrieve all Subscribers on the List p '>>> Retrieve all Subscribers on the List' - getListSubs = FuelSDK::List::Subscriber.new + getListSubs = MarketingCloudSDK::List::Subscriber.new getListSubs.authStub = stubObj getListSubs.props = ["ObjectID","SubscriberKey","CreatedDate","Client.ID","Client.PartnerClientKey","ListID","Status"] getListSubs.filter = {'Property' => 'ListID','SimpleOperator' => 'equals','Value' => newListID} @@ -79,7 +79,7 @@ # Delete List p '>>> Delete List' - deleteSub = FuelSDK::List.new() + deleteSub = MarketingCloudSDK::List.new() deleteSub.authStub = stubObj deleteSub.props = {"ID" => newListID} deleteResponse = deleteSub.delete diff --git a/samples/sample-openevent.rb b/samples/sample-openevent.rb index 2648443..27cf6a4 100644 --- a/samples/sample-openevent.rb +++ b/samples/sample-openevent.rb @@ -1,15 +1,15 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth ## Modify the date below to reduce the number of results returned from the request ## Setting this too far in the past could result in a very large response size retrieveDate = '2013-01-15T13:00:00.000' p '>>> Retrieve Filtered OpenEvents with GetMoreResults' - getOpenEvent = FuelSDK::OpenEvent.new() + getOpenEvent = MarketingCloudSDK::OpenEvent.new() getOpenEvent.authStub = stubObj getOpenEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] getOpenEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate} @@ -38,7 +38,7 @@ # The following request could potentially bring back large amounts of data if run against a production account =begin p '>>> Retrieve All OpenEvents with GetMoreResults' - getOpenEvent = FuelSDK::OpenEvent.new() + getOpenEvent = MarketingCloudSDK::OpenEvent.new() getOpenEvent.authStub = stubObj getOpenEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] getResponse = getOpenEvent.get diff --git a/samples/sample-profileattribute.rb b/samples/sample-profileattribute.rb index f5d2a60..4a23881 100644 --- a/samples/sample-profileattribute.rb +++ b/samples/sample-profileattribute.rb @@ -1,57 +1,56 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth - - NameOfAttribute = 'RubySDKTesting' - - p '>>> Retrieve Profile Attribute' - getProfileAttribute = ET_ProfileAttribute.new - getProfileAttribute.authStub = stubObj - getResponse = getProfileAttribute.get - p 'Get Status: ' + getResponse.status.to_s - p 'Code: ' + getResponse.code.to_s - p 'Message: ' + getResponse.message.to_s - p 'Result Count: ' + getResponse.results.length.to_s - #p 'Results: ' + getResponse.results.inspect - raise 'Failure getting Profile Attribute' unless getResponse.success? - - p '>>> Create ProfileAttribute' - postProfileAttribute = ET_ProfileAttribute.new - postProfileAttribute.authStub = stubObj - postProfileAttribute.props = {"Name" => NameOfAttribute, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"} - postResponse = postProfileAttribute.post - p 'Post Status: ' + postResponse.status.to_s - p 'Code: ' + postResponse.code.to_s - p 'Message: ' + postResponse.message.to_s - p 'Result Count: ' + postResponse.results.length.to_s - p 'Results: ' + postResponse.results.inspect - - p '>>> Update ProfileAttribute' - patchProfileAttribute = ET_ProfileAttribute.new - patchProfileAttribute.authStub = stubObj - patchProfileAttribute.props = {"Name" => NameOfAttribute, "PropertyType"=>"string"} - patchResponse = patchProfileAttribute.patch - p 'Patch Status: ' + patchResponse.status.to_s - p 'Code: ' + patchResponse.code.to_s - p 'Message: ' + patchResponse.message.to_s - p 'Result Count: ' + patchResponse.results.length.to_s - p 'Results: ' + patchResponse.results.inspect - - p '>>> Delete ProfileAttribute' - deleteProfileAttribute = ET_ProfileAttribute.new - deleteProfileAttribute.authStub = stubObj - deleteProfileAttribute.props = {"Name" => NameOfAttribute} - deleteResponse = deleteProfileAttribute.delete - p 'Delete Status: ' + deleteResponse.status.to_s - p 'Code: ' + deleteResponse.code.to_s - p 'Message: ' + deleteResponse.message.to_s - p 'Result Count: ' + deleteResponse.results.length.to_s - p 'Results: ' + deleteResponse.results.inspect + stubObj = MarketingCloudSDK::Client.new auth + + NameOfAttribute = 'RubySDKTesting' + + p '>>> Retrieve Profile Attribute' + getProfileAttribute = ET_ProfileAttribute.new + getProfileAttribute.authStub = stubObj + getResponse = getProfileAttribute.get + p 'Get Status: ' + getResponse.status.to_s + p 'Code: ' + getResponse.code.to_s + p 'Message: ' + getResponse.message.to_s + p 'Result Count: ' + getResponse.results.length.to_s + # p 'Results: ' + getResponse.results.inspect + raise 'Failure getting Profile Attribute' unless getResponse.success? + + p '>>> Create ProfileAttribute' + postProfileAttribute = ET_ProfileAttribute.new + postProfileAttribute.authStub = stubObj + postProfileAttribute.props = {"Name" => NameOfAttribute, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"} + postResponse = postProfileAttribute.post + p 'Post Status: ' + postResponse.status.to_s + p 'Code: ' + postResponse.code.to_s + p 'Message: ' + postResponse.message.to_s + p 'Result Count: ' + postResponse.results.length.to_s + p 'Results: ' + postResponse.results.inspect + + p '>>> Update ProfileAttribute' + patchProfileAttribute = ET_ProfileAttribute.new + patchProfileAttribute.authStub = stubObj + patchProfileAttribute.props = {"Name" => NameOfAttribute, "PropertyType"=>"string"} + patchResponse = patchProfileAttribute.patch + p 'Patch Status: ' + patchResponse.status.to_s + p 'Code: ' + patchResponse.code.to_s + p 'Message: ' + patchResponse.message.to_s + p 'Result Count: ' + patchResponse.results.length.to_s + p 'Results: ' + patchResponse.results.inspect + + p '>>> Delete ProfileAttribute' + deleteProfileAttribute = ET_ProfileAttribute.new + deleteProfileAttribute.authStub = stubObj + deleteProfileAttribute.props = {"Name" => NameOfAttribute} + deleteResponse = deleteProfileAttribute.delete + p 'Delete Status: ' + deleteResponse.status.to_s + p 'Code: ' + deleteResponse.code.to_s + p 'Message: ' + deleteResponse.message.to_s + p 'Result Count: ' + deleteResponse.results.length.to_s + p 'Results: ' + deleteResponse.results.inspect rescue => e - p "Caught exception: #{e.message}" - p e.backtrace + p "Caught exception: #{e.message}" + p e.backtrace end - diff --git a/samples/sample-sentevent.rb b/samples/sample-sentevent.rb index e3270e2..ef1e1a7 100644 --- a/samples/sample-sentevent.rb +++ b/samples/sample-sentevent.rb @@ -1,15 +1,15 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth ## Modify the date below to reduce the number of results returned from the request ## Setting this too far in the past could result in a very large response size retrieveDate = '2013-01-15T13:00:00.000' p '>>> Retrieve Filtered SentEvents with GetMoreResults' - getSentEvent = FuelSDK::SentEvent.new() + getSentEvent = MarketingCloudSDK::SentEvent.new() getSentEvent.authStub = stubObj getSentEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","ListID","PartnerKey","SubscriberID"] getSentEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate} @@ -38,7 +38,7 @@ # The following request could potentially bring back large amounts of data if run against a production account =begin p '>>> Retrieve All SentEvents with GetMoreResults' - getSentEvent = FuelSDK::SentEvent.new() + getSentEvent = MarketingCloudSDK::SentEvent.new() getSentEvent.authStub = stubObj getSentEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","ListID","PartnerKey","SubscriberID"] getResponse = getSentEvent.get diff --git a/samples/sample-subscriber.rb b/samples/sample-subscriber.rb index d32d179..d3f893b 100644 --- a/samples/sample-subscriber.rb +++ b/samples/sample-subscriber.rb @@ -1,8 +1,8 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' # contains auth with credentials begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # NOTE: These examples only work in accounts where the SubscriberKey functionality is not enabled # SubscriberKey will need to be included in the props if that feature is enabled @@ -11,7 +11,7 @@ # Create Subscriber p '>>> Create Subscriber' - postSub = FuelSDK::Subscriber.new + postSub = MarketingCloudSDK::Subscriber.new postSub.authStub = stubObj postSub.props = {"EmailAddress" => SubscriberTestEmail} p '>>> Posting' @@ -26,7 +26,7 @@ # Retrieve newly created Subscriber p '>>> Retrieve newly created Subscriber' - getSub = FuelSDK::Subscriber.new() + getSub = MarketingCloudSDK::Subscriber.new() getSub.authStub = stubObj getSub.props = ["SubscriberKey", "EmailAddress", "Status"] getSub.filter = {'Property' => 'SubscriberKey', 'SimpleOperator' => 'equals', 'Value' => SubscriberTestEmail} @@ -42,7 +42,7 @@ # Update Subscriber p '>>> Update Subscriber' - patchSub = FuelSDK::Subscriber.new + patchSub = MarketingCloudSDK::Subscriber.new patchSub.authStub = stubObj patchSub.props = {"EmailAddress" => SubscriberTestEmail, "Status" => "Unsubscribed"} patchResponse = patchSub.patch @@ -56,7 +56,7 @@ # Retrieve Subscriber that should have status unsubscribed now p '>>> Retrieve Subscriber that should have status unsubscribed now' - getSub = FuelSDK::Subscriber.new() + getSub = MarketingCloudSDK::Subscriber.new() getSub.authStub = stubObj getSub.props = ["SubscriberKey", "EmailAddress", "Status"] getSub.filter = {'Property' => 'SubscriberKey','SimpleOperator' => 'equals','Value' => SubscriberTestEmail}; @@ -72,7 +72,7 @@ # Delete Subscriber p '>>> Delete Subscriber' - deleteSub = FuelSDK::Subscriber.new() + deleteSub = MarketingCloudSDK::Subscriber.new() deleteSub.authStub = stubObj deleteSub.props = {"EmailAddress" => SubscriberTestEmail} deleteResponse = deleteSub.delete @@ -86,7 +86,7 @@ # Retrieve Subscriber to confirm deletion p '>>> Retrieve Subscriber to confirm deletion' - getSub = FuelSDK::Subscriber.new() + getSub = MarketingCloudSDK::Subscriber.new() getSub.authStub = stubObj getSub.props = ["SubscriberKey", "EmailAddress", "Status"] getSub.filter = {'Property' => 'SubscriberKey','SimpleOperator' => 'equals','Value' => SubscriberTestEmail}; @@ -105,7 +105,7 @@ # Retrieve All Subcribers with GetMoreResults p '>>> Retrieve All Subcribers with GetMoreResults' - getSub = FuelSDK::Subscriber.new() + getSub = MarketingCloudSDK::Subscriber.new() getSub.authStub = stubObj getSub.props = ["SubscriberKey", "EmailAddress", "Status"] getResponse = getSub.get @@ -133,4 +133,3 @@ p "Caught exception: #{e.message}" p e.backtrace end - diff --git a/samples/sample-triggeredsend.rb b/samples/sample-triggeredsend.rb index 979dfcd..57eaff6 100644 --- a/samples/sample-triggeredsend.rb +++ b/samples/sample-triggeredsend.rb @@ -1,13 +1,13 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require 'securerandom' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth # Get all TriggeredSendDefinitions p '>>> Get all TriggeredSendDefinitions' - getTS = FuelSDK::TriggeredSend.new + getTS = MarketingCloudSDK::TriggeredSend.new getTS.authStub = stubObj getTS.props = ["CustomerKey", "Name", "TriggeredSendStatus"] getResponse = getTS.get @@ -24,7 +24,7 @@ # Create a TriggeredSend Definition p '>>> Create a TriggeredSend Definition' - postTrig = FuelSDK::TriggeredSend.new + postTrig = MarketingCloudSDK::TriggeredSend.new postTrig.authStub = stubObj postTrig.props = {'CustomerKey' => TSNameForCreateThenDelete,'Name' => TSNameForCreateThenDelete, 'Email' => {"ID"=>"3113962"}, "SendClassification"=> {"CustomerKey"=> "2240"}} postResponse = postTrig.post @@ -42,7 +42,7 @@ # Pause a TriggeredSend p '>>> Pause a TriggeredSend' - patchTrig = FuelSDK::TriggeredSend.new + patchTrig = MarketingCloudSDK::TriggeredSend.new patchTrig.authStub = stubObj patchTrig.props = {"CustomerKey" => NameOfTestTS, "TriggeredSendStatus" =>"Inactive"} patchResponse = patchTrig.patch @@ -55,7 +55,7 @@ # Retrieve Single TriggeredSend p '>>> Retrieve Single TriggeredSend' - getTS = FuelSDK::TriggeredSend.new + getTS = MarketingCloudSDK::TriggeredSend.new getTS.authStub = stubObj getTS.props = ["CustomerKey", "Name", "TriggeredSendStatus"] getTS.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestTS} @@ -70,7 +70,7 @@ # Start a TriggeredSend by setting to Active p '>>> Start a TriggeredSend by setting to Active' - patchTrig = FuelSDK::TriggeredSend.new + patchTrig = MarketingCloudSDK::TriggeredSend.new patchTrig.authStub = stubObj patchTrig.props = {"CustomerKey" => NameOfTestTS, "TriggeredSendStatus" =>"Active"} patchResponse = patchTrig.patch @@ -83,7 +83,7 @@ # Retrieve Single TriggeredSend After setting back to active p '>>> Retrieve Single TriggeredSend After setting back to active' - getTS = FuelSDK::TriggeredSend.new + getTS = MarketingCloudSDK::TriggeredSend.new getTS.authStub = stubObj getTS.props = ["CustomerKey", "Name", "TriggeredSendStatus"] getTS.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestTS} @@ -98,7 +98,7 @@ # Send an email with TriggeredSend p '>>> Send an email with TriggeredSend' - sendTrig = FuelSDK::TriggeredSend.new + sendTrig = MarketingCloudSDK::TriggeredSend.new sendTrig.authStub = stubObj sendTrig.props = [{"CustomerKey" => NameOfTestTS, "Subscribers" => {"EmailAddress"=>"testing@bh.exacttarget.com", "SubscriberKey" => "testing@bh.exacttarget.com"}}] sendResponse = sendTrig.send @@ -112,7 +112,7 @@ # Delete a TriggeredSend Definition p '>>> Delete a TriggeredSend Definition ' - deleteTrig = FuelSDK::TriggeredSend.new + deleteTrig = MarketingCloudSDK::TriggeredSend.new deleteTrig.authStub = stubObj deleteTrig.props = {'CustomerKey' => TSNameForCreateThenDelete} deleteResponse = deleteTrig.delete @@ -127,4 +127,3 @@ p "Caught exception: #{e.message}" p e.backtrace end - diff --git a/samples/sample-unsubevent.rb b/samples/sample-unsubevent.rb index 02a7634..454582f 100644 --- a/samples/sample-unsubevent.rb +++ b/samples/sample-unsubevent.rb @@ -1,15 +1,15 @@ -require 'fuelsdk' +require 'marketingcloudsdk' require_relative 'sample_helper' begin - stubObj = FuelSDK::Client.new auth + stubObj = MarketingCloudSDK::Client.new auth ## Modify the date below to reduce the number of results returned from the request ## Setting this too far in the past could result in a very large response size retrieveDate = '2013-01-15T13:00:00.000' p '>>> Retrieve Filtered UnsubEvents with GetMoreResults' - getUnsubEvent = FuelSDK::UnsubEvent.new() + getUnsubEvent = MarketingCloudSDK::UnsubEvent.new() getUnsubEvent.authStub = stubObj getUnsubEvent.props = ["SendID","SubscriberKey","EventDate", "Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] @@ -40,7 +40,7 @@ # The following request could potentially bring back large amounts of data if run against a production account =begin p '>>> Retrieve All UnsubEvents with GetMoreResults' - getUnsubEvent = FuelSDK::UnsubEvent.new() + getUnsubEvent = MarketingCloudSDK::UnsubEvent.new() getUnsubEvent.authStub = stubObj getUnsubEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"] getResponse = getUnsubEvent.get