Sha256: 08c09131cf8be7b14006b7ea7633eb4b087f5dd840d3d32386722e69e6aba9ae

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

require 'fuelsdk'
require_relative 'sample_helper'

begin
	myclient = FuelSDK::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

2 entries across 2 versions & 2 rubygems

Version Path
marketingcloudsdk-1.0.0 samples/sample-CreateProfileAttributes.rb
fuelsdk_json_bump-0.0.5 samples/sample-CreateProfileAttributes.rb