MyPreciousRuby1 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +92 -0
- data/Guardfile +8 -0
- data/LICENSE.md +13 -0
- data/README.md +139 -0
- data/Rakefile +1 -0
- data/lib/marketingcloudsdk.rb +74 -0
- data/lib/marketingcloudsdk/client.rb +296 -0
- data/lib/marketingcloudsdk/http_request.rb +118 -0
- data/lib/marketingcloudsdk/objects.rb +757 -0
- data/lib/marketingcloudsdk/rest.rb +118 -0
- data/lib/marketingcloudsdk/soap.rb +282 -0
- data/lib/marketingcloudsdk/targeting.rb +99 -0
- data/lib/marketingcloudsdk/utils.rb +47 -0
- data/lib/marketingcloudsdk/version.rb +39 -0
- data/lib/new.rb +1240 -0
- data/marketingcloudsdk.gemspec +30 -0
- data/samples/sample-AddSubscriberToList.rb +56 -0
- data/samples/sample-CreateAndStartDataExtensionImport.rb +29 -0
- data/samples/sample-CreateAndStartListImport.rb +27 -0
- data/samples/sample-CreateContentAreas.rb +48 -0
- data/samples/sample-CreateDataExtensions.rb +54 -0
- data/samples/sample-CreateProfileAttributes.rb +48 -0
- data/samples/sample-SendEmailToDataExtension.rb +23 -0
- data/samples/sample-SendEmailToList.rb +23 -0
- data/samples/sample-SendTriggeredSends.rb +30 -0
- data/samples/sample-bounceevent.rb +70 -0
- data/samples/sample-campaign.rb +211 -0
- data/samples/sample-clickevent.rb +71 -0
- data/samples/sample-contentarea.rb +122 -0
- data/samples/sample-dataextension.rb +209 -0
- data/samples/sample-directverb.rb +54 -0
- data/samples/sample-email.rb +122 -0
- data/samples/sample-email.senddefinition.rb +134 -0
- data/samples/sample-folder.rb +143 -0
- data/samples/sample-import.rb +103 -0
- data/samples/sample-list.rb +105 -0
- data/samples/sample-list.subscriber.rb +97 -0
- data/samples/sample-openevent.rb +70 -0
- data/samples/sample-profileattribute.rb +56 -0
- data/samples/sample-sentevent.rb +70 -0
- data/samples/sample-subscriber.rb +135 -0
- data/samples/sample-triggeredsend.rb +129 -0
- data/samples/sample-unsubevent.rb +72 -0
- data/samples/sample_helper.rb.template +10 -0
- data/spec/client_spec.rb +218 -0
- data/spec/default_values_fallback_spec.rb +30 -0
- data/spec/helper_funcs_spec.rb +11 -0
- data/spec/http_request_spec.rb +61 -0
- data/spec/objects_helper_spec.rb +32 -0
- data/spec/objects_spec.rb +484 -0
- data/spec/rest_spec.rb +48 -0
- data/spec/soap_spec.rb +140 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/targeting_spec.rb +44 -0
- metadata +262 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'marketingcloudsdk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "MyPreciousRuby1"
|
8
|
+
spec.version = MarketingCloudSDK::VERSION
|
9
|
+
spec.authors = ["Ciprian"]
|
10
|
+
spec.email = ["cbetiuc@salesforce.com"]
|
11
|
+
spec.description = %q{API wrapper for SOAP and REST API with Salesforce Marketing Cloud (ExactTarget)}
|
12
|
+
spec.summary = %q{Fuel Client Library for Ruby}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = ""
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(samples|test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler","~> 1.3"
|
22
|
+
spec.add_development_dependency 'rake','~>0.9'
|
23
|
+
spec.add_development_dependency "rspec",'~> 2.0'
|
24
|
+
spec.add_development_dependency "guard",'~> 1.1'
|
25
|
+
spec.add_development_dependency "guard-rspec",'~> 2.0'
|
26
|
+
|
27
|
+
spec.add_dependency "savon", "2.2.0"
|
28
|
+
spec.add_dependency "json", "~>1.8",">= 1.8.1"
|
29
|
+
spec.add_dependency "jwt", "~>1.0",">= 1.0.0"
|
30
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
stubObj = ET_Client.new auth
|
6
|
+
|
7
|
+
NewListName = "RubySDKList"
|
8
|
+
|
9
|
+
## Example using AddSubscriberToList() method
|
10
|
+
## Typically this method will be used with a pre-existing list but for testing purposes one is being created.
|
11
|
+
|
12
|
+
# Create List
|
13
|
+
p '>>> Create List'
|
14
|
+
postList = ET_List.new
|
15
|
+
postList.authStub = stubObj
|
16
|
+
postList.props = {"ListName" => NewListName, "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
17
|
+
postResponse = postList.post
|
18
|
+
p 'Post Status: ' + postResponse.status.to_s
|
19
|
+
p 'Code: ' + postResponse.code.to_s
|
20
|
+
p 'Message: ' + postResponse.message.to_s
|
21
|
+
p 'Result Count: ' + postResponse.results.length.to_s
|
22
|
+
p 'Results: ' + postResponse.results.inspect
|
23
|
+
raise 'Failure creating list' unless postResponse.success?
|
24
|
+
|
25
|
+
if postResponse.status then
|
26
|
+
|
27
|
+
newListID = postResponse.results[0][:new_id]
|
28
|
+
# Adding Subscriber To a List
|
29
|
+
p '>>> Add Subscriber To a List'
|
30
|
+
AddSubResponse = stubObj.AddSubscriberToList("AddSubTesting@bh.exacttarget.com", [newListID], "Test")
|
31
|
+
p 'AddSubResponse Status: ' + AddSubResponse.status.to_s
|
32
|
+
p 'Code: ' + AddSubResponse.code.to_s
|
33
|
+
p 'Message: ' + AddSubResponse.message.to_s
|
34
|
+
p 'Result Count: ' + AddSubResponse.results.length.to_s
|
35
|
+
p 'Results: ' + AddSubResponse.results.inspect
|
36
|
+
raise 'Failure adding user to list' unless AddSubResponse.success?
|
37
|
+
|
38
|
+
# Delete List
|
39
|
+
p '>>> Delete List'
|
40
|
+
deleteSub = ET_List.new()
|
41
|
+
deleteSub.authStub = stubObj
|
42
|
+
deleteSub.props = {"ID" => newListID}
|
43
|
+
deleteResponse = deleteSub.delete
|
44
|
+
p 'Delete Status: ' + deleteResponse.status.to_s
|
45
|
+
p 'Code: ' + deleteResponse.code.to_s
|
46
|
+
p 'Message: ' + deleteResponse.message.to_s
|
47
|
+
p 'Results Length: ' + deleteResponse.results.length.to_s
|
48
|
+
p 'Results: ' + deleteResponse.results.to_s
|
49
|
+
raise 'Failure deleting list' unless deleteResponse.success?
|
50
|
+
end
|
51
|
+
|
52
|
+
rescue => e
|
53
|
+
p "Caught exception: #{e.message}"
|
54
|
+
p e.backtrace
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
DataExtensionCustomerKey = "62476204-bfd3-de11-95ca-001e0bbae8cc"
|
8
|
+
CSVFileName = "SDKExample.csv"
|
9
|
+
|
10
|
+
=begin
|
11
|
+
* Parameters:
|
12
|
+
* Data Extension CustomerKey - CustomerKey values are displayed in the UI as External Key
|
13
|
+
* File Name - File must be a CSV located on your ExactTarget FTP Site
|
14
|
+
* Overwrite (Boolean) - Set to True in order to overwrite all existing data in the data extension. Required if Data Extension does not have a primary key.
|
15
|
+
=end
|
16
|
+
|
17
|
+
response = myclient.CreateAndStartDataExtensionImport(DataExtensionCustomerKey, CSVFileName, true)
|
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
|
+
rescue => e
|
25
|
+
p "Caught exception: #{e.message}"
|
26
|
+
p e.backtrace
|
27
|
+
end
|
28
|
+
|
29
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
ListID = "1956035"
|
7
|
+
CSVFileName = "SDKExample.csv"
|
8
|
+
|
9
|
+
=begin
|
10
|
+
* Parameters:
|
11
|
+
* List ID
|
12
|
+
* File Name - File must be a CSV located on your ExactTarget FTP Site
|
13
|
+
=end
|
14
|
+
|
15
|
+
response = myclient.CreateAndStartListImport(ListID, CSVFileName)
|
16
|
+
p 'Response Status: ' + response.status.to_s
|
17
|
+
p 'Code: ' + response.code.to_s
|
18
|
+
p 'Message: ' + response.message.to_s
|
19
|
+
p 'Results Length: ' + response.results.length.to_s
|
20
|
+
p 'Results: ' + response.results.to_s
|
21
|
+
|
22
|
+
rescue => e
|
23
|
+
p "Caught exception: #{e.message}"
|
24
|
+
p e.backtrace
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = MarketingCloudSDK::Client.new auth
|
6
|
+
|
7
|
+
## Example using CreateContentAreas() method
|
8
|
+
|
9
|
+
NameOfContentAreaOne = "ExampleContentAreaOne"
|
10
|
+
NameOfContentAreaTwo = "ExampleContentAreaTwo"
|
11
|
+
|
12
|
+
# Declare a Ruby Hash which contain all of the details for a DataExtension
|
13
|
+
contAreaOne = {"CustomerKey" => NameOfContentAreaOne, "Name"=>NameOfContentAreaOne, "Content"=> "<b>Some HTML Content Goes here</b>"}
|
14
|
+
contAreaTwo = {"CustomerKey" => NameOfContentAreaTwo, "Name"=>NameOfContentAreaTwo, "Content"=> "<b>Some Different HTML Content Goes here</b>"}
|
15
|
+
|
16
|
+
# Call CreateDataExtensions passing in both DataExtension Hashes as an Array
|
17
|
+
response = myclient.CreateContentAreas([contAreaOne,contAreaTwo])
|
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 contAreaOne'
|
25
|
+
contArea = ET_ContentArea.new
|
26
|
+
contArea.authStub = myclient
|
27
|
+
contArea.props = {"CustomerKey" => NameOfContentAreaOne}
|
28
|
+
delResponse = contArea.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 contAreaTwo'
|
35
|
+
contArea = ET_ContentArea.new
|
36
|
+
contArea.authStub = myclient
|
37
|
+
contArea.props = {"CustomerKey" => NameOfContentAreaTwo}
|
38
|
+
delResponse = contArea.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
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'marketingcloudsdk'
|
2
|
+
require_relative 'sample_helper'
|
3
|
+
|
4
|
+
begin
|
5
|
+
myclient = ET_Client.new auth
|
6
|
+
|
7
|
+
## Example using CreateDataExtensions() method
|
8
|
+
|
9
|
+
# Declare a Ruby Hash which contain all of the details for a DataExtension
|
10
|
+
deOne = {"Name" => "HelperDEOne","CustomerKey" => "HelperDEOne"}
|
11
|
+
deOne['columns'] = [{"Name" => "Name", "FieldType" => "Text", "IsPrimaryKey" => "true", "MaxLength" => "100", "IsRequired" => "true"},{"Name" => "OtherField", "FieldType" => "Text"}]
|
12
|
+
|
13
|
+
# Declare a 2nd Ruby Hash which contain all of the details for a DataExtension
|
14
|
+
deTwo = {"Name" => "HelperDETwo","CustomerKey" => "HelperDETwo"}
|
15
|
+
deTwo['columns'] = [{"Name" => "Name", "FieldType" => "Text", "IsPrimaryKey" => "true", "MaxLength" => "100", "IsRequired" => "true"},{"Name" => "OtherField", "FieldType" => "Text"}]
|
16
|
+
|
17
|
+
# Call CreateDataExtensions passing in both DataExtension Hashes as an Array
|
18
|
+
createDEResponse = myclient.CreateDataExtensions([deOne, deTwo])
|
19
|
+
p 'CreateDataExtensions Status: ' + createDEResponse.status.to_s
|
20
|
+
p 'Code: ' + createDEResponse.code.to_s
|
21
|
+
p 'Message: ' + createDEResponse.message.to_s
|
22
|
+
p 'Results Length: ' + createDEResponse.results.length.to_s
|
23
|
+
p 'Results: ' + createDEResponse.results.to_s
|
24
|
+
raise 'Failure creating data extensions' unless createDEResponse.success?
|
25
|
+
raise 'Failure creating data extensions' unless createDEResponse.results.count == 2
|
26
|
+
|
27
|
+
# Cleaning up the newly created DEs
|
28
|
+
# Delete deOne
|
29
|
+
p '>>> Delete deOne'
|
30
|
+
de5 = ET_DataExtension.new
|
31
|
+
de5.authStub = myclient
|
32
|
+
de5.props = {"CustomerKey" => "HelperDEOne"}
|
33
|
+
delResponse = de5.delete
|
34
|
+
p 'Delete Status: ' + delResponse.status.to_s
|
35
|
+
p 'Code: ' + delResponse.code.to_s
|
36
|
+
p 'Message: ' + delResponse.message.to_s
|
37
|
+
p 'Results: ' + delResponse.results.inspect
|
38
|
+
|
39
|
+
# Delete deTwo
|
40
|
+
p '>>> Delete deTwo'
|
41
|
+
de5 = ET_DataExtension.new
|
42
|
+
de5.authStub = myclient
|
43
|
+
de5.props = {"CustomerKey" => "HelperDETwo"}
|
44
|
+
delResponse = de5.delete
|
45
|
+
p 'Delete Status: ' + delResponse.status.to_s
|
46
|
+
p 'Code: ' + delResponse.code.to_s
|
47
|
+
p 'Message: ' + delResponse.message.to_s
|
48
|
+
p 'Results: ' + delResponse.results.inspect
|
49
|
+
|
50
|
+
rescue => e
|
51
|
+
p "Caught exception: #{e.message}"
|
52
|
+
p e.backtrace
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +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
|
+
|
@@ -0,0 +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
|
+
|
@@ -0,0 +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
|
+
|
@@ -0,0 +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
|
+
|
@@ -0,0 +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
|
+
|