GravityClient Class Reference

Inherits from NSObject
Conforms to CLLocationManagerDelegate
Declared in GravityClient.h
GravityClient.m

Overview

A client for the Gravity recommendation service

Other Methods

  delegate

Delegate of GravityClient

@property id<GravityClientDelegate> delegate

Discussion

Delegate of GravityClient

Declared In

GravityClient.h

  baseURL

Base URL of the REST service

@property NSString *baseURL

Discussion

Base URL of the REST service

Declared In

GravityClient.h

  username

Username to access the service

@property NSString *username

Discussion

Username to access the service

Declared In

GravityClient.h

  password

Password of the given username

@property NSString *password

Discussion

Password of the given username

Declared In

GravityClient.h

  userId

UserId of the authenticated client This will be automatically included in the request parameters

@property NSString *userId

Discussion

UserId of the authenticated client This will be automatically included in the request parameters

Declared In

GravityClient.h

  cookieId

CookieId of the client This is automatically generated and unique for every device This will be automatically included in the request parameters

@property NSString *cookieId

Discussion

CookieId of the client This is automatically generated and unique for every device This will be automatically included in the request parameters

Declared In

GravityClient.h

  lastRecommandation

The last recommendation received by the client

@property GravityItemRecommendation *lastRecommandation

Discussion

The last recommendation received by the client

Declared In

GravityClient.h

  recommendedItems

List of items that have already been recommended

@property NSMutableDictionary *recommendedItems

Discussion

List of items that have already been recommended

Declared In

GravityClient.h

  location

Location of the client This will be automatically included in the events sent to the server

@property CLLocation *location

Discussion

Location of the client This will be automatically included in the events sent to the server

Declared In

GravityClient.h

+ escapeString:

Escapes an URL string with percent signes

+ (NSString *)escapeString:(NSString *)aString

Parameters

aString

the string to be escaped

Return Value

the escaped string

Discussion

Escapes an URL string with percent signes

Declared In

GravityClient.h

– initWithURL:

Initalizes a GravityClient connection with an URL

- (id)initWithURL:(NSString *)url

Parameters

url

the url of the service

Return Value

an initializes GravityClient object

Discussion

Initalizes a GravityClient connection with an URL

Declared In

GravityClient.h

– initWithURL:username:password:

Initalizes a GravityClient connection with an URL and credentials

- (id)initWithURL:(NSString *)url username:(NSString *)username password:(NSString *)password

Parameters

url

the url of the service

username

username to access the service

password

the password of the username

Return Value

an initializes GravityClient object

Discussion

Initalizes a GravityClient connection with an URL and credentials

Declared In

GravityClient.h

– sayHelloTo:

Calls a test REST API call which says hello to the given name

- (GravityRequest *)sayHelloTo:(NSString *)name

Parameters

name

the name to say hello to

Return Value

a reference the the request object

Discussion

Calls a test REST API call which says hello to the given name

Declared In

GravityClient.h

– getItemRecommendations:limit:resultNameValues:

Gets item recommendations

- (GravityRequest *)getItemRecommendations:(NSString *)scenarioId limit:(NSUInteger)limit resultNameValues:(NSArray *)nameValues

Parameters

scenarioId

the scenario

limit

the maximum number of result items

nameValues

NameValues that should be included in the result

Return Value

a reference the the request object

Discussion

Gets item recommendations

Declared In

GravityClient.h

– getItemRecommendations:limit:resultNameValues:attributes:

Gets item recommendations

- (GravityRequest *)getItemRecommendations:(NSString *)scenarioId limit:(NSUInteger)limit resultNameValues:(NSArray *)nameValues attributes:(NSArray *)attributes

Parameters

scenarioId

the scenario

limit

the maximum number of result items

nameValues

NameValues that should be included in the result

attributes

any additional parameter to the request

Return Value

a reference the request object

Discussion

Gets item recommendations

Declared In

GravityClient.h

– getItemRecommendationBulk:

Gets item recommendations in a bulk way

- (GravityRequest *)getItemRecommendationBulk:(GravityRecommendationContext *)context

Parameters

context

the GravityRecommendationContext wich holds the scenarioId, numberLimit, nameValues and resultNameValues

Discussion

Gets item recommendations in a bulk way

Declared In

GravityClient.h

– getItemRecommendationsBulk:

Gets item recommendations in a bulk way

- (GravityRequest *)getItemRecommendationsBulk:(NSArray *)contexts

Parameters

