Skip to content

Commit

Permalink
Updating response serialization mapper implementation to not be endpo…
Browse files Browse the repository at this point in the history
…int specific
  • Loading branch information
Conrad Stoll committed Jan 17, 2014
1 parent e2a2de8 commit 21682a1
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ - (BOOL)response:(NSURLResponse *)response containsPathComponentString:(NSString
return NO;
}

- (NSEntityDescription *)entityName:(NSString *)entityName mapsToResponse:(NSURLResponse *)response context:(NSManagedObjectContext *)context {
if ([self response:response containsPathComponentString:@"venues/search?"]) {
- (NSEntityDescription *)entityName:(NSString *)entityName
mapsToEndPoint:(NSString *)endpoint
withResponse:(NSURLResponse *)response
context:(NSManagedObjectContext *)context {
if ([self response:response containsPathComponentString:endpoint]) {
return [NSEntityDescription entityForName:entityName inManagedObjectContext:context];
}

Expand All @@ -76,7 +79,10 @@ - (NSEntityDescription *)recordResponseSerializer:(AFMMRecordResponseSerializer
for (NSString *endpoint in self.mapping.allKeys) {
NSString *entityName = [self.mapping objectForKey:endpoint];

NSEntityDescription *entity = [self entityName:entityName mapsToResponse:response context:context];
NSEntityDescription *entity = [self entityName:entityName
mapsToEndPoint:endpoint
withResponse:response
context:context];

if (entity != nil) {
return entity;
Expand Down

0 comments on commit 21682a1

Please sign in to comment.