Tealium Swift APIs - TealiumConfig - 1.0.0 - 1.0.1

Tealium Swift APIs - TealiumConfig - 1.0.0 - 1.0.1

by on ‎12-01-2016 02:53 PM (108 Views)
FUNCTION NAME DESCRIPTION

init(account:String, profile:String, environment:String) 

Constructor for a TealiumConfig object.

getLogLevel() -> LogLevel

Get the current log level for the library's logging mechanism. 

setLogLevel(logLevel:LogLevel) Set the current log level for console output. 

getOptionalData(key:String)->AnyObject?

Get any optional data to accompany configuration.

Intended for future extensions. 

setOptionalData(key:String, value:AnyObject)

Set optional data to accompany configuration.

Intended for future extensions.

 

INIT

init(account:String, profile:String, environment:String)
Parameters Description Example Value
account Tealium account name tealiummobile

profile

Tealium profile

demo 

environment 

Tealium environment identifer

dev

// SAMPLE
// Standard Init
var config = TealiumConfig(account: "your_account", profile: "your_profile", environment: "dev_qa_or_prod")

// Adding log level setting
config.setLogLevel(logLevel: .Warnings)

 

GET LOG LEVEL

getLogLevel() -> LogLevel
// SAMPLE
let level = config.getLogLevel()

// Log Level Options
switch(level){
case .None:
// Print nothing
case .Errors:
// Print only errors
case .Warnings:
// Print errors and warnings
case .Verbose:
// Print debug messages, errors, and warnings
// This is the default option
}

 

SET LOG LEVEL

setLogLevel(logLevel:LogLevel)
Parameters Description Example Value
logLevel

Log level enum to set library debugger to. Options are:

.None

.Errors (errors only)

.Warnings (errors and warnings only)

.Verbose (all debug messages)

.Errors
// SAMPLE
config.setLogLevel(logLevel:.Warnings)

 

GET OPTIONAL DATA

 Intended for future extensions.

getOptionalData(key:String)
Parameters Description Example Value
key Required String of key to retrieve data for. "someKey"
// SAMPLE
if let value = config.getOptionalData(key: tealiumKey_overrideCollectURL) as? String {

print("Override url for the collect dispatch service has been set to: \(value)")

}

 

SET OPTIONAL DATA

 Intended for future extensions. Currently can be used to set an override to the destination URL for dispatches (tealiumKey_overrideCollectURL key).

setOptionalData(key:String, value:String)
Parameters Description Example Value
key Required String "someKey"

value

Required String

"someValue" 

// SAMPLE
config.setOptionalData(key: tealiumKey_overrideCollectURL, value:"https://aleternate.destionation.url")