Class: MarketingCloudSDK::ET_DataExtension

Inherits:
ET_CUDSupport show all
Defined in:
lib/new.rb

Defined Under Namespace

Classes: Column, Row

Instance Attribute Summary collapse

Attributes inherited from ET_GetSupport

#filter

Attributes inherited from ET_BaseObject

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

Instance Method Summary collapse

Methods inherited from ET_CUDSupport

#delete

Methods inherited from ET_GetSupport

#get, #getMoreResults, #info

Constructor Details

#initializeET_DataExtension

Returns a new instance of ET_DataExtension.



936
937
938
939
# File 'lib/new.rb', line 936

def initialize
  super
  @obj = 'DataExtension'
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



934
935
936
# File 'lib/new.rb', line 934

def columns
  @columns
end

Instance Method Details

#patchObject



971
972
973
974
975
976
977
978
979
980
# File 'lib/new.rb', line 971

def patch
  @props['Fields'] = {}
  @props['Fields']['Field'] = []
  @columns.each { |key|
    @props['Fields']['Field'].push(key)
  }
  obj = super
  @props.delete("Fields")
  return obj
end

#postObject



941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/new.rb', line 941

def post
  originalProps = @props

  if @props.is_a? Array then
    multiDE = []
    @props.each { |currentDE|
      currentDE['Fields'] = {}
      currentDE['Fields']['Field'] = []
      currentDE['columns'].each { |key|
        currentDE['Fields']['Field'].push(key)
      }
      currentDE.delete('columns')
      multiDE.push(currentDE.dup)
    }

    @props = multiDE
  else
    @props['Fields'] = {}
    @props['Fields']['Field'] = []

    @columns.each { |key|
    @props['Fields']['Field'].push(key)
    }
  end

  obj = super
  @props = originalProps
  return obj
end