VMConsumerManager Class Reference
Inherits from | VMRequestManager : NSObject |
Declared in | VMConsumerManager.h VMConsumerManager.m |
Overview
VMConsumerManager
is a subclass of VMRequestManager
designed for managing all interactions applicable to Consumers of the system. This class is responsible for registering Consumers, logging the Consumer in or resetting Consumer’s password.
Tasks
Other Methods
-
userToken
The latest Access Token received by the registration or login. Must be used in subsequent API calls.
property -
+ sharedInstance
Returns the shared consumer manager object for the system.
Register Methods
-
– registerConsumerWithMobilePhone:userName:password:firstName:lastName:fullName:gender:dateOfBirth:city:completionBlock:failBlock:
The Create Mobile Phone Number Registration service is provided for registering of new Consumers using their mobile phone number as the Username. Calling the Create Mobile Phone Number Registration creates a new Consumer in the system, Logs the Consumer in and then creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
-
– registerConsumerWithEmail:userName:password:firstName:lastName:fullName:gender:dateOfBirth:city:completionBlock:failBlock:
The Create Email Registration service is provided for registering of new Consumers using their email address as the Username. Calling the Create Email Registration creates a new Consumer in the system, Logs the Consumer in and then creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
-
– registerConsumerWithAnonymousUserName:password:completionBlock:failBlock:
The Create Anonymous Registration service is provided for client application to register without providing any Consumer details. A unique username and password is still required as the system will create an unique Anonymous Consumer record. This username and password can be discarded, only the saved Access Token is required to make subsequent API calls.
Login Methods
-
– loginConsumerWithUserName:password:completionBlock:failBlock:
The Login with Username service is provided for existing Consumers to login using their username and password. The username will be either an email address or mobile phone number depending on how the Consumer had initially registered. Login with Username will typically be used when logging into a second or subsequent Device, or via the browser etc. This is because in the normal process flow, a Consumer will register and the Access Token will be returned and cached. The Access Token is then must be used when starting the application instead of getting the Consumer to log in again. Calling the Login with Username logs the Consumer into the system and creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
-
– loginConsumerWithSocialToken:socialType:completionBlock:failBlock:
The Login with Social service is provided for either new or existing Consumers to login using 3rd party credentials. (e.g. Facebook / Twitter). The API will resolve the ‘Username’ to a genuine 3rd party Access Token (e.g. in the case of Facebook it will just be a code which can then be used to retrieve an access token) and then retrieve basic user information, before returning a ‘VMob’ Access Token. The
socialType
defines which 3rd Party site and authentication method to use, e.g.VMFacebook
. Calling the Login with Social logs the Consumer into the system and creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
Detail Methods
-
– detailConsumerWithUserToken:completionBlock:failBlock:
Gets the current consumer details.
-
– updateConsumerWithUserToken:consumer:completionBlock:failBlock:
Updates a subset of consumer properties.
-
– updateConsumerWithUserToken:firstName:lastName:fullName:gender:dateOfBirth:city:emailAddress:completionBlock:failBlock:
Updates a subset of consumer properties.
RedeemOffers Methods
-
– createRedeemedOffersWithUserToken:offerId:completionBlock:failBlock:
Takes a snapshot of the current state of the offer and creates a ‘redeemed offer’ resource.
-
– listRedeemedOffersWithUserToken:completionBlock:failBlock:
Gets a list of offers which have been redeemed by the consumer
-
– deleteRedeemedOffersWithUserToken:offerId:completionBlock:failBlock:
Sets a redeemed offer’s status to hidden.
Tags Methods
-
– listTagWithUserToken:completionBlock:failBlock:
Gets the list of the tag values that are assigned to the current consumer. The string value returned for each tag is the referenceCode of tag value (unique text code).
-
– addTagsWithUserToken:completionBlock:failBlock:tagValueReferenceCodes:
Attempts to add a range of tag values to a consumer. Any invalid or duplicate values will fail silently.
-
– removeTagsWithUserToken:completionBlock:failBlock:tagValueReferenceCodes:
Attempts to remove a range of tag values from the consumer. Any invalid or missing values will fail silently.
-
– updateTagWithUserToken:tagValueAddReferenceCodes:tagValueRemoveReferenceCodes:completionBlock:failBlock:
Attempts to add a range of tag values to a consumer and remover a range of tag values from a consumer. Any invalid or duplicate values will fail silently.
CrossReference Methods
-
– createCrossReferenceWithPushNotification:userToken:completionBlock:failBlock:
Cross References are created between the core data and 3rd parties such as GCM. For example, when a device is registered with GCM, it sends the registration through this api to create the cross reference between consumer and GCM
-
– createCrossReferenceWithExternalId:userToken:systemType:completionBlock:failBlock:
Cross References are created between the core data and 3rd parties such as GCM. For example, when a device is registered with GCM, it sends the registration through this api to create the cross reference between consumer and gcm
Instance Methods
addTagsWithUserToken:completionBlock:failBlock:tagValueReferenceCodes:
Attempts to add a range of tag values to a consumer. Any invalid or duplicate values will fail silently.
- (VMHTTPRequestOperation *)addTagsWithUserToken:(NSString *)token completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock tagValueReferenceCodes:(NSString *)tagValueReferenceCode, ...
Parameters
- token
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
- tagValueReferenceCodes
tags Value Reference Codes being added.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
createCrossReferenceWithExternalId:userToken:systemType:completionBlock:failBlock:
Cross References are created between the core data and 3rd parties such as GCM. For example, when a device is registered with GCM, it sends the registration through this api to create the cross reference between consumer and gcm
- (VMHTTPRequestOperation *)createCrossReferenceWithExternalId:(NSString *)externalId userToken:(NSString *)userToken systemType:(VMCrossReferenceType)crossReferenceType completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- externalId
external Id
- userToken
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
- token
is the ID supplied by the 3rd party system.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
createCrossReferenceWithPushNotification:userToken:completionBlock:failBlock:
Cross References are created between the core data and 3rd parties such as GCM. For example, when a device is registered with GCM, it sends the registration through this api to create the cross reference between consumer and GCM
- (VMHTTPRequestOperation *)createCrossReferenceWithPushNotification:(NSString *)token userToken:(NSString *)userToken completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Push Notification token.
- userToken
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
createRedeemedOffersWithUserToken:offerId:completionBlock:failBlock:
Takes a snapshot of the current state of the offer and creates a ‘redeemed offer’ resource.
- (VMHTTPRequestOperation *)createRedeemedOffersWithUserToken:(NSString *)token offerId:(NSString *)offerId completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- offerId
offerID.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
deleteRedeemedOffersWithUserToken:offerId:completionBlock:failBlock:
Sets a redeemed offer’s status to hidden.
- (VMHTTPRequestOperation *)deleteRedeemedOffersWithUserToken:(NSString *)token offerId:(NSString *)offerId completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- offerId
offerID.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
detailConsumerWithUserToken:completionBlock:failBlock:
Gets the current consumer details.
- (VMHTTPRequestOperation *)detailConsumerWithUserToken:(NSString *)token completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
listRedeemedOffersWithUserToken:completionBlock:failBlock:
Gets a list of offers which have been redeemed by the consumer
- (VMHTTPRequestOperation *)listRedeemedOffersWithUserToken:(NSString *)token completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
listTagWithUserToken:completionBlock:failBlock:
Gets the list of the tag values that are assigned to the current consumer. The string value returned for each tag is the referenceCode of tag value (unique text code).
- (VMHTTPRequestOperation *)listTagWithUserToken:(NSString *)token completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
loginConsumerWithSocialToken:socialType:completionBlock:failBlock:
The Login with Social service is provided for either new or existing Consumers to login using 3rd party credentials. (e.g. Facebook / Twitter). The API will resolve the ‘Username’ to a genuine 3rd party Access Token (e.g. in the case of Facebook it will just be a code which can then be used to retrieve an access token) and then retrieve basic user information, before returning a ‘VMob’ Access Token. The socialType
defines which 3rd Party site and authentication method to use, e.g. VMFacebook
.
Calling the Login with Social logs the Consumer into the system and creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
- (VMHTTPRequestOperation *)loginConsumerWithSocialToken:(NSString *)token socialType:(VMSocialType)socialType completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
3rd party token.
- socialType
Defines which 3rd Party site and authentication method to use.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
loginConsumerWithUserName:password:completionBlock:failBlock:
The Login with Username service is provided for existing Consumers to login using their username and password. The username will be either an email address or mobile phone number depending on how the Consumer had initially registered. Login with Username will typically be used when logging into a second or subsequent Device, or via the browser etc. This is because in the normal process flow, a Consumer will register and the Access Token will be returned and cached. The Access Token is then must be used when starting the application instead of getting the Consumer to log in again. Calling the Login with Username logs the Consumer into the system and creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
- (VMHTTPRequestOperation *)loginConsumerWithUserName:(NSString *)userName password:(NSString *)password completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- userName
Consumer’s user name. Username and password are required.
- password
Consumer’s password. Username and password are required.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
registerConsumerWithAnonymousUserName:password:completionBlock:failBlock:
The Create Anonymous Registration service is provided for client application to register without providing any Consumer details. A unique username and password is still required as the system will create an unique Anonymous Consumer record. This username and password can be discarded, only the saved Access Token is required to make subsequent API calls.
- (VMHTTPRequestOperation *)registerConsumerWithAnonymousUserName:(NSString *)userName password:(NSString *)password completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- userName
Consumer’s user name.
- password
Consumer’s password. Password minimal length is 6 characters.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
registerConsumerWithEmail:userName:password:firstName:lastName:fullName:gender:dateOfBirth:city:completionBlock:failBlock:
The Create Email Registration service is provided for registering of new Consumers using their email address as the Username. Calling the Create Email Registration creates a new Consumer in the system, Logs the Consumer in and then creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
- (VMHTTPRequestOperation *)registerConsumerWithEmail:(NSString *)email userName:(NSString *)userName password:(NSString *)password firstName:(NSString *)firstName lastName:(NSString *)lastName fullName:(NSString *)fullName gender:(VMGender)gender dateOfBirth:(NSDate *)dateOfBirth city:(NSString *)city completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
Consumer’s email. The email address must be a valid email.
- userName
Consumer’s user name.
- password
Consumer’s password. Password minimal length is 6 characters.
- firstName
Consumer’s first name. Either First and Lastname must be present OR the full name
- lastName
Consumer’s last name. Either First and Lastname must be present OR the full name
- fullName
Consumer’s full name. Either First and Lastname must be present OR the full name
- gender
Consumer’s gender.
- dateOfBirth
Consumer’s date of birth.
- city
Consumer’s city.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
registerConsumerWithMobilePhone:userName:password:firstName:lastName:fullName:gender:dateOfBirth:city:completionBlock:failBlock:
The Create Mobile Phone Number Registration service is provided for registering of new Consumers using their mobile phone number as the Username. Calling the Create Mobile Phone Number Registration creates a new Consumer in the system, Logs the Consumer in and then creates and saves a valid OAuth Access Token. The saved OAuth Access Token can then be used in for subsequent API calls to identify the Consumer of the Client Application.
- (VMHTTPRequestOperation *)registerConsumerWithMobilePhone:(NSString *)mobilePhoneNumber userName:(NSString *)userName password:(NSString *)password firstName:(NSString *)firstName lastName:(NSString *)lastName fullName:(NSString *)fullName gender:(VMGender)gender dateOfBirth:(NSDate *)dateOfBirth city:(NSString *)city completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- mobilePhoneNumber
Consumer’s phone number. It must contain an international prefix (+61 ….)
- userName
Consumer’s user name.
- password
Consumer’s password. Password minimal length is 6 characters.
- firstName
Consumer’s first name. Either First and Lastname must be present OR the full name.
- lastName
Consumer’s last name. Either First and Lastname must be present OR the full name.
- fullName
Consumer’s full name. Either First and Lastname must be present OR the full name.
- gender
Consumer’s gender.
- dateOfBirth
Consumer’s date of birth.
- city
Consumer’s city.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
removeTagsWithUserToken:completionBlock:failBlock:tagValueReferenceCodes:
Attempts to remove a range of tag values from the consumer. Any invalid or missing values will fail silently.
- (VMHTTPRequestOperation *)removeTagsWithUserToken:(NSString *)token completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock tagValueReferenceCodes:(NSString *)tagValueReferenceCode, ...
Parameters
- token
Access token.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
- tagValueReferenceCodes
remove tags Value Reference Codes.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
updateConsumerWithUserToken:consumer:completionBlock:failBlock:
Updates a subset of consumer properties.
- (VMHTTPRequestOperation *)updateConsumerWithUserToken:(NSString *)token consumer:(VMConsumer *)consumer completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- consumer
Updated
VMConsumer
object.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
updateConsumerWithUserToken:firstName:lastName:fullName:gender:dateOfBirth:city:emailAddress:completionBlock:failBlock:
Updates a subset of consumer properties.
- (VMHTTPRequestOperation *)updateConsumerWithUserToken:(NSString *)token firstName:(NSString *)firstName lastName:(NSString *)lastName fullName:(NSString *)fullName gender:(VMGender)gender dateOfBirth:(NSDate *)dateOfBirth city:(NSString *)city emailAddress:(NSString *)emailAddress completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- firstName
Consumer’s first name. Either both the
firstName
andlastName
properties or just thefullName
must be supplied, it is not necessary to supply both.
- lastName
Consumer’s last name. Either both the
firstName
andlastName
properties or just thefullName
must be supplied, it is not necessary to supply both.
- fullName
Consumer’s full name. Either both the
firstName
andlastName
properties or just thefullName
must be supplied, it is not necessary to supply both.
- gender
Consumer’s gender.
- dateOfBirth
Consumer’s date of birth.
- city
Consumer’s city. Home City is a new property, if not implemented on the client application yet, please specify as ‘2’
- emailAddress
email Address update
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h
updateTagWithUserToken:tagValueAddReferenceCodes:tagValueRemoveReferenceCodes:completionBlock:failBlock:
Attempts to add a range of tag values to a consumer and remover a range of tag values from a consumer. Any invalid or duplicate values will fail silently.
- (VMHTTPRequestOperation *)updateTagWithUserToken:(NSString *)token tagValueAddReferenceCodes:(NSArray *)tagValueAddReferenceCodes tagValueRemoveReferenceCodes:(NSArray *)tagValueRemoveReferenceCodes completionBlock:(ObjectBlock)completionBlock failBlock:(ErrorBlock)errorBlock
Parameters
- token
Access token.
- tagValueAddReferenceCodes
added tags Value Reference Codes.
- tagValueRemoveReferenceCodes
remove tags Value Reference Codes.
- completionBlock
The block to be executed on the completion of a successful request. This block has no return value and takes one argument: the object constructed from the response data of the request.
- errorBlock
The block to be executed on the completion of an unsuccessful request. This block has no return value and takes one argument: the error that occurred during the request.
Return Value
A new request operation.
Declared In
VMConsumerManager.h