contexts

the context array. A GravityRecommendationContext holds the scenarioId, numberLimit, nameValues and resultNameValues

Discussion

Gets item recommendations in a bulk way

Declared In

GravityClient.h

– searchItemsWithKeyword:limit:resultNameValues:

Searches items with the given keyword

- (GravityRequest *)searchItemsWithKeyword:(NSString *)keyword limit:(NSUInteger)limit resultNameValues:(NSArray *)nameValues

Parameters

keyword

keyword to search for

limit

the maximum number of result items

nameValues

NameValues that should be included in the result

Return Value

a reference the the request object

Discussion

Searches items with the given keyword

Declared In

GravityClient.h

– searchItemsWithKeyword:limit:resultNameValues:orderBy:

Searches items with the given keyword and orders result

- (GravityRequest *)searchItemsWithKeyword:(NSString *)keyword limit:(NSUInteger)limit resultNameValues:(NSArray *)nameValues orderBy:(GravityResultOrder)order

Parameters

keyword

keyword to search for

limit

the maximum number of result items

nameValues

NameValues that should be included in the result

order

defines how to order results

Return Value

a reference the the request object

Discussion

Searches items with the given keyword and orders result

Declared In

GravityClient.h

– addEvent:

Adds a new event

- (GravityRequest *)addEvent:(GravityEvent *)event

Parameters

event

the event object

Return Value

a reference the the request object

Discussion

Adds a new event

Declared In

GravityClient.h

– addEvents:

Adds new events

- (GravityRequest *)addEvents:(NSArray *)events

Parameters

events

the event array

Return Value

a reference the the request object

Discussion

Adds new events

Declared In

GravityClient.h

– addItem:

Adds a new item to the RECO if the item has not been added yet. If the given item is already exist it will be updated. An item is already exist if there is an item with the same Id in the system.

- (GravityRequest *)addItem:(GravityItem *)item

Parameters

item

the item object

Discussion

Adds a new item to the RECO if the item has not been added yet. If the given item is already exist it will be updated. An item is already exist if there is an item with the same Id in the system.

Declared In

GravityClient.h

– addItems:

Adds items to the RECO if the item has not been added yet. If the given item is already exist it will be updated. An item is already exist if there is an item with the same Id in the system.

- (GravityRequest *)addItems:(NSArray *)item

Parameters

item

the item object

Discussion

Adds items to the RECO if the item has not been added yet. If the given item is already exist it will be updated. An item is already exist if there is an item with the same Id in the system.

Declared In

GravityClient.h

– updateItem:

Sets hidden value for an item. If an item is hidden it won’t be recommended. If you want to delete an item you should hide it, beacuse item deletion is not supported.

- (GravityRequest *)updateItem:(GravityItem *)item

Parameters

item

the item object

Discussion

Sets hidden value for an item. If an item is hidden it won’t be recommended. If you want to delete an item you should hide it, beacuse item deletion is not supported.

Declared In

GravityClient.h

– updateItems:

Sets hidden value for items. If an item is hidden it won’t be recommended. If you want to delete an item you should hide it, beacuse item deletion is not supported.

- (GravityRequest *)updateItems:(NSArray *)items

Parameters

item

the item object

Discussion

Sets hidden value for items. If an item is hidden it won’t be recommended. If you want to delete an item you should hide it, beacuse item deletion is not supported.

Declared In

GravityClient.h

– addUser:

Adds or updates an user.

- (GravityRequest *)addUser:(GravityUser *)user

Parameters

users

the users array

Discussion

Adds or updates an user.

Declared In

GravityClient.h

– addUsers:

Adds or updates users.

- (GravityRequest *)addUsers:(NSArray *)users

Parameters

users

the users array

Discussion

Adds or updates users.

Declared In

GravityClient.h

– getAllScenarioInfo

Gets all scenarioInfo

- (GravityRequest *)getAllScenarioInfo

Parameters

user

the user object

Discussion

Gets all scenarioInfo

Declared In

GravityClient.h

– trackLocation

Gets user location info and stores it for later events

- (void)trackLocation

Discussion

Gets user location info and stores it for later events

Declared In

GravityClient.h

Other Methods

– init

- (id)init

– sendRequest:

- (GravityRequest *)sendRequest:(GravityRequest *)request

– appendUserIdToRequest:

- (void)appendUserIdToRequest:(GravityRequest *)request

– locationManager:didFailWithError:

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error

– locationManager:didUpdateLocations:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations