@@ -29,227 +29,3 @@ module FuelSDK
29
29
ET_UnsubEvent = FuelSDK ::UnsubEvent
30
30
ET_TriggeredSend = FuelSDK ::TriggeredSend
31
31
ET_Campaign = FuelSDK ::Campaign
32
-
33
- =begin
34
- class ET_DataExtension < ET_CUDSupport
35
- attr_accessor :columns
36
-
37
- def initialize
38
- super
39
- @obj = 'DataExtension'
40
- end
41
-
42
- def post
43
- originalProps = @props
44
-
45
- if @props.is_a? Array then
46
- multiDE = []
47
- @props.each { |currentDE|
48
- currentDE['Fields'] = {}
49
- currentDE['Fields']['Field'] = []
50
- currentDE['columns'].each { |key|
51
- currentDE['Fields']['Field'].push(key)
52
- }
53
- currentDE.delete('columns')
54
- multiDE.push(currentDE.dup)
55
- }
56
-
57
- @props = multiDE
58
- else
59
- @props['Fields'] = {}
60
- @props['Fields']['Field'] = []
61
-
62
- @columns.each { |key|
63
- @props['Fields']['Field'].push(key)
64
- }
65
- end
66
-
67
- obj = super
68
- @props = originalProps
69
- return obj
70
- end
71
-
72
- def patch
73
- @props['Fields'] = {}
74
- @props['Fields']['Field'] = []
75
- @columns.each { |key|
76
- @props['Fields']['Field'].push(key)
77
- }
78
- obj = super
79
- @props.delete("Fields")
80
- return obj
81
- end
82
-
83
- class Column < ET_GetSupport
84
- def initialize
85
- super
86
- @obj = 'DataExtensionField'
87
- end
88
-
89
- def get
90
-
91
- if props and props.is_a? Array then
92
- @props = props
93
- end
94
-
95
- if @props and @props.is_a? Hash then
96
- @props = @props.keys
97
- end
98
-
99
- if filter and filter.is_a? Hash then
100
- @filter = filter
101
- end
102
-
103
- fixCustomerKey = false
104
- if filter and filter.is_a? Hash then
105
- @filter = filter
106
- if @filter.has_key?("Property") && @filter["Property"] == "CustomerKey" then
107
- @filter["Property"] = "DataExtension.CustomerKey"
108
- fixCustomerKey = true
109
- end
110
- end
111
-
112
- obj = ET_Get.new(@authStub, @obj, @props, @filter)
113
- @lastRequestID = obj.request_id
114
-
115
- if fixCustomerKey then
116
- @filter["Property"] = "CustomerKey"
117
- end
118
-
119
- return obj
120
- end
121
- end
122
-
123
- class Row < ET_CUDSupport
124
- attr_accessor :Name, :CustomerKey
125
-
126
- def initialize()
127
- super
128
- @obj = "DataExtensionObject"
129
- end
130
-
131
- def get
132
- getName
133
- if props and props.is_a? Array then
134
- @props = props
135
- end
136
-
137
- if @props and @props.is_a? Hash then
138
- @props = @props.keys
139
- end
140
-
141
- if filter and filter.is_a? Hash then
142
- @filter = filter
143
- end
144
-
145
- obj = ET_Get.new(@authStub, "DataExtensionObject[#{@Name}]", @props, @filter)
146
- @lastRequestID = obj.request_id
147
-
148
- return obj
149
- end
150
-
151
- def post
152
- getCustomerKey
153
- originalProps = @props
154
- ## FIX THIS
155
- if @props.is_a? Array then
156
- # multiRow = []
157
- # @props.each { |currentDE|
158
-
159
- # currentDE['columns'].each { |key|
160
- # currentDE['Fields'] = {}
161
- # currentDE['Fields']['Field'] = []
162
- # currentDE['Fields']['Field'].push(key)
163
- # }
164
- # currentDE.delete('columns')
165
- # multiRow.push(currentDE.dup)
166
- # }
167
-
168
- # @props = multiRow
169
- else
170
- currentFields = []
171
- currentProp = {}
172
-
173
- @props.each { |key,value|
174
- currentFields.push({"Name" => key, "Value" => value})
175
- }
176
- currentProp['CustomerKey'] = @CustomerKey
177
- currentProp['Properties'] = {}
178
- currentProp['Properties']['Property'] = currentFields
179
- end
180
-
181
- obj = ET_Post.new(@authStub, @obj, currentProp)
182
- @props = originalProps
183
- obj
184
- end
185
-
186
- def patch
187
- getCustomerKey
188
- currentFields = []
189
- currentProp = {}
190
-
191
- @props.each { |key,value|
192
- currentFields.push({"Name" => key, "Value" => value})
193
- }
194
- currentProp['CustomerKey'] = @CustomerKey
195
- currentProp['Properties'] = {}
196
- currentProp['Properties']['Property'] = currentFields
197
-
198
- ET_Patch.new(@authStub, @obj, currentProp)
199
- end
200
- def delete
201
- getCustomerKey
202
- currentFields = []
203
- currentProp = {}
204
-
205
- @props.each { |key,value|
206
- currentFields.push({"Name" => key, "Value" => value})
207
- }
208
- currentProp['CustomerKey'] = @CustomerKey
209
- currentProp['Keys'] = {}
210
- currentProp['Keys']['Key'] = currentFields
211
-
212
- ET_Delete.new(@authStub, @obj, currentProp)
213
- end
214
-
215
- private
216
- def getCustomerKey
217
- if @CustomerKey.nil? then
218
- if @CustomerKey.nil? && @Name.nil? then
219
- raise 'Unable to process DataExtension::Row request due to CustomerKey and Name not being defined on ET_DatExtension::row'
220
- else
221
- de = ET_DataExtension.new
222
- de.authStub = @authStub
223
- de.props = ["Name","CustomerKey"]
224
- de.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => @Name}
225
- getResponse = de.get
226
- if getResponse.status && (getResponse.results.length == 1) then
227
- @CustomerKey = getResponse.results[0][:customer_key]
228
- else
229
- raise 'Unable to process DataExtension::Row request due to unable to find DataExtension based on Name'
230
- end
231
- end
232
- end
233
- end
234
-
235
- def getName
236
- if @Name.nil? then
237
- if @CustomerKey.nil? && @Name.nil? then
238
- raise 'Unable to process DataExtension::Row request due to CustomerKey and Name not being defined on ET_DatExtension::row'
239
- else
240
- de = ET_DataExtension.new
241
- de.authStub = @authStub
242
- de.props = ["Name","CustomerKey"]
243
- de.filter = {'Property' => 'CustomerKey','SimpleOperator' => 'equals','Value' => @CustomerKey}
244
- getResponse = de.get
245
- if getResponse.status && (getResponse.results.length == 1) then
246
- @Name = getResponse.results[0][:name]
247
- else
248
- raise 'Unable to process DataExtension::Row request due to unable to find DataExtension based on CustomerKey'
249
- end
250
- end
251
- end
252
- end
253
- end
254
- end
255
- =end
0 commit comments