Class: ET::DataExtension::Row

Inherits:
CUDSupport show all
Defined in:
lib/exact-target-api/data_extension.rb

Instance Attribute Summary collapse

Attributes inherited from GetSupport

#filter

Attributes inherited from BaseObject

#client, #endpoint, #lastRequestID, #obj, #props

Instance Method Summary collapse

Methods inherited from GetSupport

#get_more_results, #info

Methods inherited from BaseObject

#stringify_keys!, #symbolize_keys!

Constructor Details

#initializeRow

Returns a new instance of Row.



93
94
95
96
# File 'lib/exact-target-api/data_extension.rb', line 93

def initialize
  super
  @obj = "DataExtensionObject"
end

Instance Attribute Details

#CustomerKeyObject

Returns the value of attribute CustomerKey.



91
92
93
# File 'lib/exact-target-api/data_extension.rb', line 91

def CustomerKey
  @CustomerKey
end

#NameObject

Returns the value of attribute Name.



91
92
93
# File 'lib/exact-target-api/data_extension.rb', line 91

def Name
  @Name
end

Instance Method Details

#deleteObject



170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/exact-target-api/data_extension.rb', line 170

def delete
  getCustomerKey
  currentFields = []
  currentProp = {}

  @props.each { |key,value|
    currentFields.push({"Name" => key, "Value" => value})
  }
  currentProp['CustomerKey'] = @CustomerKey
  currentProp['Keys'] = {}
  currentProp['Keys']['Key'] = currentFields

  ET::Delete.new(@authStub, @obj, currentProp)
end

#getObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/exact-target-api/data_extension.rb', line 98

def get
  getName
  if props and props.is_a? Array then
    @props = props
  end

  if @props and @props.is_a? Hash then
    @props = @props.keys
  end

  if filter and filter.is_a? Hash then
    @filter = filter
  end

  obj = ET::Get.new(@authStub, "DataExtensionObject[#{@Name}]", @props, @filter)
  @lastRequestID = obj.request_id

  obj
end

#patchObject



155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/exact-target-api/data_extension.rb', line 155

def patch
  getCustomerKey
  currentFields = []
  currentProp = {}

  @props.each { |key,value|
    currentFields.push({"Name" => key, "Value" => value})
  }
  currentProp['CustomerKey'] = @CustomerKey
  currentProp['Properties'] = {}
  currentProp['Properties']['Property'] = currentFields

  ET::Patch.new(@authStub, @obj, currentProp)
end

#postObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/exact-target-api/data_extension.rb', line 118

def post
  getCustomerKey
  originalProps = @props
  currentProp = {}
  ## FIX THIS
  if @props.is_a? Array then
=begin
				multiRow = []
				@props.each { |currentDE|

					currentDE['columns'].each { |key|
currentDE['Fields'] = {}
currentDE['Fields']['Field'] = []
currentDE['Fields']['Field'].push(key)
					}
					currentDE.delete('columns')
					multiRow.push(currentDE.dup)
				}

				@props = multiRow
=end
  else
    currentFields = []

    @props.each { |key,value|
      currentFields.push({"Name" => key, "Value" => value})
    }
    currentProp['CustomerKey'] = @CustomerKey
    currentProp['Properties'] = {}
    currentProp['Properties']['Property'] = currentFields
  end

  obj = ET::Post.new(@authStub, @obj, currentProp)
  @props = originalProps
  obj
end