The Agent project is a collection of managers, each having responsibility for a particular area of business logic.
Managers
The iOSRestManager has the important responsibility of establishing a connection to the server. Each of the other managers uses the iOSRestManager to make a request to the server via REST. The iOSRestManager also includes a number of helper methods for frequently performed tasks. For example, checkForError checks a REST response for errors.
Managers encapsulate request creation and response management logic that ViewControllers can use to handle the creation of requests for data, and the receipt of their responses. ATGManagerRequest is a wrapper around ATGRestOperation and is the base class for all other requests in Assisted Selling. ATGManagerRequest gets a reference to the result of the call. For example, the ATGProfileManager.getProfile method returns a reference to an ATGProfileRequest, which contains the actual profile representation in its requestResults property.
Each manager uses a corresponding subclass of ATGManagerRequest for its server communication. For example, ATGProfileManager uses ATGProfileRequest. The definitions of the managers and their requests are located in the Managers directory of the ATGMobileClient project.
The following table shows the managers that are provided by Assisted Selling and a brief summary of their responsibilities.
Manager | Responsibility |
|---|---|
| All commerce-related functions such as cart actions, billing, shipping, and checkout. |
| User-related functions such as login/logout and account management functions such as viewing and editing a profile. |
| This is the same as |
| Provides callback for actions that require a login. |
| The base class for all manager requests. |
| Retrieves product information including inventory levels and registering for back-in-stock notifications. Also retrieves product comparison requests. |
| User-related functions such as login/logout and account management functions such as viewing and editing a profile. |
| Manages connections to the server. |
| Saves and retrieves values from the iOS keychain. |
| Retrieves store information. |
| Agent-specific version of the commerce manager class. |
| Manager for agent environment related server calls. |
| Delegates callback when the current catalog has been set. |
| The results of requesting environment data. |
| Manages site related server calls. |
| The callback delegate for site related server calls. |
| Request handler for |
| Manages customer related server calls. |
| Callback delegate for customer related server calls |
| Request handler for |
Each manager is implemented as a singleton. Consequently, ViewControllers use the appropriate manager’s singleton instance to request data from the server. Most importantly, when the ViewController requests that the manager fetch data for it, it sets itself as the request delegate so that it receives the appropriate callback, either a success or failure block, when the response to the asynchronous request is available. When a response is returned from the server, the manager executes the success or failure block.
Each manager includes a delegate protocol definition that identifies those callbacks that should be invoked for each response from the server. In the case of the ATGProfileManager, this is the ATGProfileManagerDelegate. For example:
@protocol ATGProfileManagerDelegate <NSObject>
The delegate protocol defines callback methods for the manager. The protocol does not actually implement the method, rather they are implemented by other classes.
From within a delegate callback, the ATGManagerRequest handles the response by executing the success or failure block.

