Sha256: cafe79a5ff98bc6b616cf2f2810776cf24ceb9a5bff85060700e1ae0ec62373e

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

require 'marketingcloudsdk'
require_relative 'sample_helper'

begin
	myclient = MarketingCloudSDK::Client.new auth
	
	## Example using CreateProfileAttributes() method
	
	NameOfAttributeOne = "ExampleAttributeOne"
	NameOfAttributeTwo = "ExampleAttributeTwo"

	# Declare a Ruby Hash which contain all of the details for a DataExtension
	profileAttrOne = {"Name" => NameOfAttributeOne, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
	profileAttrTwo = {"Name" => NameOfAttributeTwo, "PropertyType"=>"string", "Description"=>"New Attribute from the SDK", "IsRequired"=>"false", "IsViewable"=>"false", "IsEditable"=>"true", "IsSendTime"=>"false"}
	
	# Call CreateDataExtensions passing in both DataExtension Hashes as an Array
	response = myclient.CreateProfileAttributes([profileAttrOne,profileAttrTwo])
	p 'Response Status: ' + response.status.to_s
	p 'Code: ' + response.code.to_s
	p 'Message: ' + response.message.to_s	
	p 'Results Length: ' + response.results.length.to_s
	p 'Results: ' + response.results.to_s
	
	p '>>> Delete profileAttrOne'
	profileattr = ET_ProfileAttribute.new 
	profileattr.authStub = myclient
	profileattr.props = {"Name" => NameOfAttributeOne}
	delResponse = profileattr.delete
	p 'Delete Status: ' + delResponse.status.to_s
	p 'Code: ' + delResponse.code.to_s
	p 'Message: ' + delResponse.message.to_s
	p 'Results: ' + delResponse.results.inspect
	
	p '>>> Delete profileAttrTwo'
	profileattr = ET_ProfileAttribute.new 
	profileattr.authStub = myclient
	profileattr.props = {"Name" => NameOfAttributeTwo}
	delResponse = profileattr.delete
	p 'Delete Status: ' + delResponse.status.to_s
	p 'Code: ' + delResponse.code.to_s
	p 'Message: ' + delResponse.message.to_s
	p 'Results: ' + delResponse.results.inspect
	
rescue => e
	p "Caught exception: #{e.message}"
	p e.backtrace
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sfmc-fuelsdk-ruby-1.3.1 samples/sample-CreateProfileAttributes.rb
sfmc-fuelsdk-ruby-1.1.0 samples/sample-CreateProfileAttributes.rb
dragostsesdk-1.1.0 samples/sample-CreateProfileAttributes.rb