ZendriveDriverAttributes Class Reference
Inherits from | NSObject |
Conforms to | NSCopying |
Declared in | ZendriveDriverAttributes.h |
Overview
Additional attributes of a Zendrive driver.
The application can specify both predefined and custom attributes for a driver. These attributes are associated with a SDK driverId at SDK initialization time. In addition to predefined special attributes, up to 4 custom key value attributes can be associated with a driver using the Zendrive SDK.
Warning: All attribute keys can be atmost 64 characters in length.
Warning: All attribute values can be atmost 1024 characters in length.
Instance Methods
asDictionary
Returns the driver attributes as a dictionary.
- (nonnull NSDictionary *)asDictionary
Return Value
Driver attributes as a dictionary.
Declared In
ZendriveDriverAttributes.h
asJson
Returns the attributes as a json string.
- (nonnull NSString *)asJson
Return Value
Driver attributes as a json string. nil if json serialization fails.
Declared In
ZendriveDriverAttributes.h
setCustomAttribute:forKey:
Set the custom attribute of the user.
- (BOOL)setCustomAttribute:(nonnull NSString *)value forKey:(nonnull NSString *)key
Parameters
- value
Value of the custom attribute. The maximum value length is 1024 characters.
- key
A key for the custom attribute. The maximum key length is 64 characters.
Return Value
YES, if the value was set, NO otherwise.
Discussion
Up to 4 custom attributes can be set for a user. A new value for an existing key would be overwritten only if the value length is within 1024 characters, otherwise the original value would be retained.
Declared In
ZendriveDriverAttributes.h
setDriverStartDate:
The date which the driver signed up/started using your application. The date would be available in YYYY-MM-DD format on Zendrvie dashboard which is also what is would be returned by the toJson: and toDictionary: methods.
- (BOOL)setDriverStartDate:(nonnull NSDate *)startDate
Parameters
- startDate
The start date for the user.
Return Value
YES, if the value was set, NO otherwise.
Declared In
ZendriveDriverAttributes.h
setEmail:
Email of the user.
- (BOOL)setEmail:(nonnull NSString *)email
Parameters
Email Id.
Return Value
YES, if the value was set, NO otherwise.
Declared In
ZendriveDriverAttributes.h
setFirstName:
First name of the user.
- (BOOL)setFirstName:(nonnull NSString *)firstName
Parameters
- firstName
First name.
Return Value
YES, if the value was set, NO otherwise.
Declared In
ZendriveDriverAttributes.h
setGroup:
A unique id that associates the current user to a group. This groupId will be made available as a query parameter to filter users in the reports and API that Zendrive provides.
- (BOOL)setGroup:(nonnull NSString *)groupId
Parameters
- groupId
A string representing the group of a user.
Return Value
YES, if the value was set, NO otherwise.
Discussion
For example, ‘EastCoast’ and ‘WestCoast’ can be groupIds to distinguish users from these regions. Another example would be using city names as groupIds. Check [Zendrive isValidInputParameter:] method to validate group id. Setting an invalid groupId is a no-op and would log an error.
Declared In
ZendriveDriverAttributes.h
setLastName:
Last name of the user.
- (BOOL)setLastName:(nonnull NSString *)lastName
Parameters
- lastName
Last name.
Return Value
YES, if the value was set, NO otherwise.
Declared In
ZendriveDriverAttributes.h
setPhoneNumber:
Phone number of the user.
- (BOOL)setPhoneNumber:(nonnull NSString *)phoneNumber
Parameters
- phoneNumber
Phone number. Max length is 20 characters.
Return Value
NO if the phone number string contains any characters other than digits, YES otherwise.
Discussion
The phone number should be of the format <country_code><phone_number>. For example 14255526528, with 1 being the country code for US followed by the number. For India, it would be 918877554466, with 91 being the country code.
Declared In
ZendriveDriverAttributes.h
setServiceLevel:
The service level of a driver. This is useful for applications where Zendrive supports different service levels for different drivers. See ServiceLevel for more information about this attribute.
- (BOOL)setServiceLevel:(ZendriveServiceLevel)serviceLevel
Parameters
- serviceLevel
service tier of the user.
Discussion
The service level of a driver. This is useful for applications where Zendrive supports different service levels for different drivers. See ServiceLevel for more information about this attribute.
Declared In
ZendriveDriverAttributes.h