Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created March 1, 2014 21:54
Show Gist options
  • Save rodericj/9298079 to your computer and use it in GitHub Desktop.
Save rodericj/9298079 to your computer and use it in GitHub Desktop.
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"https://api.foursquare.com/"]];
objectManager.managedObjectStore = [self managedObjectStore];
RKEntityMapping* listMapping = [RKEntityMapping mappingForEntityForName:[FOFSList entityName] inManagedObjectStore:objectManager.managedObjectStore];
[listMapping addAttributeMappingsFromDictionary:@{
@"id": @"listID",
@"title": @"name",
@"description": @"desc",
@"user": @"user",
@"following": @"following",
// @"editable": @"editable",
@"collaborative": @"collaborative",
@"canonicalUrl": @"canonicalUrl",
@"venueCount": @"venueCount",
@"visitedCount": @"visitedCount"
}];
RKResponseDescriptor * responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:listMapping
method:RKRequestMethodGET pathPattern:nil keyPath:@"response.lists.groups" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:responseDescriptor];
listMapping.identificationAttributes = @[ @"listID" ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment