sfmc-fuelsdk-ruby 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +39 -39
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
- data/.gitignore +29 -29
- data/Gemfile +3 -3
- data/Gemfile.lock +104 -92
- data/Guardfile +8 -8
- data/LICENSE.md +13 -13
- data/README.md +200 -194
- data/Rakefile +1 -1
- data/lib/marketingcloudsdk.rb +74 -74
- data/lib/marketingcloudsdk/client.rb +395 -395
- data/lib/marketingcloudsdk/http_request.rb +118 -118
- data/lib/marketingcloudsdk/objects.rb +757 -757
- data/lib/marketingcloudsdk/rest.rb +118 -118
- data/lib/marketingcloudsdk/soap.rb +296 -296
- data/lib/marketingcloudsdk/targeting.rb +99 -99
- data/lib/marketingcloudsdk/utils.rb +47 -47
- data/lib/marketingcloudsdk/version.rb +39 -39
- data/lib/new.rb +1240 -1240
- data/marketingcloudsdk.gemspec +30 -30
- data/samples/sample-AddSubscriberToList.rb +56 -56
- data/samples/sample-CreateAndStartDataExtensionImport.rb +29 -29
- data/samples/sample-CreateAndStartListImport.rb +27 -27
- data/samples/sample-CreateContentAreas.rb +48 -48
- data/samples/sample-CreateDataExtensions.rb +54 -54
- data/samples/sample-CreateProfileAttributes.rb +48 -48
- data/samples/sample-SendEmailToDataExtension.rb +23 -23
- data/samples/sample-SendEmailToList.rb +23 -23
- data/samples/sample-SendTriggeredSends.rb +30 -30
- data/samples/sample-bounceevent.rb +70 -70
- data/samples/sample-campaign.rb +211 -211
- data/samples/sample-clickevent.rb +71 -71
- data/samples/sample-contentarea.rb +122 -122
- data/samples/sample-dataextension.rb +209 -209
- data/samples/sample-directverb.rb +54 -54
- data/samples/sample-email.rb +122 -122
- data/samples/sample-email.senddefinition.rb +134 -134
- data/samples/sample-folder.rb +143 -143
- data/samples/sample-import.rb +103 -103
- data/samples/sample-list.rb +105 -105
- data/samples/sample-list.subscriber.rb +97 -97
- data/samples/sample-openevent.rb +70 -70
- data/samples/sample-profileattribute.rb +56 -56
- data/samples/sample-sentevent.rb +70 -70
- data/samples/sample-subscriber.rb +135 -135
- data/samples/sample-triggeredsend.rb +129 -129
- data/samples/sample-unsubevent.rb +72 -72
- data/samples/sample_helper.rb.template +10 -10
- data/spec/client_spec.rb +416 -416
- data/spec/default_values_fallback_spec.rb +30 -30
- data/spec/helper_funcs_spec.rb +11 -11
- data/spec/http_request_spec.rb +61 -61
- data/spec/objects_helper_spec.rb +32 -32
- data/spec/objects_spec.rb +484 -484
- data/spec/public_or_web_integration_credentials.rb.template +11 -11
- data/spec/rest_spec.rb +48 -48
- data/spec/soap_spec.rb +140 -140
- data/spec/spec_helper.rb +14 -14
- data/spec/targeting_spec.rb +44 -44
- metadata +14 -27
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
myclient = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
## Example using CreateProfileAttributes() method
|
8
|
-
|
9
|
-
NameOfAttributeOne = "ExampleAttributeOne"
|
10
|
-
NameOfAttributeTwo = "ExampleAttributeTwo"
|
11
|
-
|
12
|
-
# Declare a Ruby Hash which contain all of the details for a DataExtension
|
13
|
-
profileAttrOne = {"Name" => NameOfAttributeOne, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
|
14
|
-
profileAttrTwo = {"Name" => NameOfAttributeTwo, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
|
15
|
-
|
16
|
-
# Call CreateDataExtensions passing in both DataExtension Hashes as an Array
|
17
|
-
response = myclient.CreateProfileAttributes([profileAttrOne,profileAttrTwo])
|
18
|
-
p 'Response Status: ' + response.status.to_s
|
19
|
-
p 'Code: ' + response.code.to_s
|
20
|
-
p 'Message: ' + response.message.to_s
|
21
|
-
p 'Results Length: ' + response.results.length.to_s
|
22
|
-
p 'Results: ' + response.results.to_s
|
23
|
-
|
24
|
-
p '>>> Delete profileAttrOne'
|
25
|
-
profileattr = ET_ProfileAttribute.new
|
26
|
-
profileattr.authStub = myclient
|
27
|
-
profileattr.props = {"Name" => NameOfAttributeOne}
|
28
|
-
delResponse = profileattr.delete
|
29
|
-
p 'Delete Status: ' + delResponse.status.to_s
|
30
|
-
p 'Code: ' + delResponse.code.to_s
|
31
|
-
p 'Message: ' + delResponse.message.to_s
|
32
|
-
p 'Results: ' + delResponse.results.inspect
|
33
|
-
|
34
|
-
p '>>> Delete profileAttrTwo'
|
35
|
-
profileattr = ET_ProfileAttribute.new
|
36
|
-
profileattr.authStub = myclient
|
37
|
-
profileattr.props = {"Name" => NameOfAttributeTwo}
|
38
|
-
delResponse = profileattr.delete
|
39
|
-
p 'Delete Status: ' + delResponse.status.to_s
|
40
|
-
p 'Code: ' + delResponse.code.to_s
|
41
|
-
p 'Message: ' + delResponse.message.to_s
|
42
|
-
p 'Results: ' + delResponse.results.inspect
|
43
|
-
|
44
|
-
rescue => e
|
45
|
-
p "Caught exception: #{e.message}"
|
46
|
-
p e.backtrace
|
47
|
-
end
|
48
|
-
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
## Example using CreateProfileAttributes() method
|
8
|
+
|
9
|
+
NameOfAttributeOne = "ExampleAttributeOne"
|
10
|
+
NameOfAttributeTwo = "ExampleAttributeTwo"
|
11
|
+
|
12
|
+
# Declare a Ruby Hash which contain all of the details for a DataExtension
|
13
|
+
profileAttrOne = {"Name" => NameOfAttributeOne, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
|
14
|
+
profileAttrTwo = {"Name" => NameOfAttributeTwo, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
|
15
|
+
|
16
|
+
# Call CreateDataExtensions passing in both DataExtension Hashes as an Array
|
17
|
+
response = myclient.CreateProfileAttributes([profileAttrOne,profileAttrTwo])
|
18
|
+
p 'Response Status: ' + response.status.to_s
|
19
|
+
p 'Code: ' + response.code.to_s
|
20
|
+
p 'Message: ' + response.message.to_s
|
21
|
+
p 'Results Length: ' + response.results.length.to_s
|
22
|
+
p 'Results: ' + response.results.to_s
|
23
|
+
|
24
|
+
p '>>> Delete profileAttrOne'
|
25
|
+
profileattr = ET_ProfileAttribute.new
|
26
|
+
profileattr.authStub = myclient
|
27
|
+
profileattr.props = {"Name" => NameOfAttributeOne}
|
28
|
+
delResponse = profileattr.delete
|
29
|
+
p 'Delete Status: ' + delResponse.status.to_s
|
30
|
+
p 'Code: ' + delResponse.code.to_s
|
31
|
+
p 'Message: ' + delResponse.message.to_s
|
32
|
+
p 'Results: ' + delResponse.results.inspect
|
33
|
+
|
34
|
+
p '>>> Delete profileAttrTwo'
|
35
|
+
profileattr = ET_ProfileAttribute.new
|
36
|
+
profileattr.authStub = myclient
|
37
|
+
profileattr.props = {"Name" => NameOfAttributeTwo}
|
38
|
+
delResponse = profileattr.delete
|
39
|
+
p 'Delete Status: ' + delResponse.status.to_s
|
40
|
+
p 'Code: ' + delResponse.code.to_s
|
41
|
+
p 'Message: ' + delResponse.message.to_s
|
42
|
+
p 'Results: ' + delResponse.results.inspect
|
43
|
+
|
44
|
+
rescue => e
|
45
|
+
p "Caught exception: #{e.message}"
|
46
|
+
p e.backtrace
|
47
|
+
end
|
48
|
+
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
myclient = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
EmailIDForSendDefinition = "3113962"
|
8
|
-
SendClassificationCustomerKey = "2239"
|
9
|
-
SendableDataExtensionCustomerKey = "F6F3871A-D124-499B-BBF5-3EFC0E827A51"
|
10
|
-
|
11
|
-
# Call SendEmailToDataExtension
|
12
|
-
response = myclient.SendEmailToDataExtension(EmailIDForSendDefinition, SendableDataExtensionCustomerKey,SendClassificationCustomerKey)
|
13
|
-
p 'Response Status: ' + response.status.to_s
|
14
|
-
p 'Code: ' + response.code.to_s
|
15
|
-
p 'Message: ' + response.message.to_s
|
16
|
-
p 'Results Length: ' + response.results.length.to_s
|
17
|
-
p 'Results: ' + response.results.to_s
|
18
|
-
|
19
|
-
rescue => e
|
20
|
-
p "Caught exception: #{e.message}"
|
21
|
-
p e.backtrace
|
22
|
-
end
|
23
|
-
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
EmailIDForSendDefinition = "3113962"
|
8
|
+
SendClassificationCustomerKey = "2239"
|
9
|
+
SendableDataExtensionCustomerKey = "F6F3871A-D124-499B-BBF5-3EFC0E827A51"
|
10
|
+
|
11
|
+
# Call SendEmailToDataExtension
|
12
|
+
response = myclient.SendEmailToDataExtension(EmailIDForSendDefinition, SendableDataExtensionCustomerKey,SendClassificationCustomerKey)
|
13
|
+
p 'Response Status: ' + response.status.to_s
|
14
|
+
p 'Code: ' + response.code.to_s
|
15
|
+
p 'Message: ' + response.message.to_s
|
16
|
+
p 'Results Length: ' + response.results.length.to_s
|
17
|
+
p 'Results: ' + response.results.to_s
|
18
|
+
|
19
|
+
rescue => e
|
20
|
+
p "Caught exception: #{e.message}"
|
21
|
+
p e.backtrace
|
22
|
+
end
|
23
|
+
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
myclient = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
EmailIDForSendDefinition = "3113962"
|
8
|
-
ListIDForSendDefinition = "1729515"
|
9
|
-
SendClassificationCustomerKey = "2239"
|
10
|
-
|
11
|
-
# Call SendEmailToList
|
12
|
-
response = myclient.SendEmailToList(EmailIDForSendDefinition, ListIDForSendDefinition,SendClassificationCustomerKey)
|
13
|
-
p 'Response Status: ' + response.status.to_s
|
14
|
-
p 'Code: ' + response.code.to_s
|
15
|
-
p 'Message: ' + response.message.to_s
|
16
|
-
p 'Results Length: ' + response.results.length.to_s
|
17
|
-
p 'Results: ' + response.results.to_s
|
18
|
-
|
19
|
-
rescue => e
|
20
|
-
p "Caught exception: #{e.message}"
|
21
|
-
p e.backtrace
|
22
|
-
end
|
23
|
-
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
EmailIDForSendDefinition = "3113962"
|
8
|
+
ListIDForSendDefinition = "1729515"
|
9
|
+
SendClassificationCustomerKey = "2239"
|
10
|
+
|
11
|
+
# Call SendEmailToList
|
12
|
+
response = myclient.SendEmailToList(EmailIDForSendDefinition, ListIDForSendDefinition,SendClassificationCustomerKey)
|
13
|
+
p 'Response Status: ' + response.status.to_s
|
14
|
+
p 'Code: ' + response.code.to_s
|
15
|
+
p 'Message: ' + response.message.to_s
|
16
|
+
p 'Results Length: ' + response.results.length.to_s
|
17
|
+
p 'Results: ' + response.results.to_s
|
18
|
+
|
19
|
+
rescue => e
|
20
|
+
p "Caught exception: #{e.message}"
|
21
|
+
p e.backtrace
|
22
|
+
end
|
23
|
+
|
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
myclient = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
TriggeredSendCustomerKey = "TEXTEXT"
|
8
|
-
AltTriggeredSendCustomerKey = "FailTest"
|
9
|
-
SubscriberEmailAddress = "SDKExample@bh.exacttarget.com"
|
10
|
-
|
11
|
-
# Call SendTriggeredSends which can be used to send emails to multiple definitions with a single request
|
12
|
-
# Limit usage to 50 subscribers per request.
|
13
|
-
tsOne = {"CustomerKey" => TriggeredSendCustomerKey}
|
14
|
-
tsOne['Subscribers'] = [{"EmailAddress"=>SubscriberEmailAddress, "SubscriberKey" => SubscriberEmailAddress}]
|
15
|
-
tsTwo = {"CustomerKey" => AltTriggeredSendCustomerKey}
|
16
|
-
tsTwo['Subscribers'] = [{"EmailAddress"=>SubscriberEmailAddress, "SubscriberKey" => SubscriberEmailAddress}]
|
17
|
-
|
18
|
-
response = myclient.SendTriggeredSends([tsOne,tsTwo])
|
19
|
-
p 'Response Status: ' + response.status.to_s
|
20
|
-
p 'Code: ' + response.code.to_s
|
21
|
-
p 'Message: ' + response.message.to_s
|
22
|
-
p 'Results Length: ' + response.results.length.to_s
|
23
|
-
p 'Results: ' + response.results.to_s
|
24
|
-
|
25
|
-
rescue => e
|
26
|
-
p "Caught exception: #{e.message}"
|
27
|
-
p e.backtrace
|
28
|
-
end
|
29
|
-
|
30
|
-
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
TriggeredSendCustomerKey = "TEXTEXT"
|
8
|
+
AltTriggeredSendCustomerKey = "FailTest"
|
9
|
+
SubscriberEmailAddress = "SDKExample@bh.exacttarget.com"
|
10
|
+
|
11
|
+
# Call SendTriggeredSends which can be used to send emails to multiple definitions with a single request
|
12
|
+
# Limit usage to 50 subscribers per request.
|
13
|
+
tsOne = {"CustomerKey" => TriggeredSendCustomerKey}
|
14
|
+
tsOne['Subscribers'] = [{"EmailAddress"=>SubscriberEmailAddress, "SubscriberKey" => SubscriberEmailAddress}]
|
15
|
+
tsTwo = {"CustomerKey" => AltTriggeredSendCustomerKey}
|
16
|
+
tsTwo['Subscribers'] = [{"EmailAddress"=>SubscriberEmailAddress, "SubscriberKey" => SubscriberEmailAddress}]
|
17
|
+
|
18
|
+
response = myclient.SendTriggeredSends([tsOne,tsTwo])
|
19
|
+
p 'Response Status: ' + response.status.to_s
|
20
|
+
p 'Code: ' + response.code.to_s
|
21
|
+
p 'Message: ' + response.message.to_s
|
22
|
+
p 'Results Length: ' + response.results.length.to_s
|
23
|
+
p 'Results: ' + response.results.to_s
|
24
|
+
|
25
|
+
rescue => e
|
26
|
+
p "Caught exception: #{e.message}"
|
27
|
+
p e.backtrace
|
28
|
+
end
|
29
|
+
|
30
|
+
|
@@ -1,70 +1,70 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
stubObj = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
## Modify the date below to reduce the number of results returned from the request
|
8
|
-
## Setting this too far in the past could result in a very large response size
|
9
|
-
retrieveDate = '2011-01-15T13:00:00.000'
|
10
|
-
|
11
|
-
p '>>> Retrieve Filtered BounceEvents with GetMoreResults'
|
12
|
-
getBounceEvent = MarketingCloudSDK::BounceEvent.new()
|
13
|
-
getBounceEvent.authStub = stubObj
|
14
|
-
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
15
|
-
getBounceEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate}
|
16
|
-
getResponse = getBounceEvent.get
|
17
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
18
|
-
p 'Code: ' + getResponse.code.to_s
|
19
|
-
p 'Message: ' + getResponse.message.to_s
|
20
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
21
|
-
p 'RequestID: ' + getResponse.request_id.to_s
|
22
|
-
p 'Results Length: ' + getResponse.results.length.to_s
|
23
|
-
# Since this could potentially return a large number of results, we do not want to print the results
|
24
|
-
p 'Results: ' + getResponse.results.to_s
|
25
|
-
raise 'Failure retrieving bounce events' unless getResponse.success?
|
26
|
-
|
27
|
-
while getResponse.more? do
|
28
|
-
p '>>> Continue Retrieve Filtered BounceEvents with GetMoreResults'
|
29
|
-
getResponse = getBounceEvent.continue
|
30
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
31
|
-
p 'Code: ' + getResponse.code.to_s
|
32
|
-
p 'Message: ' + getResponse.message.to_s
|
33
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
34
|
-
p 'RequestID: ' + getResponse.request_id.to_s
|
35
|
-
p 'Results Length: ' + getResponse.results.length.to_s
|
36
|
-
end
|
37
|
-
|
38
|
-
# The following request could potentially bring back large amounts of data if run against a production account
|
39
|
-
=begin
|
40
|
-
p '>>> Retrieve All BounceEvents with GetMoreResults'
|
41
|
-
getBounceEvent = FuelSDK::BounceEvent.new()
|
42
|
-
getBounceEvent.authStub = stubObj
|
43
|
-
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
44
|
-
getResponse = getBounceEvent.get
|
45
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
46
|
-
p 'Code: ' + getResponse.code.to_s
|
47
|
-
p 'Message: ' + getResponse.message.to_s
|
48
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
49
|
-
p 'RequestID: ' + getResponse.request_id.to_s
|
50
|
-
p 'Results Length: ' + getResponse.results.length.to_s
|
51
|
-
# Since this could potentially return a large number of results, we do not want to print the results
|
52
|
-
#p 'Results: ' + getResponse.results.to_s
|
53
|
-
|
54
|
-
while getResponse.more? do
|
55
|
-
p '>>> Continue Retrieve All BounceEvents with GetMoreResults'
|
56
|
-
getResponse = getBounceEvent.continue
|
57
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
58
|
-
p 'Code: ' + getResponse.code.to_s
|
59
|
-
p 'Message: ' + getResponse.message.to_s
|
60
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
61
|
-
p 'RequestID: ' + getResponse.request_id.to_s
|
62
|
-
p 'Results Length: ' + getResponse.results.length.to_s
|
63
|
-
end
|
64
|
-
=end
|
65
|
-
|
66
|
-
rescue => e
|
67
|
-
p "Caught exception: #{e.message}"
|
68
|
-
p e.backtrace
|
69
|
-
end
|
70
|
-
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
stubObj = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
## Modify the date below to reduce the number of results returned from the request
|
8
|
+
## Setting this too far in the past could result in a very large response size
|
9
|
+
retrieveDate = '2011-01-15T13:00:00.000'
|
10
|
+
|
11
|
+
p '>>> Retrieve Filtered BounceEvents with GetMoreResults'
|
12
|
+
getBounceEvent = MarketingCloudSDK::BounceEvent.new()
|
13
|
+
getBounceEvent.authStub = stubObj
|
14
|
+
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
15
|
+
getBounceEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate}
|
16
|
+
getResponse = getBounceEvent.get
|
17
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
18
|
+
p 'Code: ' + getResponse.code.to_s
|
19
|
+
p 'Message: ' + getResponse.message.to_s
|
20
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
21
|
+
p 'RequestID: ' + getResponse.request_id.to_s
|
22
|
+
p 'Results Length: ' + getResponse.results.length.to_s
|
23
|
+
# Since this could potentially return a large number of results, we do not want to print the results
|
24
|
+
p 'Results: ' + getResponse.results.to_s
|
25
|
+
raise 'Failure retrieving bounce events' unless getResponse.success?
|
26
|
+
|
27
|
+
while getResponse.more? do
|
28
|
+
p '>>> Continue Retrieve Filtered BounceEvents with GetMoreResults'
|
29
|
+
getResponse = getBounceEvent.continue
|
30
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
31
|
+
p 'Code: ' + getResponse.code.to_s
|
32
|
+
p 'Message: ' + getResponse.message.to_s
|
33
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
34
|
+
p 'RequestID: ' + getResponse.request_id.to_s
|
35
|
+
p 'Results Length: ' + getResponse.results.length.to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
# The following request could potentially bring back large amounts of data if run against a production account
|
39
|
+
=begin
|
40
|
+
p '>>> Retrieve All BounceEvents with GetMoreResults'
|
41
|
+
getBounceEvent = FuelSDK::BounceEvent.new()
|
42
|
+
getBounceEvent.authStub = stubObj
|
43
|
+
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
44
|
+
getResponse = getBounceEvent.get
|
45
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
46
|
+
p 'Code: ' + getResponse.code.to_s
|
47
|
+
p 'Message: ' + getResponse.message.to_s
|
48
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
49
|
+
p 'RequestID: ' + getResponse.request_id.to_s
|
50
|
+
p 'Results Length: ' + getResponse.results.length.to_s
|
51
|
+
# Since this could potentially return a large number of results, we do not want to print the results
|
52
|
+
#p 'Results: ' + getResponse.results.to_s
|
53
|
+
|
54
|
+
while getResponse.more? do
|
55
|
+
p '>>> Continue Retrieve All BounceEvents with GetMoreResults'
|
56
|
+
getResponse = getBounceEvent.continue
|
57
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
58
|
+
p 'Code: ' + getResponse.code.to_s
|
59
|
+
p 'Message: ' + getResponse.message.to_s
|
60
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
61
|
+
p 'RequestID: ' + getResponse.request_id.to_s
|
62
|
+
p 'Results Length: ' + getResponse.results.length.to_s
|
63
|
+
end
|
64
|
+
=end
|
65
|
+
|
66
|
+
rescue => e
|
67
|
+
p "Caught exception: #{e.message}"
|
68
|
+
p e.backtrace
|
69
|
+
end
|
70
|
+
|
data/samples/sample-campaign.rb
CHANGED
@@ -1,211 +1,211 @@
|
|
1
|
-
require 'marketingcloudsdk'
|
2
|
-
require_relative 'sample_helper'
|
3
|
-
|
4
|
-
begin
|
5
|
-
stubObj = MarketingCloudSDK::Client.new auth
|
6
|
-
|
7
|
-
# Create List
|
8
|
-
p '>>> Create List'
|
9
|
-
postList = MarketingCloudSDK::List.new
|
10
|
-
postList.authStub = stubObj
|
11
|
-
postList.props = {"ListName" => 'RubyAssetList', "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
12
|
-
postResponse = postList.post
|
13
|
-
p 'Post Status: ' + postResponse.status.to_s
|
14
|
-
p 'Code: ' + postResponse.code.to_s
|
15
|
-
p 'Message: ' + postResponse.message.to_s
|
16
|
-
p 'Result Count: ' + postResponse.results.length.to_s
|
17
|
-
p 'Results: ' + postResponse.results.inspect
|
18
|
-
|
19
|
-
raise 'Failure creating list for asset' unless postResponse.success?
|
20
|
-
|
21
|
-
# In order for this sample to run, it needs to have an asset that it can associate the campaign to
|
22
|
-
ExampleAssetType = "LIST"
|
23
|
-
ExampleAssetItemID = postResponse.results[0][:new_id]
|
24
|
-
|
25
|
-
# Retrieve all Campaigns
|
26
|
-
p '>>> Retrieve all Campaigns'
|
27
|
-
getCamp = MarketingCloudSDK::Campaign.new
|
28
|
-
getCamp.authStub = stubObj
|
29
|
-
getResponse = getCamp.get
|
30
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
31
|
-
p 'Code: ' + getResponse.code.to_s
|
32
|
-
p 'Message: ' + getResponse.message.to_s
|
33
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
34
|
-
p "Results: #{getResponse.results}"
|
35
|
-
p 'Results(Items) Length: ' + getResponse.results['items'].length.to_s
|
36
|
-
p '-----------------------------'
|
37
|
-
|
38
|
-
raise 'Failure retrieving campaigns' unless getResponse.success?
|
39
|
-
|
40
|
-
while getResponse.more? do
|
41
|
-
p '>>> Continue Retrieve all Campaigns with GetMoreResults'
|
42
|
-
getResponse = getCamp.continue
|
43
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
44
|
-
p 'Code: ' + getResponse.code.to_s
|
45
|
-
p 'Message: ' + getResponse.message.to_s
|
46
|
-
p 'MoreResults: ' + getResponse.more?.to_s
|
47
|
-
p 'Results(Items) Length: ' + getResponse.results['items'].length.to_s
|
48
|
-
end
|
49
|
-
|
50
|
-
# Create a new Campaign
|
51
|
-
p '>>> Create a new Campaign'
|
52
|
-
postCamp = MarketingCloudSDK::Campaign.new
|
53
|
-
postCamp.authStub = stubObj
|
54
|
-
postCamp.props = {"name" => "RubySDKCreatedForTest1", "description"=> "RubySDKCreatedForTest", "color"=>"FF9933", "favorite"=>"false"}
|
55
|
-
postResponse = postCamp.post
|
56
|
-
p 'Post Status: ' + postResponse.status.to_s
|
57
|
-
p 'Code: ' + postResponse.code.to_s
|
58
|
-
p 'Message: ' + postResponse.message.to_s
|
59
|
-
p 'Results: ' + postResponse.results.to_json
|
60
|
-
p '-----------------------------'
|
61
|
-
|
62
|
-
raise 'Failure creating campaign' unless postResponse.success?
|
63
|
-
|
64
|
-
IDOfpostCampaign = postResponse.results['id']
|
65
|
-
|
66
|
-
# Retrieve the new Campaign
|
67
|
-
p '>>> Retrieve the new Campaign'
|
68
|
-
getCamp = MarketingCloudSDK::Campaign.new
|
69
|
-
getCamp.authStub = stubObj
|
70
|
-
getCamp.props = {"id" => IDOfpostCampaign}
|
71
|
-
getResponse = getCamp.get
|
72
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
73
|
-
p 'Code: ' + getResponse.code.to_s
|
74
|
-
p 'Message: ' + getResponse.message.to_s
|
75
|
-
p 'Results: ' + getResponse.results.to_json
|
76
|
-
p '-----------------------------'
|
77
|
-
|
78
|
-
raise 'Failure retrieving campaign' unless getResponse.success?
|
79
|
-
|
80
|
-
# Update the new Campaign
|
81
|
-
p '>>> Update the new Campaign'
|
82
|
-
patchCamp = MarketingCloudSDK::Campaign.new
|
83
|
-
patchCamp.authStub = stubObj
|
84
|
-
patchCamp.props = {"id"=> IDOfpostCampaign, "name" => "RubySDKCreated-Updated!"}
|
85
|
-
patchResponse = patchCamp.patch
|
86
|
-
p 'Patch Status: ' + patchResponse.status.to_s
|
87
|
-
p 'Code: ' + patchResponse.code.to_s
|
88
|
-
p 'Message: ' + patchResponse.message.to_s
|
89
|
-
p 'Results: ' + patchResponse.results.to_json
|
90
|
-
p '-----------------------------'
|
91
|
-
|
92
|
-
raise 'Failure updating campaign' unless patchResponse.success?
|
93
|
-
|
94
|
-
# Retrieve the updated Campaign
|
95
|
-
p '>>> Retrieve the updated Campaign'
|
96
|
-
getCamp = MarketingCloudSDK::Campaign.new
|
97
|
-
getCamp.authStub = stubObj
|
98
|
-
getCamp.props = {"id" => IDOfpostCampaign}
|
99
|
-
getResponse = getCamp.get
|
100
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
101
|
-
p 'Code: ' + getResponse.code.to_s
|
102
|
-
p 'Message: ' + getResponse.message.to_s
|
103
|
-
p 'Results: ' + getResponse.results.to_json
|
104
|
-
p '-----------------------------'
|
105
|
-
|
106
|
-
raise 'Failure retrieving campaign' unless getResponse.success?
|
107
|
-
|
108
|
-
# Create a new Campaign Asset
|
109
|
-
p '>>> Create a new Campaign Asset'
|
110
|
-
postCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
111
|
-
postCampAsset.authStub = stubObj
|
112
|
-
postCampAsset.props = {"id" => IDOfpostCampaign, "ids"=> [ExampleAssetItemID], "type"=> ExampleAssetType}
|
113
|
-
postResponse = postCampAsset.post
|
114
|
-
p 'Post Status: ' + postResponse.status.to_s
|
115
|
-
p 'Code: ' + postResponse.code.to_s
|
116
|
-
p 'Message: ' + postResponse.message.to_s
|
117
|
-
p 'Results: ' + postResponse.results.to_json
|
118
|
-
p '-----------------------------'
|
119
|
-
|
120
|
-
raise 'Failure creating campaign assets' unless postResponse.success?
|
121
|
-
|
122
|
-
IDOfpostCampaignAsset = postResponse.results[0]['id']
|
123
|
-
|
124
|
-
# Retrieve all Campaign Asset for a campaign
|
125
|
-
p '>>> Retrieve all Campaign Asset for a Campaign'
|
126
|
-
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
127
|
-
getCampAsset.authStub = stubObj
|
128
|
-
getCampAsset.props = {"id" => IDOfpostCampaign}
|
129
|
-
getResponse = getCampAsset.get
|
130
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
131
|
-
p 'Code: ' + getResponse.code.to_s
|
132
|
-
p 'Message: ' + getResponse.message.to_s
|
133
|
-
p 'Results: ' + getResponse.results.inspect
|
134
|
-
p '-----------------------------'
|
135
|
-
|
136
|
-
raise 'Failure retrieving campaign assets' unless getResponse.success?
|
137
|
-
|
138
|
-
# Retrieve a single new Campaign Asset
|
139
|
-
p '>>> Retrieve a single new Campaign Asset'
|
140
|
-
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
141
|
-
getCampAsset.authStub = stubObj
|
142
|
-
getCampAsset.props = {"id" => IDOfpostCampaign, "assetId" => IDOfpostCampaignAsset}
|
143
|
-
getResponse = getCampAsset.get
|
144
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
145
|
-
p 'Code: ' + getResponse.code.to_s
|
146
|
-
p 'Message: ' + getResponse.message.to_s
|
147
|
-
p 'Results: ' + getResponse.results.inspect
|
148
|
-
p '-----------------------------'
|
149
|
-
|
150
|
-
raise 'Failure retrieving campaign asset' unless getResponse.success?
|
151
|
-
|
152
|
-
# Delete the new Campaign Asset
|
153
|
-
p '>>> Delete the new Campaign Asset'
|
154
|
-
deleteCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
155
|
-
deleteCampAsset.authStub = stubObj
|
156
|
-
deleteCampAsset.props = {"id" => IDOfpostCampaign, "assetId"=> IDOfpostCampaignAsset}
|
157
|
-
deleteResponse = deleteCampAsset.delete
|
158
|
-
p 'Delete Status: ' + deleteResponse.status.to_s
|
159
|
-
p 'Code: ' + deleteResponse.code.to_s
|
160
|
-
p 'Message: ' + deleteResponse.message.to_s
|
161
|
-
p 'Results: ' + deleteResponse.results.to_json
|
162
|
-
p '-----------------------------'
|
163
|
-
|
164
|
-
raise 'Failure deleting campaign asset' unless deleteResponse.success?
|
165
|
-
|
166
|
-
# Get a single a new Campaign Asset to confirm deletion
|
167
|
-
p '>>> Get a single a new Campaign Asset to confirm deletion'
|
168
|
-
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
169
|
-
getCampAsset.authStub = stubObj
|
170
|
-
getCampAsset.props = {"id" => IDOfpostCampaign}
|
171
|
-
getResponse = getCampAsset.get
|
172
|
-
p 'Retrieve Status: ' + getResponse.status.to_s
|
173
|
-
p 'Code: ' + getResponse.code.to_s
|
174
|
-
p 'Message: ' + getResponse.message.to_s
|
175
|
-
p 'Results: ' + getResponse.results.inspect
|
176
|
-
p '-----------------------------'
|
177
|
-
|
178
|
-
raise 'Failure retrieving campaign asset' unless getResponse.success?
|
179
|
-
raise 'Failure retrieving campaign asset' unless getResponse.results['totalCount'] == 0
|
180
|
-
|
181
|
-
rescue => e
|
182
|
-
p "Caught exception: #{e.message}"
|
183
|
-
p e.backtrace
|
184
|
-
|
185
|
-
ensure
|
186
|
-
|
187
|
-
# Delete the new Campaign
|
188
|
-
p '>>> Delete the new Campaign'
|
189
|
-
deleteCamp = MarketingCloudSDK::Campaign.new
|
190
|
-
deleteCamp.authStub = stubObj
|
191
|
-
deleteCamp.props = {"id"=> IDOfpostCampaign}
|
192
|
-
deleteResponse = deleteCamp.delete
|
193
|
-
p 'Delete Status: ' + deleteResponse.status.to_s
|
194
|
-
p 'Code: ' + deleteResponse.code.to_s
|
195
|
-
p 'Message: ' + deleteResponse.message.to_s
|
196
|
-
p 'Results: ' + deleteResponse.results.to_json
|
197
|
-
p '-----------------------------'
|
198
|
-
|
199
|
-
raise 'Failure deleting campaign asset' unless deleteResponse.success?
|
200
|
-
|
201
|
-
p '>>> Delete List'
|
202
|
-
deleteSub = MarketingCloudSDK::List.new()
|
203
|
-
deleteSub.authStub = stubObj
|
204
|
-
deleteSub.props = {"ID" => ExampleAssetItemID}
|
205
|
-
deleteResponse = deleteSub.delete
|
206
|
-
p 'Delete Status: ' + deleteResponse.status.to_s
|
207
|
-
p 'Code: ' + deleteResponse.code.to_s
|
208
|
-
p 'Message: ' + deleteResponse.message.to_s
|
209
|
-
p 'Results Length: ' + deleteResponse.results.length.to_s
|
210
|
-
p 'Results: ' + deleteResponse.results.to_s
|
211
|
-
end
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
stubObj = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
# Create List
|
8
|
+
p '>>> Create List'
|
9
|
+
postList = MarketingCloudSDK::List.new
|
10
|
+
postList.authStub = stubObj
|
11
|
+
postList.props = {"ListName" => 'RubyAssetList', "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
12
|
+
postResponse = postList.post
|
13
|
+
p 'Post Status: ' + postResponse.status.to_s
|
14
|
+
p 'Code: ' + postResponse.code.to_s
|
15
|
+
p 'Message: ' + postResponse.message.to_s
|
16
|
+
p 'Result Count: ' + postResponse.results.length.to_s
|
17
|
+
p 'Results: ' + postResponse.results.inspect
|
18
|
+
|
19
|
+
raise 'Failure creating list for asset' unless postResponse.success?
|
20
|
+
|
21
|
+
# In order for this sample to run, it needs to have an asset that it can associate the campaign to
|
22
|
+
ExampleAssetType = "LIST"
|
23
|
+
ExampleAssetItemID = postResponse.results[0][:new_id]
|
24
|
+
|
25
|
+
# Retrieve all Campaigns
|
26
|
+
p '>>> Retrieve all Campaigns'
|
27
|
+
getCamp = MarketingCloudSDK::Campaign.new
|
28
|
+
getCamp.authStub = stubObj
|
29
|
+
getResponse = getCamp.get
|
30
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
31
|
+
p 'Code: ' + getResponse.code.to_s
|
32
|
+
p 'Message: ' + getResponse.message.to_s
|
33
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
34
|
+
p "Results: #{getResponse.results}"
|
35
|
+
p 'Results(Items) Length: ' + getResponse.results['items'].length.to_s
|
36
|
+
p '-----------------------------'
|
37
|
+
|
38
|
+
raise 'Failure retrieving campaigns' unless getResponse.success?
|
39
|
+
|
40
|
+
while getResponse.more? do
|
41
|
+
p '>>> Continue Retrieve all Campaigns with GetMoreResults'
|
42
|
+
getResponse = getCamp.continue
|
43
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
44
|
+
p 'Code: ' + getResponse.code.to_s
|
45
|
+
p 'Message: ' + getResponse.message.to_s
|
46
|
+
p 'MoreResults: ' + getResponse.more?.to_s
|
47
|
+
p 'Results(Items) Length: ' + getResponse.results['items'].length.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
# Create a new Campaign
|
51
|
+
p '>>> Create a new Campaign'
|
52
|
+
postCamp = MarketingCloudSDK::Campaign.new
|
53
|
+
postCamp.authStub = stubObj
|
54
|
+
postCamp.props = {"name" => "RubySDKCreatedForTest1", "description"=> "RubySDKCreatedForTest", "color"=>"FF9933", "favorite"=>"false"}
|
55
|
+
postResponse = postCamp.post
|
56
|
+
p 'Post Status: ' + postResponse.status.to_s
|
57
|
+
p 'Code: ' + postResponse.code.to_s
|
58
|
+
p 'Message: ' + postResponse.message.to_s
|
59
|
+
p 'Results: ' + postResponse.results.to_json
|
60
|
+
p '-----------------------------'
|
61
|
+
|
62
|
+
raise 'Failure creating campaign' unless postResponse.success?
|
63
|
+
|
64
|
+
IDOfpostCampaign = postResponse.results['id']
|
65
|
+
|
66
|
+
# Retrieve the new Campaign
|
67
|
+
p '>>> Retrieve the new Campaign'
|
68
|
+
getCamp = MarketingCloudSDK::Campaign.new
|
69
|
+
getCamp.authStub = stubObj
|
70
|
+
getCamp.props = {"id" => IDOfpostCampaign}
|
71
|
+
getResponse = getCamp.get
|
72
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
73
|
+
p 'Code: ' + getResponse.code.to_s
|
74
|
+
p 'Message: ' + getResponse.message.to_s
|
75
|
+
p 'Results: ' + getResponse.results.to_json
|
76
|
+
p '-----------------------------'
|
77
|
+
|
78
|
+
raise 'Failure retrieving campaign' unless getResponse.success?
|
79
|
+
|
80
|
+
# Update the new Campaign
|
81
|
+
p '>>> Update the new Campaign'
|
82
|
+
patchCamp = MarketingCloudSDK::Campaign.new
|
83
|
+
patchCamp.authStub = stubObj
|
84
|
+
patchCamp.props = {"id"=> IDOfpostCampaign, "name" => "RubySDKCreated-Updated!"}
|
85
|
+
patchResponse = patchCamp.patch
|
86
|
+
p 'Patch Status: ' + patchResponse.status.to_s
|
87
|
+
p 'Code: ' + patchResponse.code.to_s
|
88
|
+
p 'Message: ' + patchResponse.message.to_s
|
89
|
+
p 'Results: ' + patchResponse.results.to_json
|
90
|
+
p '-----------------------------'
|
91
|
+
|
92
|
+
raise 'Failure updating campaign' unless patchResponse.success?
|
93
|
+
|
94
|
+
# Retrieve the updated Campaign
|
95
|
+
p '>>> Retrieve the updated Campaign'
|
96
|
+
getCamp = MarketingCloudSDK::Campaign.new
|
97
|
+
getCamp.authStub = stubObj
|
98
|
+
getCamp.props = {"id" => IDOfpostCampaign}
|
99
|
+
getResponse = getCamp.get
|
100
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
101
|
+
p 'Code: ' + getResponse.code.to_s
|
102
|
+
p 'Message: ' + getResponse.message.to_s
|
103
|
+
p 'Results: ' + getResponse.results.to_json
|
104
|
+
p '-----------------------------'
|
105
|
+
|
106
|
+
raise 'Failure retrieving campaign' unless getResponse.success?
|
107
|
+
|
108
|
+
# Create a new Campaign Asset
|
109
|
+
p '>>> Create a new Campaign Asset'
|
110
|
+
postCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
111
|
+
postCampAsset.authStub = stubObj
|
112
|
+
postCampAsset.props = {"id" => IDOfpostCampaign, "ids"=> [ExampleAssetItemID], "type"=> ExampleAssetType}
|
113
|
+
postResponse = postCampAsset.post
|
114
|
+
p 'Post Status: ' + postResponse.status.to_s
|
115
|
+
p 'Code: ' + postResponse.code.to_s
|
116
|
+
p 'Message: ' + postResponse.message.to_s
|
117
|
+
p 'Results: ' + postResponse.results.to_json
|
118
|
+
p '-----------------------------'
|
119
|
+
|
120
|
+
raise 'Failure creating campaign assets' unless postResponse.success?
|
121
|
+
|
122
|
+
IDOfpostCampaignAsset = postResponse.results[0]['id']
|
123
|
+
|
124
|
+
# Retrieve all Campaign Asset for a campaign
|
125
|
+
p '>>> Retrieve all Campaign Asset for a Campaign'
|
126
|
+
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
127
|
+
getCampAsset.authStub = stubObj
|
128
|
+
getCampAsset.props = {"id" => IDOfpostCampaign}
|
129
|
+
getResponse = getCampAsset.get
|
130
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
131
|
+
p 'Code: ' + getResponse.code.to_s
|
132
|
+
p 'Message: ' + getResponse.message.to_s
|
133
|
+
p 'Results: ' + getResponse.results.inspect
|
134
|
+
p '-----------------------------'
|
135
|
+
|
136
|
+
raise 'Failure retrieving campaign assets' unless getResponse.success?
|
137
|
+
|
138
|
+
# Retrieve a single new Campaign Asset
|
139
|
+
p '>>> Retrieve a single new Campaign Asset'
|
140
|
+
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
141
|
+
getCampAsset.authStub = stubObj
|
142
|
+
getCampAsset.props = {"id" => IDOfpostCampaign, "assetId" => IDOfpostCampaignAsset}
|
143
|
+
getResponse = getCampAsset.get
|
144
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
145
|
+
p 'Code: ' + getResponse.code.to_s
|
146
|
+
p 'Message: ' + getResponse.message.to_s
|
147
|
+
p 'Results: ' + getResponse.results.inspect
|
148
|
+
p '-----------------------------'
|
149
|
+
|
150
|
+
raise 'Failure retrieving campaign asset' unless getResponse.success?
|
151
|
+
|
152
|
+
# Delete the new Campaign Asset
|
153
|
+
p '>>> Delete the new Campaign Asset'
|
154
|
+
deleteCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
155
|
+
deleteCampAsset.authStub = stubObj
|
156
|
+
deleteCampAsset.props = {"id" => IDOfpostCampaign, "assetId"=> IDOfpostCampaignAsset}
|
157
|
+
deleteResponse = deleteCampAsset.delete
|
158
|
+
p 'Delete Status: ' + deleteResponse.status.to_s
|
159
|
+
p 'Code: ' + deleteResponse.code.to_s
|
160
|
+
p 'Message: ' + deleteResponse.message.to_s
|
161
|
+
p 'Results: ' + deleteResponse.results.to_json
|
162
|
+
p '-----------------------------'
|
163
|
+
|
164
|
+
raise 'Failure deleting campaign asset' unless deleteResponse.success?
|
165
|
+
|
166
|
+
# Get a single a new Campaign Asset to confirm deletion
|
167
|
+
p '>>> Get a single a new Campaign Asset to confirm deletion'
|
168
|
+
getCampAsset = MarketingCloudSDK::Campaign::Asset.new
|
169
|
+
getCampAsset.authStub = stubObj
|
170
|
+
getCampAsset.props = {"id" => IDOfpostCampaign}
|
171
|
+
getResponse = getCampAsset.get
|
172
|
+
p 'Retrieve Status: ' + getResponse.status.to_s
|
173
|
+
p 'Code: ' + getResponse.code.to_s
|
174
|
+
p 'Message: ' + getResponse.message.to_s
|
175
|
+
p 'Results: ' + getResponse.results.inspect
|
176
|
+
p '-----------------------------'
|
177
|
+
|
178
|
+
raise 'Failure retrieving campaign asset' unless getResponse.success?
|
179
|
+
raise 'Failure retrieving campaign asset' unless getResponse.results['totalCount'] == 0
|
180
|
+
|
181
|
+
rescue => e
|
182
|
+
p "Caught exception: #{e.message}"
|
183
|
+
p e.backtrace
|
184
|
+
|
185
|
+
ensure
|
186
|
+
|
187
|
+
# Delete the new Campaign
|
188
|
+
p '>>> Delete the new Campaign'
|
189
|
+
deleteCamp = MarketingCloudSDK::Campaign.new
|
190
|
+
deleteCamp.authStub = stubObj
|
191
|
+
deleteCamp.props = {"id"=> IDOfpostCampaign}
|
192
|
+
deleteResponse = deleteCamp.delete
|
193
|
+
p 'Delete Status: ' + deleteResponse.status.to_s
|
194
|
+
p 'Code: ' + deleteResponse.code.to_s
|
195
|
+
p 'Message: ' + deleteResponse.message.to_s
|
196
|
+
p 'Results: ' + deleteResponse.results.to_json
|
197
|
+
p '-----------------------------'
|
198
|
+
|
199
|
+
raise 'Failure deleting campaign asset' unless deleteResponse.success?
|
200
|
+
|
201
|
+
p '>>> Delete List'
|
202
|
+
deleteSub = MarketingCloudSDK::List.new()
|
203
|
+
deleteSub.authStub = stubObj
|
204
|
+
deleteSub.props = {"ID" => ExampleAssetItemID}
|
205
|
+
deleteResponse = deleteSub.delete
|
206
|
+
p 'Delete Status: ' + deleteResponse.status.to_s
|
207
|
+
p 'Code: ' + deleteResponse.code.to_s
|
208
|
+
p 'Message: ' + deleteResponse.message.to_s
|
209
|
+
p 'Results Length: ' + deleteResponse.results.length.to_s
|
210
|
+
p 'Results: ' + deleteResponse.results.to_s
|
211
|
+
end
|