fuelsdk 0.0.3 → 0.0.4
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.
- data/README.md +35 -37
- data/lib/fuelsdk.rb +16 -0
- data/lib/fuelsdk/client.rb +2 -3
- data/lib/fuelsdk/http_request.rb +1 -1
- data/lib/fuelsdk/objects.rb +89 -77
- data/lib/fuelsdk/soap.rb +79 -33
- data/lib/fuelsdk/version.rb +1 -1
- data/samples/sample-bounceevent.rb +3 -3
- data/samples/sample-campaign.rb +14 -14
- data/samples/sample-clickevent.rb +3 -3
- data/samples/sample-contentarea.rb +8 -8
- data/samples/sample-email.rb +8 -8
- data/samples/sample-folder.rb +9 -9
- data/samples/sample-list.rb +7 -7
- data/samples/sample-list.subscriber.rb +6 -6
- data/samples/sample-openevent.rb +3 -3
- data/samples/sample-sentevent.rb +3 -3
- data/samples/sample-subscriber.rb +8 -8
- data/samples/sample-triggeredsend.rb +9 -9
- data/samples/sample-unsubevent.rb +3 -3
- data/spec/{fuelsdk_spec.rb → client_spec.rb} +16 -16
- data/spec/objects_helper_spec.rb +25 -0
- data/spec/objects_spec.rb +111 -0
- data/spec/rest_spec.rb +2 -2
- data/spec/soap_spec.rb +92 -1
- metadata +8 -6
- data/spec/fuelsdk/client_spec.rb +0 -21
data/lib/fuelsdk/version.rb
CHANGED
@@ -2,14 +2,14 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
## Modify the date below to reduce the number of results returned from the request
|
8
8
|
## Setting this too far in the past could result in a very large response size
|
9
9
|
retrieveDate = '2011-01-15T13:00:00.000'
|
10
10
|
|
11
11
|
p '>>> Retrieve Filtered BounceEvents with GetMoreResults'
|
12
|
-
getBounceEvent = FuelSDK::
|
12
|
+
getBounceEvent = FuelSDK::BounceEvent.new()
|
13
13
|
getBounceEvent.authStub = stubObj
|
14
14
|
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
15
15
|
getBounceEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate}
|
@@ -38,7 +38,7 @@ begin
|
|
38
38
|
# The following request could potentially bring back large amounts of data if run against a production account
|
39
39
|
=begin
|
40
40
|
p '>>> Retrieve All BounceEvents with GetMoreResults'
|
41
|
-
getBounceEvent = FuelSDK::
|
41
|
+
getBounceEvent = FuelSDK::BounceEvent.new()
|
42
42
|
getBounceEvent.authStub = stubObj
|
43
43
|
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
44
44
|
getResponse = getBounceEvent.get
|
data/samples/sample-campaign.rb
CHANGED
@@ -3,11 +3,11 @@ require_relative 'sample_helper'
|
|
3
3
|
|
4
4
|
|
5
5
|
begin
|
6
|
-
stubObj = FuelSDK::
|
6
|
+
stubObj = FuelSDK::Client.new auth
|
7
7
|
|
8
8
|
# Create List
|
9
9
|
p '>>> Create List'
|
10
|
-
postList = FuelSDK::
|
10
|
+
postList = FuelSDK::List.new
|
11
11
|
postList.authStub = stubObj
|
12
12
|
postList.props = {"ListName" => 'RubyAssetList', "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
13
13
|
postResponse = postList.post
|
@@ -25,7 +25,7 @@ begin
|
|
25
25
|
|
26
26
|
# Retrieve all Campaigns
|
27
27
|
p '>>> Retrieve all Campaigns'
|
28
|
-
getCamp = FuelSDK::
|
28
|
+
getCamp = FuelSDK::Campaign.new
|
29
29
|
getCamp.authStub = stubObj
|
30
30
|
getResponse = getCamp.get
|
31
31
|
p 'Retrieve Status: ' + getResponse.status.to_s
|
@@ -50,7 +50,7 @@ begin
|
|
50
50
|
|
51
51
|
# Create a new Campaign
|
52
52
|
p '>>> Create a new Campaign'
|
53
|
-
postCamp = FuelSDK::
|
53
|
+
postCamp = FuelSDK::Campaign.new
|
54
54
|
postCamp.authStub = stubObj
|
55
55
|
postCamp.props = {"name" => "RubySDKCreatedForTest1", "description"=> "RubySDKCreatedForTest", "color"=>"FF9933", "favorite"=>"false"}
|
56
56
|
postResponse = postCamp.post
|
@@ -66,7 +66,7 @@ begin
|
|
66
66
|
|
67
67
|
# Retrieve the new Campaign
|
68
68
|
p '>>> Retrieve the new Campaign'
|
69
|
-
getCamp = FuelSDK::
|
69
|
+
getCamp = FuelSDK::Campaign.new
|
70
70
|
getCamp.authStub = stubObj
|
71
71
|
getCamp.props = {"id" => IDOfpostCampaign}
|
72
72
|
getResponse = getCamp.get
|
@@ -80,7 +80,7 @@ begin
|
|
80
80
|
|
81
81
|
# Update the new Campaign
|
82
82
|
p '>>> Update the new Campaign'
|
83
|
-
patchCamp = FuelSDK::
|
83
|
+
patchCamp = FuelSDK::Campaign.new
|
84
84
|
patchCamp.authStub = stubObj
|
85
85
|
patchCamp.props = {"id"=> IDOfpostCampaign, "name" => "RubySDKCreated-Updated!"}
|
86
86
|
patchResponse = patchCamp.patch
|
@@ -94,7 +94,7 @@ begin
|
|
94
94
|
|
95
95
|
# Retrieve the updated Campaign
|
96
96
|
p '>>> Retrieve the updated Campaign'
|
97
|
-
getCamp = FuelSDK::
|
97
|
+
getCamp = FuelSDK::Campaign.new
|
98
98
|
getCamp.authStub = stubObj
|
99
99
|
getCamp.props = {"id" => IDOfpostCampaign}
|
100
100
|
getResponse = getCamp.get
|
@@ -108,7 +108,7 @@ begin
|
|
108
108
|
|
109
109
|
# Create a new Campaign Asset
|
110
110
|
p '>>> Create a new Campaign Asset'
|
111
|
-
postCampAsset = FuelSDK::
|
111
|
+
postCampAsset = FuelSDK::Campaign::Asset.new
|
112
112
|
postCampAsset.authStub = stubObj
|
113
113
|
postCampAsset.props = {"id" => IDOfpostCampaign, "ids"=> [ExampleAssetItemID], "type"=> ExampleAssetType}
|
114
114
|
postResponse = postCampAsset.post
|
@@ -124,7 +124,7 @@ begin
|
|
124
124
|
|
125
125
|
# Retrieve all Campaign Asset for a campaign
|
126
126
|
p '>>> Retrieve all Campaign Asset for a Campaign'
|
127
|
-
getCampAsset = FuelSDK::
|
127
|
+
getCampAsset = FuelSDK::Campaign::Asset.new
|
128
128
|
getCampAsset.authStub = stubObj
|
129
129
|
getCampAsset.props = {"id" => IDOfpostCampaign}
|
130
130
|
getResponse = getCampAsset.get
|
@@ -138,7 +138,7 @@ begin
|
|
138
138
|
|
139
139
|
# Retrieve a single new Campaign Asset
|
140
140
|
p '>>> Retrieve a single new Campaign Asset'
|
141
|
-
getCampAsset = FuelSDK::
|
141
|
+
getCampAsset = FuelSDK::Campaign::Asset.new
|
142
142
|
getCampAsset.authStub = stubObj
|
143
143
|
getCampAsset.props = {"id" => IDOfpostCampaign, "assetId" => IDOfpostCampaignAsset}
|
144
144
|
getResponse = getCampAsset.get
|
@@ -152,7 +152,7 @@ begin
|
|
152
152
|
|
153
153
|
# Delete the new Campaign Asset
|
154
154
|
p '>>> Delete the new Campaign Asset'
|
155
|
-
deleteCampAsset = FuelSDK::
|
155
|
+
deleteCampAsset = FuelSDK::Campaign::Asset.new
|
156
156
|
deleteCampAsset.authStub = stubObj
|
157
157
|
deleteCampAsset.props = {"id" => IDOfpostCampaign, "assetId"=> IDOfpostCampaignAsset}
|
158
158
|
deleteResponse = deleteCampAsset.delete
|
@@ -166,7 +166,7 @@ begin
|
|
166
166
|
|
167
167
|
# Get a single a new Campaign Asset to confirm deletion
|
168
168
|
p '>>> Get a single a new Campaign Asset to confirm deletion'
|
169
|
-
getCampAsset = FuelSDK::
|
169
|
+
getCampAsset = FuelSDK::Campaign::Asset.new
|
170
170
|
getCampAsset.authStub = stubObj
|
171
171
|
getCampAsset.props = {"id" => IDOfpostCampaign}
|
172
172
|
getResponse = getCampAsset.get
|
@@ -186,7 +186,7 @@ rescue => e
|
|
186
186
|
ensure
|
187
187
|
# Delete the new Campaign
|
188
188
|
p '>>> Delete the new Campaign'
|
189
|
-
deleteCamp = FuelSDK::
|
189
|
+
deleteCamp = FuelSDK::Campaign.new
|
190
190
|
deleteCamp.authStub = stubObj
|
191
191
|
deleteCamp.props = {"id"=> IDOfpostCampaign}
|
192
192
|
deleteResponse = deleteCamp.delete
|
@@ -199,7 +199,7 @@ ensure
|
|
199
199
|
raise 'Failure deleting campaign asset' unless deleteResponse.success?
|
200
200
|
|
201
201
|
p '>>> Delete List'
|
202
|
-
deleteSub = FuelSDK::
|
202
|
+
deleteSub = FuelSDK::List.new()
|
203
203
|
deleteSub.authStub = stubObj
|
204
204
|
deleteSub.props = {"ID" => ExampleAssetItemID}
|
205
205
|
deleteResponse = deleteSub.delete
|
@@ -2,14 +2,14 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
## Modify the date below to reduce the number of results returned from the request
|
8
8
|
## Setting this too far in the past could result in a very large response size
|
9
9
|
retrieveDate = '2013-01-15T13:00:00.000'
|
10
10
|
|
11
11
|
p '>>> Retrieve Filtered ClickEvents with GetMoreResults'
|
12
|
-
getClickEvent = FuelSDK::
|
12
|
+
getClickEvent = FuelSDK::ClickEvent.new()
|
13
13
|
getClickEvent.authStub = stubObj
|
14
14
|
getClickEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
15
15
|
getClickEvent.filter = {'Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => retrieveDate}
|
@@ -39,7 +39,7 @@ begin
|
|
39
39
|
# The following request could potentially bring back large amounts of data if run against a production account
|
40
40
|
=begin
|
41
41
|
p '>>> Retrieve All ClickEvents with GetMoreResults'
|
42
|
-
getClickEvent = FuelSDK::
|
42
|
+
getClickEvent = FuelSDK::ClickEvent.new()
|
43
43
|
getClickEvent.authStub = stubObj
|
44
44
|
getClickEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
|
45
45
|
getResponse = getClickEvent.get
|
@@ -2,11 +2,11 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
# Retrieve All ContentArea with GetMoreResults
|
8
8
|
p '>>> Retrieve All ContentArea with GetMoreResults'
|
9
|
-
getContent = FuelSDK::
|
9
|
+
getContent = FuelSDK::ContentArea.new()
|
10
10
|
getContent.authStub = stubObj
|
11
11
|
getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"]
|
12
12
|
getResponse = getContent.get
|
@@ -33,7 +33,7 @@ begin
|
|
33
33
|
|
34
34
|
# Create ContentArea
|
35
35
|
p '>>> Create ContentArea'
|
36
|
-
postContent = FuelSDK::
|
36
|
+
postContent = FuelSDK::ContentArea.new
|
37
37
|
postContent.authStub = stubObj
|
38
38
|
postContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "<b>Some HTML Content Goes here</b>"}
|
39
39
|
postResponse = postContent.post
|
@@ -46,7 +46,7 @@ begin
|
|
46
46
|
|
47
47
|
# Retrieve newly created ContentArea
|
48
48
|
p '>>> Retrieve newly created ContentArea'
|
49
|
-
getContent = FuelSDK::
|
49
|
+
getContent = FuelSDK::ContentArea.new()
|
50
50
|
getContent.authStub = stubObj
|
51
51
|
getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"]
|
52
52
|
getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea}
|
@@ -61,7 +61,7 @@ begin
|
|
61
61
|
|
62
62
|
# Update ContentArea
|
63
63
|
p '>>> Update ContentArea'
|
64
|
-
patchContent = FuelSDK::
|
64
|
+
patchContent = FuelSDK::ContentArea.new
|
65
65
|
patchContent.authStub = stubObj
|
66
66
|
patchContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "<b>Some HTML Content Goes here. NOW WITH NEW CONTENT</b>"}
|
67
67
|
patchResponse = patchContent.patch
|
@@ -74,7 +74,7 @@ begin
|
|
74
74
|
|
75
75
|
# Retrieve updated ContentArea
|
76
76
|
p '>>> Retrieve updated ContentArea'
|
77
|
-
getContent = FuelSDK::
|
77
|
+
getContent = FuelSDK::ContentArea.new()
|
78
78
|
getContent.authStub = stubObj
|
79
79
|
getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"]
|
80
80
|
getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea}
|
@@ -89,7 +89,7 @@ begin
|
|
89
89
|
|
90
90
|
# Delete ContentArea
|
91
91
|
p '>>> Delete ContentArea'
|
92
|
-
deleteContent = FuelSDK::
|
92
|
+
deleteContent = FuelSDK::ContentArea.new
|
93
93
|
deleteContent.authStub = stubObj
|
94
94
|
deleteContent.props = {"CustomerKey" => NameOfTestContentArea, "Name"=>NameOfTestContentArea, "Content"=> "<b>Some HTML Content Goes here. NOW WITH NEW CONTENT</b>"}
|
95
95
|
deleteResponse = deleteContent.delete
|
@@ -102,7 +102,7 @@ begin
|
|
102
102
|
|
103
103
|
# Retrieve ContentArea to confirm deletion
|
104
104
|
p '>>> Retrieve ContentArea to confirm deletion'
|
105
|
-
getContent =
|
105
|
+
getContent = FuelSDK::ContentArea.new()
|
106
106
|
getContent.authStub = stubObj
|
107
107
|
getContent.props = ["RowObjectID","ObjectID","ID","CustomerKey","Client.ID","ModifiedDate","CreatedDate","CategoryID","Name","Layout","IsDynamicContent","Content","IsSurvey","IsBlank","Key"]
|
108
108
|
getContent.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestContentArea}
|
data/samples/sample-email.rb
CHANGED
@@ -2,11 +2,11 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
# Retrieve All Email with GetMoreResults
|
8
8
|
p '>>> Retrieve All Email with GetMoreResults'
|
9
|
-
getHTMLBody = FuelSDK::
|
9
|
+
getHTMLBody = FuelSDK::Email.new()
|
10
10
|
getHTMLBody.authStub = stubObj
|
11
11
|
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"]
|
12
12
|
getResponse = getHTMLBody.get
|
@@ -33,7 +33,7 @@ begin
|
|
33
33
|
|
34
34
|
# Create Email
|
35
35
|
p '>>> Create Email'
|
36
|
-
postHTMLBody = FuelSDK::
|
36
|
+
postHTMLBody = FuelSDK::Email.new
|
37
37
|
postHTMLBody.authStub = stubObj
|
38
38
|
postHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "Subject" => "Created Using the RubySDK", "HTMLBody"=> "<b>Some HTML Goes here</b>"}
|
39
39
|
postResponse = postHTMLBody.post
|
@@ -46,7 +46,7 @@ begin
|
|
46
46
|
|
47
47
|
# Retrieve newly created Email
|
48
48
|
p '>>> Retrieve newly created Email'
|
49
|
-
getHTMLBody = FuelSDK::
|
49
|
+
getHTMLBody = FuelSDK::Email.new()
|
50
50
|
getHTMLBody.authStub = stubObj
|
51
51
|
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"]
|
52
52
|
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
|
@@ -61,7 +61,7 @@ begin
|
|
61
61
|
|
62
62
|
# Update Email
|
63
63
|
p '>>> Update Email'
|
64
|
-
patchHTMLBody = FuelSDK::
|
64
|
+
patchHTMLBody = FuelSDK::Email.new
|
65
65
|
patchHTMLBody.authStub = stubObj
|
66
66
|
patchHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "<b>Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody</b>"}
|
67
67
|
patchResponse = patchHTMLBody.patch
|
@@ -74,7 +74,7 @@ begin
|
|
74
74
|
|
75
75
|
# Retrieve updated Email
|
76
76
|
p '>>> Retrieve updated Email'
|
77
|
-
getHTMLBody = FuelSDK::
|
77
|
+
getHTMLBody = FuelSDK::Email.new()
|
78
78
|
getHTMLBody.authStub = stubObj
|
79
79
|
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"]
|
80
80
|
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
|
@@ -89,7 +89,7 @@ begin
|
|
89
89
|
|
90
90
|
# Delete Email
|
91
91
|
p '>>> Delete Email'
|
92
|
-
deleteHTMLBody = FuelSDK::
|
92
|
+
deleteHTMLBody = FuelSDK::Email.new
|
93
93
|
deleteHTMLBody.authStub = stubObj
|
94
94
|
deleteHTMLBody.props = {"CustomerKey" => NameOfTestEmail, "Name"=>NameOfTestEmail, "HTMLBody"=> "<b>Some HTML HTMLBody Goes here. NOW WITH NEW HTMLBody</b>"}
|
95
95
|
deleteResponse = deleteHTMLBody.delete
|
@@ -102,7 +102,7 @@ begin
|
|
102
102
|
|
103
103
|
# Retrieve Email to confirm deletion
|
104
104
|
p '>>> Retrieve Email to confirm deletion'
|
105
|
-
getHTMLBody = FuelSDK::
|
105
|
+
getHTMLBody = FuelSDK::Email.new()
|
106
106
|
getHTMLBody.authStub = stubObj
|
107
107
|
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"]
|
108
108
|
getHTMLBody.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestEmail}
|
data/samples/sample-folder.rb
CHANGED
@@ -2,11 +2,11 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
# Retrieve All Folder with GetMoreResults
|
8
8
|
p '>>> Retrieve All Folder with GetMoreResults'
|
9
|
-
getFolder = FuelSDK::
|
9
|
+
getFolder = FuelSDK::Folder.new()
|
10
10
|
getFolder.authStub = stubObj
|
11
11
|
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"]
|
12
12
|
getResponse = getFolder.get
|
@@ -33,7 +33,7 @@ begin
|
|
33
33
|
|
34
34
|
# Retrieve Specific Folder for Email Folder ParentID
|
35
35
|
p '>>> Retrieve Specific Folder for Email Folder ParentID'
|
36
|
-
getFolder = FuelSDK::
|
36
|
+
getFolder = FuelSDK::Folder.new()
|
37
37
|
getFolder.authStub = stubObj
|
38
38
|
getFolder.props = ["ID"]
|
39
39
|
getFolder.filter = {'LeftOperand' => {'Property' => 'ParentFolder.ID','SimpleOperator' => 'equals','Value' => '0'}, 'LogicalOperator' => 'AND', 'RightOperand' => {'Property' => 'ContentType','SimpleOperator' => 'equals','Value' => 'EMAIL'}}
|
@@ -52,7 +52,7 @@ begin
|
|
52
52
|
|
53
53
|
# Create Folder
|
54
54
|
p '>>> Create Folder'
|
55
|
-
postFolder = FuelSDK::
|
55
|
+
postFolder = FuelSDK::Folder.new
|
56
56
|
postFolder.authStub = stubObj
|
57
57
|
postFolder.props = {"CustomerKey" => NameOfTestFolder, "Name" => NameOfTestFolder, "Description" => NameOfTestFolder, "ContentType"=> "EMAIL", "ParentFolder" => {"ID" => ParentIDForEmail}}
|
58
58
|
postResponse = postFolder.post
|
@@ -65,7 +65,7 @@ begin
|
|
65
65
|
|
66
66
|
# Retrieve newly created Folder
|
67
67
|
p '>>> Retrieve newly created Folder'
|
68
|
-
getFolder = FuelSDK::
|
68
|
+
getFolder = FuelSDK::Folder.new()
|
69
69
|
getFolder.authStub = stubObj
|
70
70
|
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"]
|
71
71
|
getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder}
|
@@ -81,7 +81,7 @@ begin
|
|
81
81
|
|
82
82
|
# Update Folder
|
83
83
|
p '>>> Update Folder'
|
84
|
-
patchFolder = FuelSDK::
|
84
|
+
patchFolder = FuelSDK::Folder.new
|
85
85
|
patchFolder.authStub = stubObj
|
86
86
|
patchFolder.props = {"CustomerKey" => NameOfTestFolder, "Description" => "New Description"}
|
87
87
|
patchResponse = patchFolder.patch
|
@@ -94,7 +94,7 @@ begin
|
|
94
94
|
|
95
95
|
# Retrieve updated Folder
|
96
96
|
p '>>> Retrieve updated Folder'
|
97
|
-
getFolder = FuelSDK::
|
97
|
+
getFolder = FuelSDK::Folder.new()
|
98
98
|
getFolder.authStub = stubObj
|
99
99
|
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"]
|
100
100
|
getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder}
|
@@ -109,7 +109,7 @@ begin
|
|
109
109
|
|
110
110
|
# Delete Folder
|
111
111
|
p '>>> Delete Folder'
|
112
|
-
deleteFolder = FuelSDK::
|
112
|
+
deleteFolder = FuelSDK::Folder.new
|
113
113
|
deleteFolder.authStub = stubObj
|
114
114
|
deleteFolder.props = {"CustomerKey" => NameOfTestFolder, "Name"=>NameOfTestFolder, "Content"=> "<b>Some HTML Content Goes here. NOW WITH NEW CONTENT</b>"}
|
115
115
|
deleteResponse = deleteFolder.delete
|
@@ -122,7 +122,7 @@ begin
|
|
122
122
|
|
123
123
|
# Retrieve Folder to confirm deletion
|
124
124
|
p '>>> Retrieve Folder to confirm deletion'
|
125
|
-
getFolder = FuelSDK::
|
125
|
+
getFolder = FuelSDK::Folder.new()
|
126
126
|
getFolder.authStub = stubObj
|
127
127
|
getFolder.props = ["ID"]
|
128
128
|
getFolder.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => NameOfTestFolder}
|
data/samples/sample-list.rb
CHANGED
@@ -2,13 +2,13 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
NewListName = "RubySDKList"
|
8
8
|
|
9
9
|
# Create List
|
10
10
|
p '>>> Create List'
|
11
|
-
postList = FuelSDK::
|
11
|
+
postList = FuelSDK::List.new
|
12
12
|
postList.authStub = stubObj
|
13
13
|
postList.props = {"ListName" => NewListName, "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
14
14
|
postResponse = postList.post
|
@@ -27,7 +27,7 @@ begin
|
|
27
27
|
|
28
28
|
# Retrieve newly created List by ID
|
29
29
|
p '>>> Retrieve newly created List'
|
30
|
-
getList = FuelSDK::
|
30
|
+
getList = FuelSDK::List.new()
|
31
31
|
getList.authStub = stubObj
|
32
32
|
getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"]
|
33
33
|
getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID}
|
@@ -42,7 +42,7 @@ begin
|
|
42
42
|
|
43
43
|
# Update List
|
44
44
|
p '>>> Update List'
|
45
|
-
patchSub = FuelSDK::
|
45
|
+
patchSub = FuelSDK::List.new
|
46
46
|
patchSub.authStub = stubObj
|
47
47
|
patchSub.props = {"ID" => newListID, "Description" => "I updated the description"}
|
48
48
|
patchResponse = patchSub.patch
|
@@ -56,7 +56,7 @@ begin
|
|
56
56
|
|
57
57
|
# Retrieve List that should have description updated
|
58
58
|
p '>>> Retrieve List that should have description updated '
|
59
|
-
getList = FuelSDK::
|
59
|
+
getList = FuelSDK::List.new()
|
60
60
|
getList.authStub = stubObj
|
61
61
|
getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"]
|
62
62
|
getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID}
|
@@ -71,7 +71,7 @@ begin
|
|
71
71
|
|
72
72
|
# Delete List
|
73
73
|
p '>>> Delete List'
|
74
|
-
deleteSub = FuelSDK::
|
74
|
+
deleteSub = FuelSDK::List.new()
|
75
75
|
deleteSub.authStub = stubObj
|
76
76
|
deleteSub.props = {"ID" => newListID}
|
77
77
|
deleteResponse = deleteSub.delete
|
@@ -84,7 +84,7 @@ begin
|
|
84
84
|
|
85
85
|
# Retrieve List to confirm deletion
|
86
86
|
p '>>> Retrieve List to confirm deletion'
|
87
|
-
getList = FuelSDK::
|
87
|
+
getList = FuelSDK::List.new()
|
88
88
|
getList.authStub = stubObj
|
89
89
|
getList.props = ["ID","PartnerKey","CreatedDate","ModifiedDate","Client.ID","Client.PartnerClientKey","ListName","Description","Category","Type","CustomerKey","ListClassification","AutomatedEmail.ID"]
|
90
90
|
getList.filter = {'Property' => 'ID','SimpleOperator' => 'equals','Value' => newListID}
|
@@ -2,7 +2,7 @@ require 'fuelsdk'
|
|
2
2
|
require_relative 'sample_helper'
|
3
3
|
|
4
4
|
begin
|
5
|
-
stubObj = FuelSDK::
|
5
|
+
stubObj = FuelSDK::Client.new auth
|
6
6
|
|
7
7
|
# NOTE: These examples only work in accounts where the SubscriberKey functionality is not enabled
|
8
8
|
# SubscriberKey will need to be included in the props if that feature is enabled
|
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
|
13
13
|
# Create List
|
14
14
|
p '>>> Create List'
|
15
|
-
postList = FuelSDK::
|
15
|
+
postList = FuelSDK::List.new
|
16
16
|
postList.authStub = stubObj
|
17
17
|
postList.props = {"ListName" => NewListName, "Description" => "This list was created with the RubySDK", "Type" => "Private" }
|
18
18
|
postResponse = postList.post
|
@@ -32,7 +32,7 @@ begin
|
|
32
32
|
|
33
33
|
# Create Subscriber On List
|
34
34
|
p '>>> Create Subscriber On List'
|
35
|
-
postSub = FuelSDK::
|
35
|
+
postSub = FuelSDK::Subscriber.new
|
36
36
|
postSub.authStub = stubObj
|
37
37
|
postSub.props = {"EmailAddress" => SubscriberTestEmail, "Lists" =>[{"ID" => newListID}]}
|
38
38
|
postResponse = postSub.post
|
@@ -48,7 +48,7 @@ begin
|
|
48
48
|
if postResponse.results[0][:error_code] == "12014" then
|
49
49
|
# Update Subscriber to add to List
|
50
50
|
p '>>> Update Subscriber to add to List'
|
51
|
-
patchSub = FuelSDK::
|
51
|
+
patchSub = FuelSDK::Subscriber.new
|
52
52
|
patchSub.authStub = stubObj
|
53
53
|
patchSub.props = {"EmailAddress" => SubscriberTestEmail, "Lists" =>[{"ID" => newListID}]}
|
54
54
|
patchResponse = patchSub.patch
|
@@ -64,7 +64,7 @@ begin
|
|
64
64
|
|
65
65
|
# Retrieve all Subscribers on the List
|
66
66
|
p '>>> Retrieve all Subscribers on the List'
|
67
|
-
getListSubs = FuelSDK::
|
67
|
+
getListSubs = FuelSDK::List::Subscriber.new
|
68
68
|
getListSubs.authStub = stubObj
|
69
69
|
getListSubs.props = ["ObjectID","SubscriberKey","CreatedDate","Client.ID","Client.PartnerClientKey","ListID","Status"]
|
70
70
|
getListSubs.filter = {'Property' => 'ListID','SimpleOperator' => 'equals','Value' => newListID}
|
@@ -79,7 +79,7 @@ begin
|
|
79
79
|
|
80
80
|
# Delete List
|
81
81
|
p '>>> Delete List'
|
82
|
-
deleteSub = FuelSDK::
|
82
|
+
deleteSub = FuelSDK::List.new()
|
83
83
|
deleteSub.authStub = stubObj
|
84
84
|
deleteSub.props = {"ID" => newListID}
|
85
85
|
deleteResponse = deleteSub.delete
|