Class: MarketingCloudSDK::ET_DataExtension::Row

Instance Attribute Summary collapse

Attributes inherited from MarketingCloudSDK::ET_GetSupport

#filter

Attributes inherited from MarketingCloudSDK::ET_BaseObject

#authStub, #endpoint, #lastRequestID, #obj, #props

Instance Method Summary collapse

Methods inherited from MarketingCloudSDK::ET_GetSupport

#getMoreResults, #info

Constructor Details

#initializeRow

Returns a new instance of Row.



1025
1026
1027
1028
# File 'lib/new.rb', line 1025

def initialize()
  super
  @obj = "DataExtensionObject"
end

Instance Attribute Details

#CustomerKeyObject

Returns the value of attribute CustomerKey.



1023
1024
1025
# File 'lib/new.rb', line 1023

def CustomerKey
  @CustomerKey
end

#NameObject

Returns the value of attribute Name.



1023
1024
1025
# File 'lib/new.rb', line 1023

def Name
  @Name
end

Instance Method Details

#deleteObject



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'lib/new.rb', line 1101

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



1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/new.rb', line 1030

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

  return obj
end

#patchObject



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
# File 'lib/new.rb', line 1087

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



1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
# File 'lib/new.rb', line 1050

def post
  getCustomerKey
  originalProps = @props
  ## 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 = []
    currentProp = {}

    @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